CodeBuild Bug? AWS CLI broken on AL2/aarch64 env, error "pyenv: version `3.9.7' is not installed"

0

Summary:

On CodeBuild projects running on AL2/aarch64, running the aws CLI command (any command works, I use --version as a sanity check) yields the following error:

[Container] 2022/09/10 02:39:37 Running command aws --version
pyenv: version `3.9.7' is not installed (set by /codebuild/output/src576940877/src/.python-version)

The process exits with status code 1 and the build terminates. I can reproduce the error exactly on my M1 MBP running locally, following the instructions for local agent usage here.

Steps to Reproduce

  1. Create minimal buildspec.yml:
version: 0.2

phases:
  build:
    commands:
      - aws --version
  1. Launch on CodeBuild project set to AL2/aarch64, on SMALL size build.

Expected behavior

Build should pass. Output of command should be:

[Container] 2022/09/10 03:00:41 Running command /usr/local/bin/aws --version
aws-cli/2.7.31 Python/3.9.11 Linux/5.10.104-linuxkit exe/aarch64.amzn.2 prompt/off

Actual behavior

Output is actually:

[Container] 2022/09/10 02:39:37 Running command aws --version
pyenv: version `3.9.7' is not installed (set by /codebuild/output/src576940877/src/.python-version)

Workaround

The AWS CLI can be installed manually and run via direct path:

version: 0.2

phases:
  install:
    runtime-versions:
      python: 3.9
    commands:
      - curl "https://awscli.amazonaws.com/awscli-exe-linux-aarch64.zip" -o "awscliv2.zip"
      - unzip awscliv2.zip
      - ./aws/install

  build:
    commands:
      - /usr/local/bin/aws --version

This produces the expected output and the build succeeds.

No Answers

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