'AWS CodeBuild Batch configuration not passing environment variables

I am trying to use the CodeBuild Batch configuration feature to trigger 2 different build from the same repository. For the 2 build commands, only some parameters differ which I am trying to manage through environment variables, below is the buildSpec file.

version: 0.2
batch:
  fast-fail: true
  build-list:
    - identifier: build1
      buildspec: buildspec1.yml
      env:
        variables:
          BUILD_ID:  build1ID
          privileged-mode: true
          PROJECT: Projectvalue
      ignore-failure: false
    - identifier: evaluator-build
      buildspec: buildspecs2.yml
      env:
        variables:
          BUILD_ID: build2ID
          PROJECT: ProjectValueTwo
      ignore-failure: false

phases:
  build:
    commands:
    - echo Build started on `date`
    - sbt clean
    - sbt 'project $PROJECT' 'compile'

Here Project is one of the variables I am trying to pass between the 2 builds, but the actual value is not being passed. I tried echoing the value for it but comes out as blank.

What could be wrong here? Also, is the batch config feature use correct here?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source