my building process always fails when I try to install jq. Could you please tell me what I am doing wrong?
env:
parameter-store:
JWT_SECRET: JWT_SECRET
phases:
install:
runtime-versions:
python: 3.8
commands:
- curl -sS -o aws-iam-authenticator https://amazon-eks.s3-us-west-2.amazonaws.com/1.14.6/2019-08-22/bin/linux/amd64/aws-iam-authenticator
- curl -sS -o kubectl https://amazon-eks.s3-us-west-2.amazonaws.com/1.14.6/2019-08-22/bin/linux/amd64/kubectl
- chmod +x ./kubectl ./aws-iam-authenticator
- export PATH=$PWD/:$PATH
- apt-get update && apt-get -y install jq
- apt-get -y install python3-pip python3-dev
- pip3 install --upgrade awscli
- pip3 install -r requirements.txt
# - pip3 install -r requirements.txt
- python3 -m pytest test_main.py
pre_build:
commands:
- TAG="$REPOSITORY_NAME.$REPOSITORY_BRANCH.$ENVIRONMENT_NAME.$(date +%Y-%m-%d.%H.%M.%S).$(echo $CODEBUILD_RESOLVED_SOURCE_VERSION | head -c 8)"
- sed -i 's@CONTAINER_IMAGE@'"$REPOSITORY_URI:$TAG"'@' simple_jwt_api.yml
- $(aws ecr get-login --no-include-email)
- export KUBECONFIG=$HOME/.kube/config
build:
commands:
- docker build --tag $REPOSITORY_URI:$TAG .
post_build:
commands:
- docker push $REPOSITORY_URI:$TAG
- CREDENTIALS=$(aws sts assume-role --role-arn $EKS_KUBECTL_ROLE_ARN --role-session-name codebuild-kubectl --duration-seconds 900)
- export AWS_ACCESS_KEY_ID="$(echo ${CREDENTIALS} | jq -r '.Credentials.AccessKeyId')"
- export AWS_SECRET_ACCESS_KEY="$(echo ${CREDENTIALS} | jq -r '.Credentials.SecretAccessKey')"
- export AWS_SESSION_TOKEN="$(echo ${CREDENTIALS} | jq -r '.Credentials.SessionToken')"
- export AWS_EXPIRATION=$(echo ${CREDENTIALS} | jq -r '.Credentials.Expiration')
- aws eks update-kubeconfig --name $EKS_CLUSTER_NAME
- kubectl apply -f simple_jwt_api.yml
- printf '[{"name":"simple_jwt_api","imageUri":"%s"}]' $REPOSITORY_URI:$TAG > build.json
- pwd
- ls
artifacts:
files: build.json
Error msg:
[Container] 2020/03/22 15:57:14 Waiting for agent ping
[Container] 2020/03/22 15:57:16 Waiting for DOWNLOAD_SOURCE
[Container] 2020/03/22 15:57:17 Phase is DOWNLOAD_SOURCE
[Container] 2020/03/22 15:57:17 CODEBUILD_SRC_DIR=/codebuild/output/src534423531/src
[Container] 2020/03/22 15:57:17 YAML location is /codebuild/output/src534423531/src/buildspec.yml
[Container] 2020/03/22 15:57:17 Processing environment variables
[Container] 2020/03/22 15:57:17 Decrypting parameter store environment variables
[Container] 2020/03/22 15:57:17 Selecting 'python' runtime version '3.8' based on manual selections...
[Container] 2020/03/22 15:57:17 Running command echo "Installing Python version 3.8 ..."
Installing Python version 3.8 ...
[Container] 2020/03/22 15:57:17 Running command pyenv global $PYTHON_38_VERSION
[Container] 2020/03/22 15:57:17 Moving to directory /codebuild/output/src534423531/src
[Container] 2020/03/22 15:57:17 Registering with agent
[Container] 2020/03/22 15:57:17 Phases found in YAML: 4
[Container] 2020/03/22 15:57:17 POST_BUILD: 11 commands
[Container] 2020/03/22 15:57:17 INSTALL: 9 commands
[Container] 2020/03/22 15:57:17 PRE_BUILD: 4 commands
[Container] 2020/03/22 15:57:17 BUILD: 1 commands
[Container] 2020/03/22 15:57:17 Phase complete: DOWNLOAD_SOURCE State: SUCCEEDED
[Container] 2020/03/22 15:57:17 Phase context status code: Message:
[Container] 2020/03/22 15:57:17 Entering phase INSTALL
[Container] 2020/03/22 15:57:17 Running command curl -sS -o aws-iam-authenticator https://amazon-eks.s3-us-west-2.amazonaws.com/1.14.6/2019-08-22/bin/linux/amd64/aws-iam-authenticator
[Container] 2020/03/22 15:57:19 Running command curl -sS -o kubectl https://amazon-eks.s3-us-west-2.amazonaws.com/1.14.6/2019-08-22/bin/linux/amd64/kubectl [Container] 2020/03/22 15:57:19 Running command chmod +x ./kubectl ./aws-iam-authenticator
[Container] 2020/03/22 15:57:19 Running command export PATH=$PWD/:$PATH
[Container] 2020/03/22 15:57:19 Running command apt-get update && apt-get -y install jq
/codebuild/output/tmp/script.sh: line 4: apt-get: command not found
[Container] 2020/03/22 15:57:19 Command did not exit successfully apt-get update && apt-get -y install jq exit status 127
[Container] 2020/03/22 15:57:19 Phase complete: INSTALL State: FAILED
[Container] 2