How to Trigger AWS code Pipeline on any branch with specific Tag

0

I have my AWS Codebuild config in a way when pushing changes to any branch with tag ^refs/tags/pak/* it will trigger the build, Enter image description here

Now I want to create a code pipeline in the same way but in the code pipeline, a branch name is required, I want to trigger pipeline with tags

質問済み 8ヶ月前1197ビュー
3回答
0

If you are using CodeCommit as Repo you can use an EventBridge trigger to invoke your pipeline:

  1. Create Eventbridge rule - here is an example rule:
{
  "source": ["aws.codecommit"],
  "detail-type": ["CodeCommit Repository State Change"],
  "resources": ["arn:aws:codecommit:{{region}}:{{account_id}}:Test-Repo"],
  "detail": {
    "event": ["referenceCreated", "referenceUpdated"],
    "repositoryName": ["Test-Repo"],
    "referenceType": ["tag"],
    "referenceName": [{
      "prefix": "dev"
    }]
  }
}
  1. Configuring the CodePipeline target by providing the ARN of the created pipeline.

Here are the docs for Eventbrdige: https://docs.aws.amazon.com/eventbridge/

profile picture
David
回答済み 8ヶ月前
0

If you are using GitHub you may use a github action for the specific tag and inside the action you can use the AWS CodePipeline Trigger

profile picture
David
回答済み 8ヶ月前
  • By doing so we can trigger the pipeline but what about the branch name it is asking at the beginning of the creation of the pipeline would not it pull changes from that branch?

0

You can just use any branch name and remove that afterwards eg.:

Find out the name of the webhook: aws codepipeline list-webhooks De-register: aws codepipeline deregister-webhook-with-third-party --webhook-name <webhook-name> Delete: aws codepipeline delete-webhook --name <webhook-name>

profile picture
David
回答済み 8ヶ月前

ログインしていません。 ログイン 回答を投稿する。

優れた回答とは、質問に明確に答え、建設的なフィードバックを提供し、質問者の専門分野におけるスキルの向上を促すものです。

質問に答えるためのガイドライン

関連するコンテンツ