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

how to override "source version" in github actions?

Open vitek-urbanec opened this issue 4 years ago • 12 comments

Hello,

What I'd like to have is a workflow in github actions that triggers for every branch on push (defined in a workflow in master default branch).

This workflow should trigger aws-codebuild-run-build action & the codebuild project should download source from a branch some_branch.

If I understood correctly, aws-codebuild-run-build overrides the source version to the triggering commit, regardless of the settings in the codebuild project.

How do I make sure that codebuild is going to get source from the specified branch some_branch?

Thanks!

vitek-urbanec avatar Mar 16 '21 17:03 vitek-urbanec

Hey there, were you able to find a solution? I am running into the same issue.

jayheehee avatar Jul 19 '21 22:07 jayheehee

This action should support all of the source version syntax as specified by https://docs.aws.amazon.com/codebuild/latest/userguide/sample-source-version.html

solarmosaic-kflorence avatar Aug 19 '21 22:08 solarmosaic-kflorence

Seems that PR https://github.com/aws-actions/aws-codebuild-run-build/pull/62 tries to address this.

kimmoahokas avatar Nov 24 '21 09:11 kimmoahokas

Probably you can use dark-mechanicum/aws-codebuild@v1 action to implement what you need.

name: Running example
on: [push]

env:
  AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
  AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
  AWS_REGION: ${{ secrets.AWS_REGION }}

jobs:
  deploy:
    name: 'Deployment'
    runs-on: ubuntu-latest
    steps:
      - name: Executing AWS CodeBuild task
        uses: dark-mechanicum/aws-codebuild@v1
        env:
          CODEBUILD__sourceVersion: "my-cool-branch-name"
        with:
          projectName: '<your-aws-codebuild-job-name-here>'

akazakou avatar Jul 16 '22 15:07 akazakou

Hey @akazakou!

As far as I understand, this action doesn't wait for the final result of the codebuild project. It only triggers the project and proceeds to the next github action step. Am I right?

ozgenbaris1 avatar Jul 18 '22 12:07 ozgenbaris1

@ozgenbaris1 is waiting for results and showing logs in GitHub actions logs output. :) Please, check that in your CodeBuild Job logs settings you have enabled the checkbox to enable CloudWatch logs. Parameters of log group and prefix (stream) can be empty.

akazakou avatar Jul 18 '22 13:07 akazakou

Is there an additional config that I'm missing out? Once the step starts, the only log I'm getting is below. It lasts 0 seconds

CodeBuild project job project_name:some-id was started successful.

would appreciate if you can help

ozgenbaris1 avatar Jul 18 '22 13:07 ozgenbaris1

CodeBuild project job project_name:some-id was started successful.

@ozgenbaris1 Is that the exact log or did you just replace it?

Please, check that in your CodeBuild Job logs settings you have enabled the checkbox to enable CloudWatch logs. Parameters of log group and prefix (stream) can be empty.

akazakou avatar Jul 18 '22 13:07 akazakou

@akazakou

Is that the exact log or did you just replace it?

The bold parts are just placeholders. Other parts are exact logs.

Please, check that in your CodeBuild Job logs settings you have enabled the checkbox to enable CloudWatch logs. Parameters of log group and prefix (stream) can be empty.

If you are talking about the image below, it seems it is already enabled. What else can I check?

image

Also, I checked cloudwatch in order to see if codebuild job exports the logs successfully. Seems ok

ozgenbaris1 avatar Jul 18 '22 13:07 ozgenbaris1

@ozgenbaris1 Yes. I'm talking about that option. Could you please provide me with the whole output for that GitHub action?

And yes, please create an issue in action repository https://github.com/dark-mechanicum/aws-codebuild/issues/new Let's move discussion there

akazakou avatar Jul 18 '22 14:07 akazakou

@akazakou I created the issue. Thanks

ozgenbaris1 avatar Jul 19 '22 08:07 ozgenbaris1

The issue was resolved. And for now, it was added a lot of new features! :)

akazakou avatar Jul 23 '22 11:07 akazakou