是否可以在CodePipeline中订购Source操作? [英] Is it possible to order Source actions in CodePipeline?

查看:95
本文介绍了是否可以在CodePipeline中订购Source操作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的CodePipeline中有两个不同的来源,ECR和S3.我的部署管道将zip上传到S3,然后将图像上传到ECR.

I have two different sources in my CodePipeline, ECR and S3. My deployment pipeline uploads a zip to S3, and then an image to ECR.

我需要CodePipeline仅检测最后一次发生的ECR提交,然后触发S3源操作.但是,无论哪个首先被检测到,都会启动CodePipeline,这会导致竞争状态,在该状态下尚未上传新版本的图像.

I need CodePipeline to detect just the ECR commit, which happens last, and then trigger the S3 source action. However whichever one is detected first starts the CodePipeline, which leads to a race condition in which the image for the new version hasn't been uploaded yet.

我该如何解决?根据CodePipeline的限制,我无法将S3移出Source阶段.我曾尝试将S3下载移至Lambda函数,但似乎无法将zip作为输出工件传递回CodePipeline.

How can I resolve this? I cannot move S3 out of the Source stage, as per CodePipeline limitations. I've tried moving this S3 download to a Lambda function, but I can't seem to pass the zip back to CodePipeline as an output artifact.

推荐答案

作为要运行的CodePipeline的触发器,请仅为ECR定义CloudWatch事件触发器,而不为S3更改定义CloudWatch事件触发器.禁用管道内置触发器/拉动.

As trigger for the CodePipeline to run, define the CloudWatch event trigger only for ECR, not for S3 changes. Disable the Pipeline built-in trigger/pull.

https://docs.aws.amazon.com/codepipeline/latest/userguide/create-cwe-ecr-source-console.html 这样可以确保只有ECR触发管道执行.

https://docs.aws.amazon.com/codepipeline/latest/userguide/create-cwe-ecr-source-console.html This will make sure only ECR triggers a pipeline execution.

这篇关于是否可以在CodePipeline中订购Source操作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆