aws / aws-codebuild-docker-images

Official AWS CodeBuild repository for managed Docker images http://docs.aws.amazon.com/codebuild/latest/userguide/build-env-ref.html
Other
1.11k stars 973 forks source link

cannot get codebuild_build.sh to work with aws/codebuild/amazonlinux2-x86_64-standard:corretto11 #672

Open gigi888 opened 1 year ago

gigi888 commented 1 year ago

Describe the bug in my Mac with OS 13.5, I

clone the repos at https://github.com/aws/aws-codebuild-docker-images.git setup local agent by doing docker pull amazon/aws-codebuild-local:latest --disable-content-trust=false get the local build shell script by $ wget https://raw.githubusercontent.com/aws/aws-codebuild-docker-images/master/local_builds/codebuild_build.sh $ chmod +x codebuild_build.sh

Then I just try to run codebuild_build.sh with the buildspec.yml provided by https://github.com/aws/aws-codebuild-docker-images.git. never works.

cd /private/tmp/aws-codebuild-docker-images /private/tmp/aws-codebuild-docker-images>./local_builds/codebuild_build.sh -d -i aws/codebuild/amazonlinux2-x86_64-standard:corretto11 -a /tmp/artifactout -l public.ecr.aws/codebuild/local-builds:latest -s ./

to show what is in this directory /private/tmp/aws-codebuild-docker-images>ls -l total 104 -rw-r--r-- 1 user1 wheel 311 Aug 29 17:35 CODE_OF_CONDUCT.md -rw-r--r-- 1 user1 wheel 3619 Aug 29 17:35 CONTRIBUTING.md -rw-r--r-- 1 user1 wheel 4845 Aug 29 17:35 LICENSE.txt -rw-r--r-- 1 user1 wheel 406 Aug 29 17:35 Makefile -rw-r--r-- 1 user1 wheel 105 Aug 29 17:35 NOTICE.txt -rw-r--r-- 1 user1 wheel 2756 Aug 29 17:35 README.md drwxr-xr-x 4 user1 wheel 128 Aug 29 17:35 al2 -rw-r--r-- 1 user1 wheel 2034 Aug 30 16:17 app-test-buildspec.yaml -rw-r--r-- 1 user1 wheel 2034 Aug 30 09:36 app-test-buildspec.yml -rw-r--r-- 1 user1 wheel 275 Aug 29 17:35 buildspec.yml -rwxr-xr-x 1 user1 wheel 6532 Aug 30 16:03 codebuild_build.sh drwxr-xr-x 7 user1 wheel 224 Aug 29 20:19 local_builds drwxr-xr-x 4 user1 wheel 128 Aug 30 16:53 src drwxr-xr-x 3 user1 wheel 96 Aug 29 17:35 ubuntu drwxr-xr-x 16 user1 wheel 512 Aug 29 17:35 unsupported_images

Expected behavior that it works

Logs docker run -it -v /var/run/docker.sock:/var/run/docker.sock -e "IMAGE_NAME=aws/codebuild/amazonlinux2-x86_64-standard:corretto11" -e "ARTIFACTS=/tmp/artifactout" -e "SOURCE=/private/tmp/aws-codebuild-docker-images/" -e "LOCAL_AGENT_IMAGE_NAME=public.ecr.aws/codebuild/local-builds:latest" -e "DOCKER_PRIVILEGED_MODE=TRUE" -e "INITIATOR=gcheng" public.ecr.aws/codebuild/local-builds:latest

Removing agent-resources_build_1 ... done Removing agent-resources_agent_1 ... done Removing network agent-resources_default Removing volume agent-resources_source_volume Removing volume agent-resources_user_volume Creating network "agent-resources_default" with the default driver Creating volume "agent-resources_source_volume" with local driver Creating volume "agent-resources_user_volume" with local driver Creating agent-resources_agent_1 ... done Creating agent-resources_build_1 ... done Attaching to agent-resources_agent_1, agent-resources_build_1 agent_1 | [Container] 2023/08/30 21:05:19 Waiting for agent ping agent_1 | [Container] 2023/08/30 21:05:19 Waiting for DOWNLOAD_SOURCE agent_1 | [Container] 2023/08/30 21:05:19 Phase is DOWNLOAD_SOURCE agent_1 | [Container] 2023/08/30 21:05:19 CODEBUILD_SRC_DIR=/codebuild/output/src097697794/src agent_1 | [Container] 2023/08/30 21:05:19 yamlDoc agent_1 | [Container] 2023/08/30 21:05:19 Phase complete: DOWNLOAD_SOURCE State: FAILED agent_1 | [Container] 2023/08/30 21:05:19 Phase context status code: YAML_FILE_ERROR Message: YAML file does not exist agent_1 | [Container] 2023/08/30 21:05:20 Runtime error (*clienterr.PhaseContextError: YAML file does not exist) agent-resources_build_1 exited with code 11 Aborting on container exit...

Platform (please complete the following information):

Additional context I've been following this blog, https://aws.amazon.com/blogs/devops/announcing-local-build-support-for-aws-codebuild/ but it is so hard to get it to work.