aws/aws-codebuild-docker-images

Broken AWS CLI in standard:4.0

plumdog opened this issue · 6 comments

Describe the bug

The AWS CLI in standard:4.0 is broken:

[Container] 2023/02/20 09:26:25 Running command aws --version
pyenv: version `3.7.13' is not installed (set by /codebuild/output/src113788041/src/.python-version)

To Reproduce
Run any aws command on a standard:4.0 image.

Expected behavior
AWS CLI should work without error.

Additional context
Seeing this in both eu-west-1 and eu-west-2.

Unable to find the images published anywhere, which makes debugging hard. Am building locally to try to debug.

Workaround: run echo 3.7.16 > .python-version before any AWS CLI commands.

Hi, I was not able to reproduce the error. Can you open a ticket with AWS Support and provide a build arn?

We can't reproduce this in the standard 4.0 images that CodeBuild provides that are based on Ubuntu or AL2 in the region that were called out. Marking this resolved. However, feel free to comment on this issue, if you continue to see an issue. Do mention the specific image, including any tag version that you may be using.

I have found that this is because my source project has a .python-version in the root of the repo. This happened to be 3.7.13, so matched with the version in Codebuild previously.

So I guess there's some set of files in the initial working directory for one of these images, and if your project has a file that collides with it, you're going to get some odd behaviour. (Again, not being able to just docker run ... this image makes finding this a real pain.)

How can I workaround this?

Again, not being able to just docker run ... this image makes finding this a real pain.

You can version lock an image to the specific image digest. By default, a CodeBuild project would use the latest tag of the image to get the most recent update. The obvious drawback of pinning an image version is that it will get dropped from the cache at some time in the future. You may also not get any other updates made to the images, unlike when using the latest tag.