Skip to content

Commit

Permalink
If docker wait fails, get the exit code using docker inspect
Browse files Browse the repository at this point in the history
  • Loading branch information
teor2345 committed Jun 30, 2022
1 parent ef33162 commit 0a5734e
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions .github/workflows/deploy-gcp-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -666,16 +666,20 @@ jobs:
# `docker wait` can also wait for multiple containers, but we only ever wait for a single container.
- name: Result of ${{ inputs.test_id }} test
run: |
EXIT_CODE=$(\
gcloud compute ssh \
${{ inputs.test_id }}-${{ env.GITHUB_REF_SLUG_URL }}-${{ env.GITHUB_SHA_SHORT }} \
--zone ${{ env.ZONE }} \
--quiet \
--ssh-flag="-o ServerAliveInterval=5" \
--command="docker wait ${{ inputs.test_id }}" \
)
echo "$EXIT_CODE"
exit "$EXIT_CODE"
--command=' \
EXIT_STATUS=$( \
docker wait ${{ inputs.test_id }} || \
docker inspect --format "{{.State.ExitCode}}" ${{ inputs.test_id }} || \
echo "missing container, or missing exit status for container"
); \
echo "docker exit status: $EXIT_STATUS"; \
exit "$EXIT_STATUS" \
'
# create a state image from the instance's state disk, if requested by the caller
Expand Down

0 comments on commit 0a5734e

Please sign in to comment.