amazon-web-services - AWS Cloudwatch 在动态标签上触发 Codepipeline

标签 amazon-web-services amazon-cloudwatch aws-codepipeline aws-codecommit

我想用动态标签标记提交,例如 git tag deploy-$(date +"%Y-%m-%d_%H-%M-%S") ,然后从 cloudwatch 触发 codepipeline。问题是如果我使用以下 cloudwatch 事件模式:

{
  "source": [
    "aws.codecommit"
  ],
  "detail-type": [
    "CodeCommit Repository State Change"
  ],
  "resources": [
    "arn:aws:codecommit:region:XXX:someName"
  ],
  "detail": {
    "event": [
      "referenceCreated",
      "referenceUpdated"
    ],
    "repositoryName": [
      "someName"
    ],
    "referenceType": [
      "tag"
    ],
    "referenceName": [
      "deploy"
    ]
  }
}
它只会在特定标签上触发 - “部署”。有没有办法说任何以(包含)deploy 关键字开头的标签?

最佳答案

我在看 Content-based Filtering with Event Patterns文档及其 Prefix Matching .文档中给出的示例是:

{
  "time": [ { "prefix": "2017-10-02" } ],
}
根据示例,以下内容似乎适用于您的情况:
{
  "source": [
    "aws.codecommit"
  ],
  "detail-type": [
    "CodeCommit Repository State Change"
  ],
  "resources": [
    "arn:aws:codecommit:region:XXX:someName"
  ],
  "detail": {
    "event": [
      "referenceCreated",
      "referenceUpdated"
    ],
    "repositoryName": [
      "someName"
    ],
    "referenceType": [
      "tag"
    ],
    "referenceName": [
       { "prefix": "deploy" } ]
    ]
  }
}

关于amazon-web-services - AWS Cloudwatch 在动态标签上触发 Codepipeline,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63285480/

相关文章:

java - 当用户注册时,Amazon cognito 是否会自动检查他们的电子邮件是否已存在?

linux - 从 Linux 同步到 AWS S3 Bucket 时保留所有者和文件权限信息

amazon-web-services - 为什么 Amazon Athena 会抛出 "Access denied when writing to location"错误?

amazon-web-services - 亚马逊。 Cloudwatch 触发警报状态更改规则

aws-lambda - 当我尝试使用方法 OPTIONS 进行 CORS 预检 (Lambda) 时,AWS cloudformation template.yaml 失败

amazon-web-services - 冲突异常 : Stage already exist from aws_api_gateway_deployment with stage_name

amazon-web-services - 工作人员在 AWS EC2 上失败时发出警报电子邮件

amazon-web-services - 当 AWS Lambda 函数出现错误时发送通知警报

amazon-web-services - AWS Codebuild - UPLOAD_ARTIFACTS 阶段 : BucketRegionError: incorrect region, 中出现错误,存储桶不在端点的 'us-east-2' 区域中

aws-cloudformation - CodePipeline - 遇到不支持的属性配置