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

(codebuild): Add support new newly introduced event filter #30062

Closed
1 of 2 tasks
aseppala opened this issue May 5, 2024 · 4 comments · Fixed by #30064 · 4 remaining pull requests
Closed
1 of 2 tasks

(codebuild): Add support new newly introduced event filter #30062

aseppala opened this issue May 5, 2024 · 4 comments · Fixed by #30064 · 4 remaining pull requests
Labels
@aws-cdk/aws-codebuild Related to AWS CodeBuild effort/small Small work item – less than a day of effort feature-request A feature should be added or improved. p2

Comments

@aseppala
Copy link

aseppala commented May 5, 2024

Describe the feature

A new feature has been recently introduced in AWS CodeBuild: https://aws.amazon.com/about-aws/whats-new/2024/04/aws-codebuild-managed-github-action-runners/. This feature enables to use AWS CodeBuild as GitHub Actions runner. However, using this feature requires to configure a new event filter which is currently not yet available in CDK.

Use Case

To be able to use 'aws-cdk-lib/aws-codebuild.Project' L2 Construct to define a runner for Github Action I need to be able to pass in FilterGroup.inEventOf(EventAction.WORKFLOW_JOB_QUEUED) but its not available so for now I'm force to use L1 Construct which requires setting up IAM roles etc which would be automatically created by the Project construct.

Proposed Solution

Introduce new value to aws-cdk-lib/aws-codebuild.EventAction enum: "WORKFLOW_JOB_QUEUED"

Other Information

No response

Acknowledgements

  • I may be able to implement this feature request
  • This feature might incur a breaking change

CDK version used

2.140.0

Environment details (OS name and version, etc.)

MacOS 14.3.1 (23D60)

@aseppala aseppala added feature-request A feature should be added or improved. needs-triage This issue or PR still needs to be triaged. labels May 5, 2024
@github-actions github-actions bot added the @aws-cdk/aws-codebuild Related to AWS CodeBuild label May 5, 2024
@aseppala aseppala changed the title (code build): Add support new newly introduced event filter (codebuild): Add support new newly introduced event filter May 5, 2024
@khushail
Copy link
Contributor

khushail commented May 6, 2024

Hi @aseppala , thanks for requesting this feature.

Thanks @msambol for submitting the PR.

@khushail khushail added p2 effort/small Small work item – less than a day of effort and removed needs-triage This issue or PR still needs to be triaged. labels May 6, 2024
@aseppala
Copy link
Author

Until this issue is resolved, a working workaround is to use CDK escape hatch:

import { CfnProject, Project, Source, FilterGroup, EventAction } from 'aws-cdk-lib/aws-codebuild';

const project = new Project(this, 'Project', {
  projectName: props.projectName,
  source: Source.gitHub({
    ...
    webhookFilters: [
      FilterGroup.inEventOf(EventAction.PULL_REQUEST_CREATED),
    ],
  }),
})

const cfnProject = project.node.defaultChild as CfnProject
const triggers = cfnProject.triggers as CfnProject.ProjectTriggersProperty
const filterGroups = triggers.filterGroups as CfnProject.WebhookFilterProperty[][]
// remove wrong (PULL_REQUEST_CREATED) filter
filterGroups[0].pop()
// add correct (WORKFLOW_JOB_QUEUED) filter
filterGroups[0].push({
  type: 'EVENT',
  pattern: 'WORKFLOW_JOB_QUEUED',
})

Copy link

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

@aws-cdk-automation
Copy link
Collaborator

Comments on closed issues and PRs are hard for our team to see. If you need help, please open a new issue that references this one.

@aws aws locked as resolved and limited conversation to collaborators Jul 25, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.