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

Allow custom sourceVersion

Open maastrich opened this issue 2 years ago • 3 comments

Context

I am currently working on developing workflows for stack deployment through CodeBuild. This includes a need to terminate previous builds before initiating a new one. To implement this, I currently list the commit SHA and passes it to the CodeBuild run to stop the previous build.

Issue

I experience functional difficulties with this workflow when rebasing the branch, as the commit tree is completely different following the rebase.

Suggested Solution

Here are my solutions propositions to override the source version.

Proposal 1

The first proposition is to simply pass a source version adhering to the AWS CodeBuild sourceVersion standard. The proposed implementation is:

- name: Trigger build on Codebuild
  uses: aws-actions/aws-codebuild-run-build@v1
  with:
    project-name: MyProjectName
    sourceVersion: refs/pull/${{ github.event.pull_request.number }}/head # or ${{ github.ref }} or ${{ github.sha }}

Proposal 2

The second proposition is slightly different, using a sourceVersionStrategy parameter instead. The proposed implementation is:

- name: Trigger build on Codebuild
  uses: aws-actions/aws-codebuild-run-build@v1
  with:
    project-name: MyProjectName
    sourceVersionStrategy: pull_request # or branch or sha

Personal notes

I'll be happy to implement this feature if ever approved

maastrich avatar May 24 '23 15:05 maastrich

I would love to see this as well. My org requires that production builds are deployed using Github tags. I love giving my team the ability to see the codebuild logs inside of the github Actions, however it is impossible for prod since we cannot choose the tag version.

rstuhlmuller avatar Jul 31 '23 22:07 rstuhlmuller

This is needed in my case as well. As the source differs based on release tag

sslankesh avatar Aug 31 '23 13:08 sslankesh

I also needed this so took a stab at above proposal 1 and created a PR for it, #151

petteriv-nordic avatar Jan 16 '24 14:01 petteriv-nordic