From 71a2280a1e28790fafa4790bbff2a4e0b193c53d Mon Sep 17 00:00:00 2001 From: teor Date: Wed, 29 Jun 2022 10:48:48 +1000 Subject: [PATCH] Avoid launching multiple docker instances for duplicate jobs --- .github/workflows/deploy-gcp-tests.yml | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/.github/workflows/deploy-gcp-tests.yml b/.github/workflows/deploy-gcp-tests.yml index 46276fbeca2..31b7609639e 100644 --- a/.github/workflows/deploy-gcp-tests.yml +++ b/.github/workflows/deploy-gcp-tests.yml @@ -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' @@ -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' @@ -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: @@ -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: @@ -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: