Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[aws-codebuild] Codebuild source Github PR doesn't work with FILE_PATH #8867

Closed
Nikamura opened this issue Jul 2, 2020 · 7 comments · Fixed by #9725
Closed

[aws-codebuild] Codebuild source Github PR doesn't work with FILE_PATH #8867

Nikamura opened this issue Jul 2, 2020 · 7 comments · Fixed by #9725
Assignees
Labels
@aws-cdk/aws-codebuild Related to AWS CodeBuild bug This issue is a bug. effort/small Small work item – less than a day of effort good first issue Related to contributions. See CONTRIBUTING.md p1

Comments

@Nikamura
Copy link

Nikamura commented Jul 2, 2020

Trying to create codebuild project with github source and adding pull request created/updated trigger with file_path filter results in an error, while this succeeds doing in the UI.

Reproduction Steps

codebuild.FilterGroup.inEventOf(codebuild.EventAction.PULL_REQUEST_UPDATED).andFilePathIsNot("^my_path.*")

Error Log

node_modules/@aws-cdk/aws-codebuild/lib/source.ts:411
      throw new Error('A file path condition cannot be added if a Group contains any event action other than PUSH');
            ^
Error: A file path condition cannot be added if a Group contains any event action other than PUSH
    at FilterGroup.addFilePathFilter (node_modules/@aws-cdk/aws-codebuild/lib/source.ts:411:13)
    at FilterGroup.andFilePathIsNot (node_modules/@aws-cdk/aws-codebuild/lib/source.ts:360:17)
    at new CodebuildStack (src/codebuild-stack.ts:16:93)
    at Object.<anonymous> (bin/codebuild.ts:9:15)

Environment

  • CLI Version :
  • Framework Version: 1.49.0
  • Node.js Version:
  • OS :
  • Language (Version): TypeScript (3.9.5)

Other


This is 🐛 Bug Report

@Nikamura Nikamura added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Jul 2, 2020
@github-actions github-actions bot added the @aws-cdk/aws-codebuild Related to AWS CodeBuild label Jul 2, 2020
@skinny85
Copy link
Contributor

skinny85 commented Jul 2, 2020

Hi @Nikamura ,

thanks for opening the issue. Looks like this changed since we introduced our validation. The docs now say:

FILE_PATH

A webhook triggers a build when the path of a changed file matches the regular expression pattern.

Note
Works with GitHub and Bitbucket events push and pull requests events. Also works with GitHub Enterprise push events, but does not work with GitHub Enterprise pull request events.

Looks like we're still validating GitHub (and most likely BitBucket) sources the same way we do GitHub Enterprise ones.

This needs a code change from our side. It should be a simple change here, so if you want to open is a Pull Request, that would be awesome - see here for more info on how to get started with developing the CDK.

In the meantime, you can use escape hatches in the CDK to unblock yourself.

Thanks,
Adam

@skinny85 skinny85 added effort/small Small work item – less than a day of effort good first issue Related to contributions. See CONTRIBUTING.md p1 and removed needs-triage This issue or PR still needs to be triaged. labels Jul 2, 2020
@mergify mergify bot closed this as completed in #9725 Aug 17, 2020
mergify bot pushed a commit that referenced this issue Aug 17, 2020
…ers in a FilterGroup (#9725)

Remove blocking validation on GitHub webhook file path filter when `event` is `PUSH` only.

Fixes #8867

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
misterjoshua pushed a commit to misterjoshua/aws-cdk that referenced this issue Aug 19, 2020
…ers in a FilterGroup (aws#9725)

Remove blocking validation on GitHub webhook file path filter when `event` is `PUSH` only.

Fixes aws#8867

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
@VishnuSM
Copy link

VishnuSM commented Jan 19, 2022

Hi @Nikamura ,

thanks for opening the issue. Looks like this changed since we introduced our validation. The docs now say:

FILE_PATH

A webhook triggers a build when the path of a changed file matches the regular expression pattern.
Note
Works with GitHub and Bitbucket events push and pull requests events. Also works with GitHub Enterprise push events, but does not work with GitHub Enterprise pull request events.

Looks like we're still validating GitHub (and most likely BitBucket) sources the same way we do GitHub Enterprise ones.

This needs a code change from our side. It should be a simple change here, so if you want to open is a Pull Request, that would be awesome - see here for more info on how to get started with developing the CDK.

In the meantime, you can use escape hatches in the CDK to unblock yourself.

Thanks, Adam

@skinny85 Can we use FILE_PATH filter with Github Enterprise one's still??? I am not using CDK but configuring my codebuild from the UI.

@skinny85
Copy link
Contributor

@skinny85 Can we use FILE_PATH filter with Github Enterprise one's still??? I am not using CDK but configuring my codebuild from the UI.

@VishnuSM I believe the answer is "no", according to the CodeBuild documentation.

@VishnuSM
Copy link

@skinny85 Following is a question regarding AWS CodeBuild.
I have configured a Webhooks which will trigger my build on pull requests events. During the build I need the list of changed files in the PR to do certain operations on them. Do we have anything which we can use in CodeBuild.

The closest I encountered is CODEBUILD_RESOLVED_SOURCE_VERSION environment variable. But this refers only to the recent commit SHA.

Additionally I was also thinking of consuming the GitHub Webhook payload URL to get the data regarding the changed files etc.

Any help around this is highly appreciated.

Thanks & Regards,
Vishnu.S

@skinny85
Copy link
Contributor

You will have to use the GitHub API to get this data inside of your CodeBuild job.

@VishnuSM
Copy link

@skinny85
I'm using a Lambda Function (written in Python) and connecting to an RDS instance. This Lambda Function is highly used(i.e invocations per minute is close to 7k -8k), but sometimes my lambda gets a connection timeout issue when trying to make an RDS connection.
Please note that this is an intermittent issue and the Lambda function and RDS are under the same VPC.
NOTE: I'm using pymysql to create a mysql connection

Any help around this is highly appreciated.

Thanks & Regards,
Vishnu.S

@skinny85
Copy link
Contributor

@VishnuSM I think this is outside the purview of CDK. Sine it "usually" works, I think the CDK setup is correct, and you need to dig into the details of the services that you are using (in this case, Lambda and RDS) to figure out why is this happening.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-codebuild Related to AWS CodeBuild bug This issue is a bug. effort/small Small work item – less than a day of effort good first issue Related to contributions. See CONTRIBUTING.md p1
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants