Skip to content

Commit

Permalink
Avoid launching multiple docker instances for duplicate jobs
Browse files Browse the repository at this point in the history
  • Loading branch information
teor2345 committed Jun 29, 2022
1 parent c53ef77 commit 71a2280
Showing 1 changed file with 8 additions and 13 deletions.
21 changes: 8 additions & 13 deletions .github/workflows/deploy-gcp-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -162,9 +162,8 @@ jobs:
launch-without-cached-state:
name: Launch ${{ inputs.test_id }} test
needs: [ setup-without-cached-state ]
# If the previous job fails, we also want to run and fail this job,
# so that the branch protection rule fails in Mergify and GitHub.
if: ${{ !cancelled() && !inputs.needs_zebra_state }}
# If creating the Google Cloud instance fails, we don't want to launch another docker instance.
if: ${{ !cancelled() && !failure() && !inputs.needs_zebra_state }}
runs-on: ubuntu-latest
permissions:
contents: 'read'
Expand Down Expand Up @@ -339,9 +338,8 @@ jobs:
launch-with-cached-state:
name: Launch ${{ inputs.test_id }} test
needs: [ setup-with-cached-state ]
# If the previous job fails, we also want to run and fail this job,
# so that the branch protection rule fails in Mergify and GitHub.
if: ${{ !cancelled() && inputs.needs_zebra_state }}
# If creating the Google Cloud instance fails, we don't want to launch another docker instance.
if: ${{ !cancelled() && !failure() && inputs.needs_zebra_state }}
runs-on: ubuntu-latest
permissions:
contents: 'read'
Expand Down Expand Up @@ -465,10 +463,9 @@ jobs:
# follow the logs of the test we just launched, up to Sapling activation (or the test finishing)
logs-sprout:
name: Log ${{ inputs.test_id }} test (sprout)
needs: [ launch-with-cached-state, launch-without-cached-state ]
# We run exactly one of without-cached-state or with-cached-state, and we always skip the other one.
# If the previous job fails, we also want to run and fail this job,
# so that the branch protection rule fails in Mergify and GitHub.
needs: [ launch-with-cached-state, launch-without-cached-state ]
# If the previous job fails, we still want to show the logs.
if: ${{ !cancelled() }}
runs-on: ubuntu-latest
permissions:
Expand Down Expand Up @@ -527,8 +524,7 @@ jobs:
logs-checkpoint:
name: Log ${{ inputs.test_id }} test (checkpoint)
needs: [ logs-sprout ]
# If the previous job fails, we also want to run and fail this job,
# so that the branch protection rule fails in Mergify and GitHub.
# If the previous job fails, we still want to show the logs.
if: ${{ !cancelled() }}
runs-on: ubuntu-latest
permissions:
Expand Down Expand Up @@ -585,8 +581,7 @@ jobs:
logs-end:
name: Log ${{ inputs.test_id }} test (end)
needs: [ logs-checkpoint ]
# If the previous job fails, we also want to run and fail this job,
# so that the branch protection rule fails in Mergify and GitHub.
# If the previous job fails, we still want to show the logs.
if: ${{ !cancelled() }}
runs-on: ubuntu-latest
permissions:
Expand Down

0 comments on commit 71a2280

Please sign in to comment.