针对特定项目

时间:2018-03-20 21:32:24

标签: amazon-web-services amazon-cloudwatch

我正在尝试将CloudWatch事件用于构建状态更改的特定CodeBuild项目,但似乎没有。如果我删除资源,它工作正常,但它也会触发任何CodeBuild项目。我有类似的工作用于特定的CodeCommit存储库。我做错了还是CodeBuild没有实现?

{
  "detail-type": [
    "CodeBuild Build State Change"
  ],
  "source": [
    "aws.codebuild"
  ],
  "resources": [
    "arn:aws:codebuild:us-east-2:1234567890:build/project-name:*"
  ]
}

1 个答案:

答案 0 :(得分:2)

要为特定的CodeBuild项目创建CWE规则,请在CWE规则中使用“detail.project-name”过滤器

{
 "source": [ 
   "aws.codebuild"
 ], 
 "detail-type": [
   "CodeBuild Build State Change"
 ],
 "detail": {
   "project-name": [
      "project-name"
   ]
 }  

}

https://docs.aws.amazon.com/codebuild/latest/userguide/sample-build-notifications.html