aws-codebuild-run-build
aws-codebuild-run-build copied to clipboard
In a failFast configuration need to be able to stop the build.
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.
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.
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
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?