Amazon web services 有没有办法将手动审批操作添加到CdkPipeline?
嗨,我已经为我的基础设施部署创建了自变异CDK管道 我在这个管道中添加了不同的应用程序阶段,如 部署到DEV、部署到UAT、部署到PROD 管道正在按预期工作,并将更改部署到开发->UAT->产品环境中,但在部署到UAT和产品之前,我希望有手动批准操作,以便更改不会自动部署到UAT和产品中。该按钮后必须有手动批准操作按钮。单击“更改”应升级到更高级别环境 我可以在代码管道中找到该选项,但在CdkPipeline构造中找不到该选项 下面是示例代码-Amazon web services 有没有办法将手动审批操作添加到CdkPipeline?,amazon-web-services,aws-codepipeline,aws-cdk,Amazon Web Services,Aws Codepipeline,Aws Cdk,嗨,我已经为我的基础设施部署创建了自变异CDK管道 我在这个管道中添加了不同的应用程序阶段,如 部署到DEV、部署到UAT、部署到PROD 管道正在按预期工作,并将更改部署到开发->UAT->产品环境中,但在部署到UAT和产品之前,我希望有手动批准操作,以便更改不会自动部署到UAT和产品中。该按钮后必须有手动批准操作按钮。单击“更改”应升级到更高级别环境 我可以在代码管道中找到该选项,但在CdkPipeline构造中找不到该选项 下面是示例代码- const pipeline = new Cdk
const pipeline = new CdkPipeline(this, 'Pipeline', {
// The main pipeline name
pipelineName: 'Infra-Inception-Pipeline',
cloudAssemblyArtifact,
// Where the cdk source can be found
sourceAction: new codepipeline_actions.CodeCommitSourceAction({
actionName: "CloneCodeCommitRepo",
repository: cdkSourceCodeRepo,
output: cdkSourceOutput,
// branch: "develop"
}),
// How will cdk be built and synthesized
synthAction: SimpleSynthAction.standardNpmSynth({
sourceArtifact: cdkSourceOutput,
cloudAssemblyArtifact,
// We need a build step to compile the TypeScript
buildCommand: 'npm run build'
}),
});
pipeline.addApplicationStage(new CreateInfrastructureStage(this, 'DEV',
{
env: { "account":"1111" "region":"us-east-1" }
}));
//I would like to add Manual Approval gate here
pipeline.addApplicationStage(new CreateInfrastructureStage(this, 'UAT',
{
env: { "account":"2222" "region":"us-east-1" }
}));
我在AWS文档中找到了答案 addApplicationStage()添加的每个应用程序阶段都会导致添加单个管道阶段,该阶段由addApplicationStage()调用返回。此阶段由CdkStage构造表示。可以通过调用其addActions()方法向阶段添加更多操作。例如:
// import { ManualApprovalAction } from '@aws-cdk/aws-codepipeline-actions';
const testingStage = pipeline.addApplicationStage(new MyApplication(this, 'Testing', {
env: { account: '111111111111', region: 'eu-west-1' }
}));
// Add an action -- in this case, a Manual Approval action
// (testingStage.addManualApprovalAction() is an equivalent convenience method)
testingStage.addActions(new ManualApprovalAction({
actionName: 'ManualApproval',
runOrder: testingStage.nextSequentialRunOrder(),
}));
为了增强您的回答:手动批准只处于两个阶段之间。这意味着最终将部署到“账户”:“1111”区域:“us-east-1”。但是,您可以使用
addApplicationStage
中的manualApproval参数来控制应该手动部署阶段的哪些堆栈。这很有趣,感谢@mchlfchr的建议