2

I setup a test environment Codebuild + Github and am facing an issue: Every time I make a commit in Github, Codebuild will trigger 3 identical builds.

My buildspec.yml:

version: 0.2

phases:
  pre_build:
    commands:
      # Taskfile
      - curl -sL https://taskfile.dev/install.sh | sh

  build:
    commands:
        - ./bin/task build

  post_build:
    commands:
      - zip -r trigger.zip trigger

artifacts:
  files:
    - 'trigger.zip'
  discard-paths: yes

My code build config: Codebuild Config

And my build history: Build History

A few notable things:

  1. Manual builds only trigger one build
  2. The three builds are from the same hook and source version
  3. In github, the commit is only referencing the first of the 3 builds (latest commit points to build 13, previous commit points to build 9, etc).
  4. My project only has one branch (master)

Do you have any idea why this is happening, and how I can prevent this from happening again?

4

2 回答 2

2

感谢您使用 AWS CodeBuild。

你能检查一下 GitHub webhook 页面中 webhook 交付的响应吗?对于触发构建的每个 webhook 交付,CodeBuild 将返回带有消息“Webhook received and build started: [the link to the build]”的响应。您可以检查哪些 webhook 事件触发了构建,然后对事件应用过滤器。

于 2020-05-21T03:52:43.890 回答
0

问题出在 github 钩子上:一共有三个。

我正在使用 Pulumi (terraform) 来预置我的 AWS 资源,包括 CodeBuild,看起来破坏 Pulumi 中的堆栈并没有删除 github 挂钩。两个额外的钩子是以前被破坏的堆栈的剩余物。

我将对此进行进一步调查,但这超出了本问题的范围。

于 2020-05-22T16:36:05.903 回答