【发布时间】:2022-02-01 17:58:12
【问题描述】:
我正在使用 AWS CDK 来部署 codepipeline 和 codebuild。我目前正在做的是在一个 cloudformation 堆栈中创建 codebuild,并在不同的 cf 堆栈中引用 codepipeline 中的 codebuild。
以下是我的代码,我创建了一个代码构建操作,例如:
const action = new actions.CodeBuildAction({
actionName: "MockEventBridge",
type: actions.CodeBuildActionType.BUILD,
input: input,
project: new codebuild.PipelineProject(this, name, {
projectName: mockName,
environment: {
computeType: codebuild.ComputeType.SMALL,
buildImage
privileged: true,
},
role,
buildSpec: codebuild.BuildSpec.fromSourceFilename(
"cicd/buildspec/mockEventbridge.yaml"
),
}),
runOrder: 1,
})
...
const stages = {
stageName, actions: [action]
}
一旦构建动作,我使用下面的代码来构建代码管道。
new codepipeline.Pipeline(this, name, {
pipelineName: this.projectName,
role,
stages,
artifactBucket
});
问题在于 codebuild 项目和 codepipeline 都内置在一个堆栈中。如果我在单独的 cf 堆栈中构建 codebuild 项目,如何在 codepipeline 中引用此堆栈?
查看 api 引用 https://docs.aws.amazon.com/cdk/api/v1/docs/@aws-cdk_aws-codepipeline.Pipeline.html 时,我找不到在 codepipeline 实例中引用 codebuild arn 的方法。
【问题讨论】:
标签: amazon-web-services aws-cdk aws-codepipeline aws-codebuild cicd