When I create a codeBuild project, and integrate it into CodePipeline using Cloudformation, the build automatically triggers when I deploy the cloudFormation stack using serverless framework. I want to trigger the build manually, not automatically.
Is there anyway to stop this default behaviour?
CodePudding user response:
You need to set the Triggers
property in your CodeBuild CFN template and set Webhook
to false:
{
"BuildType" : String,
"FilterGroups" : [ FilterGroup, ... ],
"Webhook" : False
}
CodePudding user response:
Yes, you can stop the default behavior of triggering the CodeBuild project automatically when you deploy the CloudFormation stack by modifying the CodePipeline pipeline definition in your CloudFormation template. Specifically, you can set the "Trigger" property of the "Build" stage to "None" to disable automatic triggering of the CodeBuild project.
Here is an example of how you can modify your CloudFormation template to disable automatic triggering of the CodeBuild project:
Resources:
MyPipeline:
Type: AWS::CodePipeline::Pipeline
Properties:
# Other pipeline properties
Stages:
- Name: Build
Actions:
- Name: BuildAction
# Other action properties
Configuration:
ProjectName: MyCodeBuildProject
# Set the "Trigger" property to "None" to disable automatic triggering
Trigger: None
With this change, the CodeBuild project will not be triggered automatically when you deploy the CloudFormation stack. Instead, you can manually trigger the CodeBuild project by using the CodePipeline API or the AWS CodePipeline console.