aws-codebuild-run-build icon indicating copy to clipboard operation
aws-codebuild-run-build copied to clipboard

In a failFast configuration need to be able to stop the build.

Open seebees opened this issue 5 years ago • 4 comments

seebees avatar Jan 28 '20 23:01 seebees

I think this is a simple but crucial feature. Sometimes you need to stop the build in gha before it does something stupid. But since now codebuild will continue anyway it would be very dangerous.

lackhoa avatar May 27 '21 10:05 lackhoa

I can add another use case. We execute some long-running (up to 2-3 hours) tests in CodeBuild, and use GH workflow on workflow_dispatch to manually trigger that execution. If the person who triggered execution sees in logs something wrong and cancels workflow (so errors could be fixed and workflow triggered again), CodeBuild continues to run and we have to wait for several hours until it finishes to free up other system resources, consumed in that execution. It would be nice to be able to cancel running CodeBuild job if the workflow is canceled.

luzhkovvv avatar Jul 07 '21 08:07 luzhkovvv

It was already implemented in dark-mechanicum/aws-codebuild action. If you'll click "Cancel Workflow" from GHA interface, it will automatically cancel AWS CodeBuild job

akazakou avatar Jul 23 '22 11:07 akazakou

This would be a great feature. We maintain a call-jenkins-from-GHA action and it was pretty easy to catch SIGINT (which GitHub sends on cancellation) and stop the build we're tailing.

When moving from Jenkins to CodeBuild and using this action, we planned to implement this with our own step using the cancelled() expression:

steps:
  - id: build
    uses: aws-actions/aws-codebuild-run-build@v1
    with:
      # ...
      
  - if: ${{ cancelled() }}
    run: |
      aws codebuild stop-build --id ${{ steps.build.outputs.aws-build-id }}

We'll be trying this soon, but has anyone else done this or know if it will/won't work?

pbrisbin avatar Jul 07 '23 15:07 pbrisbin