我可以使CodePipeline仅在手动触发时执行

时间:2018-11-04 03:01:19

标签: amazon-web-services aws-codepipeline

我有一个CodePipeline设置。但是现在我只想在手动触发管道时运行管道,这可能吗?

3 个答案:

答案 0 :(得分:1)

您可以使用CloudWatch Events,永远不会触发您的管道:

https://docs.aws.amazon.com/codepipeline/latest/userguide/pipelines-trigger-source-schedule-console.html

设置一个will never execute的cronjob,然后您可以随时单击“发布更改”按钮来手动触发管道。 我尚未测试,但我认为它应该可以工作。

答案 1 :(得分:0)

这对我有用:

使用 Github Webhook 设置常规管道。 这将创建并注册一个内部AWS Webhook。 然后只需通过aws-cli注销并删除webhooks like it is written in the aws docs

将以下内容调整到您所在的地区,我的是us-east-2:

找出网络挂钩的名称:

aws codepipeline list-webhooks --endpoint-url "https://codepipeline.us-east-2.amazonaws.com" --region "us-east-2"

注销:

aws codepipeline deregister-webhook-with-third-party --webhook-name <webhook-name>

删除:

aws codepipeline delete-webhook --name <webhook-name>

注意: 必须将源步骤配置为使用 Github Webhook

现在,您可以通过以下方式通过AWS控制台或aws-cli手动触发管道:

aws codepipeline start-pipeline-execution --name <pipeline-name>

答案 2 :(得分:-1)

您需要将CodePipeline配置为由CloudWatch事件触发。完成此操作后,将在CloudWatch下创建一个名为“ codepipeline- {repository_name}”的事件规则。

禁用此规则将阻止CodeCommit触发CodePipeline。需要构建时,只需单击“发布更改”按钮。