question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

(codepipeline-actions): custom event for codepipeline codecommit actions

See original GitHub issue

This feature request is to allow customization of the CloudWatch Event created by a CodeCommit source action in the aws-codepipeline-actions module.

Use Case

Per the blog post below, one may want to add custom logic to the CloudWatch Event that triggers a pipeline, so that they can selectively determine when to trigger a pipeline rather than triggering it on every commit to the branch being watched. This customization may be done by having the CloudWatch Event invoke a Lambda rather than directly triggering the pipeline. The Lambda can apply logic to determine whether this (or a different) pipeline is triggered.

Today, the aws-codepipeline-actions CodeCommit source action does not allow you to specify / modify the rules of the CloudWatch Event created by the construct.

Inspiration for this request is from the blog below:

https://aws.amazon.com/blogs/devops/adding-custom-logic-to-aws-codepipeline-with-aws-lambda-and-amazon-cloudwatch-events/

I want to use trunk-based development (single master branch) but have the ability to selectively trigger a pipeline based on facts about the commit.

For example:

  1. If a README was the the only file changed, do not trigger the normal pipeline.

  2. If (e.g. in the event of an emergency), I need to push a hotfix straight to prod while skipping my test and staging environment, I want to invoke a different pipeline that is source -> build -> prod, instead of my normal pipeline of source-> test -> staging -> prod.

Proposed Solution

Proposed idea #1 is to able to specify your own, previously-created CloudWatch Event, e.g.:

new codepipeline_actions.CodeCommitSourceAction({
          actionName: 'CodeCommit_Source',
          role: props.role,
          eventRole: props.eventRole,
          repository: props.repository,
          branch: props.branch,
          output: props.output,
          event: <YOUR CUSTOM EVENT>        // FEATURE REQUEST
        }),

Idea 2 is to be able to customize the target parameters of the event created by the source action:

new codepipeline_actions.CodeCommitSourceAction({
          actionName: 'CodeCommit_Source',
          role: props.role,
          eventRole: props.eventRole,
          repository: props.repository,
          branch: props.branch,
          output: props.output,
          eventTarget:    <custom Lambda resource>.        // FEATURE REQUEST
}),

Other

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

This is a 🚀 Feature Request

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:10
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
Rofor51commented, Jul 27, 2021

This is still relevant. Would be great to have if you want to create a scheduled build after a commit.

1reaction
kaiziocommented, Dec 18, 2020

I just ran into this issue when trying to use a single source for hosting both CDK source and application source, while using CDK Pipelines for the continuous CDK deployment and AWS CodePipeline for Application deployment.

Everytime I update the CDK code it will fire both a build for CDK and app and vice versa. Unless this is a anti-pattern. I would imagine more people to have a issues as they adopt CDK Pipelines.

Read more comments on GitHub >

github_iconTop Results From Across the Web

aws-cdk/aws-codepipeline-actions module
›@aws-cdk/aws-codepipeline-actions ... To use a CodeCommit Repository in a CodePipeline: ... 'Event-role', 'roleArn'); declare const repo: codecommit.
Read more >
awslabs/aws-cdk - Gitter
Hey all, I'm having some troubles getting a CodePipeline stack created and ... import * as codePipelineActions from '@aws-cdk/aws-codepipeline-actions'; ...
Read more >
AWS CodePipeline - Noise
These two Lambda functions are invoked by CodeCommit CloudWatch events when a ... Then, it's fed into AWS CodeBuild actions for Terraform as...
Read more >
Build Environment - Amazon ECS Workshop
Build the container image for code in CodeCommit using CodeBuild; Deploy the CodeDeploy and CodePipeline resources for blue/green deployment ...
Read more >
Static site deployment with CDK and AWS - Binary Thinktank
The CI/CD pipeline consists of CodeCommit as a repo, CodePipeline as an ... const codepipelineactions = require("@aws-cdk/aws-codepipeline-actions");.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found