除了 Source 和 Build 之间的工件名称外,一切正常。 当 Build 开始时,它会查找一个错误的文件名(Source 生成的文件存在于同一个 S3 存储桶中)。
我重新部署了堆栈,多次运行管道,删除/添加了工件的名称。
// Create the CodePipeline
const codePipeline = new codepipeline.Pipeline(this, 'CodePipeline', {
pipelineName: `${containerName}-${environmentName}`,
role: codePipelineRole,
artifactBucket,
stages: [],
});
// Create the artifact
const sourceOutput = new codepipeline.Artifact(`${containerName}-${environmentName}-SourceOutput`);
// Add the source stage
codePipeline.addStage({
stageName: 'Source',
actions: [
new codepipelineActions.CodeCommitSourceAction({
actionName: 'CodeCommitSourceAction',
repository: codeCommitRepository,
branch: codeCommitBranchName,
output: sourceOutput,
}),
],
});
// Create the artifact
const buildOutput = new codepipeline.Artifact(`${containerName}-${environmentName}-BuildOutput`);
// Add the build stage
codePipeline.addStage({
stageName: 'Build',
actions: [
new codepipelineActions.CodeBuildAction({
actionName: 'CodeBuildAction',
project: codeBuildProject,
input: sourceOutput,
outputs: [buildOutput],
}),
],
});
// Add the deploy stage on the ECS cluster and service
codePipeline.addStage({
stageName: 'Deploy',
actions: [
new codepipelineActions.EcsDeployAction({
actionName: 'EcsDeployAction',
input: buildOutput,
service: ecs.FargateService.fromFargateServiceAttributes(this, 'FargateService', {
cluster,
serviceName: service.serviceName,
})
}),
],
});