Skip to content

Support for Github concurrency to stop obsolete builds #143

@pviolette3

Description

@pviolette3

One key feature of Github Actions is the ability to kill obsolete builds when an update to a PR is pushed, through concurrency control (https://docs.github.com/en/actions/using-jobs/using-concurrency#overview).

I believe the way this Action works is (per docs):

  1. Github starts aws-codebuild-run-build action based on some event (e.g. PR created/updated/edited)
  2. aws-codebuild-run-build action starts codebuild
  3. aws-codebuild-run-build action polls codebuild for status
  4. aws-codebuild-run-build action succeeds or fails based on the final status

I was curious how to accomplish canceling the codebuild job started in (2) if during the polling step (3), the Github action is cancelled.
Would it be possible to use the expression functionality, to stop the aws-codebuild-run-build-action's aws-build-id when the cancellation happens, for example?

Curious if anyone in the community has gotten something like this to work, or if there are any contributions that would be needed to the action to allow this type of thing to work?

Related issue: #134 (comment)

(edit: Action State seems relevant. step (2) could store the build ID in Action State (which can potentially be removed in step (4) upon completion). Then, we can add a cleanup step after main that stops the build if the active build ID is present in the Action State.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions