有没有办法向 CdkPipeline 添加手动批准操作?
Is there any way to add Manual approval action to CdkPipeline?
您好,我已经为我的基础设施部署创建了自变异 CDK 管道。
我已将不同的应用程序阶段添加到此管道中,例如
部署到 DEV,部署到 UAT,部署到 PROD
管道按预期工作并将更改部署到 DEV -> UAT -> PROD 环境,但在部署到 UAT 和 PROD 之前,我想进行手动批准操作,以便更改不会自动部署到 UAT 和 PROD,必须进行手动批准操作单击该按钮后的按钮更改应提升到更高的环境。
我可以在代码管道中找到该选项,但我在 CdkPipeline 构造中找不到该选项。
这里是示例代码 -
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(),
}));
您好,我已经为我的基础设施部署创建了自变异 CDK 管道。
我已将不同的应用程序阶段添加到此管道中,例如 部署到 DEV,部署到 UAT,部署到 PROD 管道按预期工作并将更改部署到 DEV -> UAT -> PROD 环境,但在部署到 UAT 和 PROD 之前,我想进行手动批准操作,以便更改不会自动部署到 UAT 和 PROD,必须进行手动批准操作单击该按钮后的按钮更改应提升到更高的环境。
我可以在代码管道中找到该选项,但我在 CdkPipeline 构造中找不到该选项。
这里是示例代码 -
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(),
}));