stdlib: netlify: export the deployUrl and logsUrl

Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
This commit is contained in:
Andrea Luzzardi 2021-03-18 17:37:54 -07:00
parent 5438e4177c
commit fbdfe27103
2 changed files with 57 additions and 45 deletions

View File

@ -33,9 +33,14 @@ import (
// Create the Netlify site if it doesn't exist?
create: bool | *true
// Deployment url
url: {
string
// Website url
url: string
// Unique Deploy URL
deployUrl: string
// Logs URL for this deployment
logsUrl: string
#compute: [
llb.#Load & {
@ -74,12 +79,11 @@ import (
mount: "/src": from: contents
},
llb.#Export & {
source: "/url"
format: "string"
source: "/output.json"
format: "json"
},
]
}
}
// FIXME: this should be outside
let code = #"""
@ -119,5 +123,13 @@ let code = #"""
--prod \
| tee /tmp/stdout
</tmp/stdout sed -n -e 's/^Website URL:.*\(https:\/\/.*\)$/\1/p' | tr -d '\n' > /url
url=$(</tmp/stdout sed -n -e 's/^Website URL:.*\(https:\/\/.*\)$/\1/p' | tr -d '\n')
deployUrl=$(</tmp/stdout sed -n -e 's/^Unique Deploy URL:.*\(https:\/\/.*\)$/\1/p' | tr -d '\n')
logsUrl=$(</tmp/stdout sed -n -e 's/^Logs:.*\(https:\/\/.*\)$/\1/p' | tr -d '\n')
jq -n \
--arg url "$url" \
--arg deployUrl "$deployUrl" \
--arg logsUrl "$logsUrl" \
'{url: $url, deployUrl: $deployUrl, logsUrl: $logsUrl}' > /output.json
"""#

View File

@ -52,7 +52,7 @@ TestNetlify: {
"pipefail",
"-c",
#"""
test "$(curl \#(deploy.url))" = "\#(random)"
test "$(curl \#(deploy.deployUrl))" = "\#(random)"
"""#,
]
},