I'm probably missing something obvious...
adding some light automation on simple post-deploy checks
but I am not able to get a failing exit code to fail the runbook run
What am I missing?
url=$(get_octopusvariable "SmokeTestURL")
statusCode=$(curl -X POST \
--silent \
--output /dev/null \
--write-out "%{http_code}" \
--header "accept: application/json" \
--header "Content-Type: application/json" \
--data "..." \
$url)
echo $statusCode
exitStatus=$(if [ $statusCode=200 ]; then echo 0; else echo 1; fi)
exit $exitStatus
CodePudding user response:
if [ $statusCode=200 ];
I think spaces are mandatory here. Also you should use quotes just in case $statusCode will be empty or contains spaces.
Also you can use shorter code:
[ "$statusCode" = "200" ] && exit 0 || exit 1