使用分支过滤器以确保CodePipeline仅在特定分支上运行。
在CodePipeline中,您可以使用分支过滤器来限制您的流水线只在特定的分支上运行。您可以在流水线阶段中定义过滤器。下面是一个示例:
{
"stages": [
{
"name": "Source",
"actions": [
{
"name": "Source",
"actionTypeId": {
"category": "Source",
"owner": "ThirdParty",
"provider": "GitHub",
"version": "1"
},
"outputArtifacts": [
{
"name": "MyApp"
}
],
"runOrder": 1,
"configuration": {
"Owner": "my-org",
"Repo": "my-repo",
"Branch": "my-branch",
"OAuthToken": "",
"PollForSourceChanges": "true"
}
}
]
},
{
"name": "Build",
"actions": [
{
"name": "Build",
"actionTypeId": {
"category": "Build",
"owner": "AWS",
"provider": "CodeBuild",
"version": "1"
},
"inputArtifacts": [
{
"name": "MyApp"
}
],
"outputArtifacts": [
{
"name": "MyAppBuild"
}
],
"runOrder": 1,
"configuration": {
"ProjectName": "my-codebuild-project"
}
}
]
}
],
"artifactStore": {
"type": "S3",
"location": ""
},
"name": "MyDeliveryPipeline",
"roleArn": "",
"version": 1,
"pipeline": "my-pipeline",
"disableInboundStageTransitions": false,
"restartExecutionOnUpdate": false,
"executionArn": "arn:aws:codepipeline:::"
}
在以上示例中,“Source”阶段的Git存储库允许使用分支过滤器。 configuration部分设置了分支名称“my-branch”。这将确保只有在匹配的分支上更改时才会触发流水线。
上一篇:AWSCodePipeline:源操作中ARN不存在任何连接。
下一篇:AWSCodestarBitbucket连接可选作Codepipeline的源代码提供者,但无法在独立的Codebuild作业中选择。