Buildspec file with build-graph doesn't do anything

1

My buildspec file looks like this and doesn't seem to do anything. I'm guessing that it's not finding the other build files but I'm not sure why. I don't see anything in CloudTrail either but maybe I'm just missing it.

version: 0.2

env:
  shell: bash

batch:
  fast-fail: false
  build-graph:
    - identifer: api
      buildspec: infrastructure/pipeline/api-build.yaml
      ignore-failure: false
      debug-session: true
    - identifer: all
      buildspec: infrastructure/pipeline/project-build.yaml
      ignore-failure: false
      debug-session: true
      depend-on:
        - api

Build output:

[Container] 2023/07/14 03:06:25 Waiting for agent ping
[Container] 2023/07/14 03:06:26 Waiting for DOWNLOAD_SOURCE
[Container] 2023/07/14 03:06:27 Phase is DOWNLOAD_SOURCE
[Container] 2023/07/14 03:06:27 CODEBUILD_SRC_DIR=/codebuild/output/src1902116615/src
[Container] 2023/07/14 03:06:27 YAML location is /codebuild/output/src1902116615/src/infrastructure/pipeline/buildspec-build.yaml
[Container] 2023/07/14 03:06:27 Selecting shell bash as specified in buildspec.
[Container] 2023/07/14 03:06:27 Setting HTTP client timeout to higher timeout for S3 source
[Container] 2023/07/14 03:06:27 Processing environment variables
[Container] 2023/07/14 03:06:28 No runtime version selected in buildspec.
[Container] 2023/07/14 03:06:28 Moving to directory /codebuild/output/src1902116615/src
[Container] 2023/07/14 03:06:28 Configuring ssm agent with target id: codebuild:a41b73b1-1e9a-4e97-b0e8-215b323873c1
[Container] 2023/07/14 03:06:28 Successfully updated ssm agent configuration
[Container] 2023/07/14 03:06:28 Registering with agent
[Container] 2023/07/14 03:06:28 Phases found in YAML: 0
[Container] 2023/07/14 03:06:28 Phase complete: DOWNLOAD_SOURCE State: SUCCEEDED
[Container] 2023/07/14 03:06:28 Phase context status code:  Message: 
[Container] 2023/07/14 03:06:28 Entering phase INSTALL
[Container] 2023/07/14 03:06:28 Phase complete: INSTALL State: SUCCEEDED
[Container] 2023/07/14 03:06:28 Phase context status code:  Message: 
[Container] 2023/07/14 03:06:28 Entering phase PRE_BUILD
[Container] 2023/07/14 03:06:28 Phase complete: PRE_BUILD State: SUCCEEDED
[Container] 2023/07/14 03:06:28 Phase context status code:  Message: 
[Container] 2023/07/14 03:06:28 Entering phase BUILD
[Container] 2023/07/14 03:06:28 Phase complete: BUILD State: SUCCEEDED
[Container] 2023/07/14 03:06:28 Phase context status code:  Message: 
[Container] 2023/07/14 03:06:28 Entering phase POST_BUILD
[Container] 2023/07/14 03:06:28 Phase complete: POST_BUILD State: SUCCEEDED
[Container] 2023/07/14 03:06:28 Phase context status code:  Message: 

Update: I tried using an inline build spec and I'm still not seeing any difference.

version: 0.2

env:
  shell: bash

batch:
  fast-fail: false
  build-graph:
    - identifer: build
      buildspec: |
        version: 0.2

        env:
          shell: bash
          
        phases:
          build:
            commands:
              - echo "nested build"
asked 10 months ago479 views
2 Answers
0
Accepted Answer

It looks like my issue was in my pipeline, not the actual build spec. When building the Build stage I didn't add the BatchEnabled property to the Configuration section. I got it working but updating my step to the following.

Stages:
        - Name: Build
          Actions:
          - Name: Build
            ActionTypeId:
              Category: Build
              Owner: AWS
              Version: 1
              Provider: CodeBuild
            Configuration:
              ProjectName: !Ref BuildRunner
              BatchEnabled: true

I also had to update the service role with the appropriate batch build permissions and I had a typo in my build spec file (identifer -> indentifier)

answered 10 months ago
profile picture
EXPERT
reviewed 10 months ago
0

Can't you see the log output from the batch build screen instead of the build log?
Probably logs are output to CloudWatch Logs for each phase (api,all).
If you open the batch history from the CodeBuild build project, you can check the status and other information.
Specifically, the screen in the following image.
I don't use batch builds in my environment, so I don't see anything, but if it is running, it should show something.
codebuild

profile picture
EXPERT
answered 10 months ago
  • The batch build history is blank. I even tried using an inline buildspec file (I updated my question with that file) and I'm not getting anything. The attached service role has all the codebuild policies now too and still nothing.

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions