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

Looking for guidance for Local CodeBuild and using CodeBuild Environement Variables. #670

Open hsiddhu2 opened 1 year ago

hsiddhu2 commented 1 year ago

I want to run the below command in my buildspec.yml to identify the list of files that have changed between a specific commit and its parent commit.

CHANGED_OBJECTS=$(git diff-tree --no-commit-id --name-only -r $CODEBUILD_WEBHOOK_HEAD_REF)

But when I'm trying to build the project using Local CodeBuild using the command below -

./codebuild_build.sh -i aws-codebuild-docker-images/ubuntu/standard/5.0:latest -a artifacts -s /project-root-director -e .env -c

I'm getting this error -

' [Container] 2023/08/23 21:54:17 Command did not exit successfully CHANGED_OBJECTS=$(git diff-tree --no-commit-id --name-only -r $CODEBUILD_WEBHOOK_HEAD_REF) exit status 129 agent_1 | [Container] 2023/08/23 21:54:17 Phase complete: BUILD State: FAILED agent_1 | [Container] 2023/08/23 21:54:17 Phase context status code: COMMAND_EXECUTION_ERROR Message: Error while executing command: CHANGED_OBJECTS=$(git diff-tree --no-commit-id --name-only -r $CODEBUILD_WEBHOOK_HEAD_REF). Reason: exit status 129`

Can someone please guide me and explain how to do this in a local code build environment? Thank you!