gce-github-runner icon indicating copy to clipboard operation
gce-github-runner copied to clipboard

If you cancel the workflow during the `create-runner` it won't delete the worker

Open ravwojdyla opened this issue 4 years ago • 1 comments

If you have 2 stage workflow: create-runner and run + post delete worker, and you cancel the workflow during the create-runner stage, it won't delete the worker. If needed, a workaround could be to have an explicit stop-worker stage.

ravwojdyla avatar Sep 29 '21 11:09 ravwojdyla

FYI we have this internally handled by having a reusable workflow to create runner, and handle cancel there via something similar to:

<TRUNCATED>
...

      - uses: google-github-actions/auth@v1
        if: cancelled()

      - uses: google-github-actions/setup-gcloud@v1
        if: cancelled()

      - name: Delete runner VM
        if: cancelled()
        run: >
          gcloud compute instances delete
          gce-gh-runner-${{ github.run_id }}-${{ github.run_attempt }}
          --quiet

ravwojdyla avatar Dec 30 '22 13:12 ravwojdyla