AWS CodeBuild webhook 在不应启动时触发

AWS CodeBuild webhook trigers when it shoudn't start

我有以下 codebuild 的 webhook 设置:

resource "aws_codebuild_webhook" "apply" {
  project_name = aws_codebuild_project.codebuild-apply.name
  build_type   = "BUILD"
  filter_group {
    filter {
      type    = "EVENT"
      pattern = "PUSH"
    }
    filter {
      type    = "FILE_PATH"
      pattern = "environments/test/*"
    }
    filter {
      type    = "HEAD_REF"
      pattern = "master"
    }
  }
}

目的是 运行 只有当 master 分支上的更改完成时。 当前,当 environments/test/ 每个分支上的更改不仅在主分支上完成时,此 webhook 会启动构建规范。

有什么问题以及如何正确设置?

根据 https://docs.aws.amazon.com/codebuild/latest/userguide/github-webhook.htmlHEAD_REF 类型过滤器模式的正确格式是 ^refs/heads/master$

我现在才知道,你用的是terraform。你可以试试

filter {
      type                    = "HEAD_REF"
      pattern                 = "refs/heads/master"
      
    }