Further review shows that with Cloudformation, you can pick the branch that CodePipeline tracks,
AWS CodeCommit (CodeCommit
)
- PollForSourceChanges¹ (Optional)
- RepositoryName (Required)
- BranchName (Required)
You can see an example of complete template but the CodePipeline stage looks like,
Name: CheckoutSourceTemplate
ActionTypeId:
Category: Source
Owner: AWS
Version: 1
Provider: CodeCommit
Configuration:
PollForSourceChanges: True
RepositoryName: !GetAtt [PipelineRepo, Name]
BranchName: master
OutputArtifacts:
- Name: TemplateSource
RunOrder: 1
With CodeCommit Repo's, you can create Triggers that can use these triggers to launch a Lambda function,
You can configure Lambda functions by creating the trigger in the Lambda console as part of the function. This is the simplest method, as triggers created in the Lambda console automatically include the permissions required for AWS CodeCommit to invoke the Lambda function. If you create the trigger in AWS CodeCommit, you must include a policy to allow AWS CodeCommit to invoke the function. For more information, see Create a Trigger for an Existing Lambda Function and Example 2: Create a Policy for AWS Lambda Integration.
So what could happen is to set up a CloudFormation template like above to track the master branch. Then have CodeCommit trigger on repository changes and call a Lambda function that uses Boto3 to get_pipeline
to retrieve the master branch pipeline.
Then using either update_pipeline
or create_pipeline
to add a stage to the existing master branch pipeline or create an entirely new pipeline that tracks the additional branches desired.
This way, the CodePipeline can track the feature branches in a useful way.