0
votes

buildspec.yml

version: 0.1
environment_variables:
    plaintext:
        S3_BUCKET: "test"
phases:
    install:
        commands:
            - echo Installing source NPM dependencies...
            - npm install
            - npm install -g @angular/cli
    build:
        commands:
            - echo Build started on `date`
            - ng build --prod -c=staging --output-hashing all
    post_build:
         commands:
            - aws s3 rm s3://${S3_BUCKET} --recursive
            - aws s3 cp dist s3://${S3_BUCKET} --recursive
            - echo Build completed on `date`
artifacts:
    files:
        - '**/*'
    base-directory: 'dist*'
    discard-paths: yes

error: cloudwatch logs

pyenv: version `2.7.15' is not installed (set by /codebuild/output/src298161583/src/.python-version)

2020-07-06T19:33:12.830-04:00

2020-07-06T19:33:12.830-04:00 [Container] 2020/07/06 23:33:12 Command did not exit successfully aws s3 rm s3://${S3_BUCKET} --recursive exit status 1

1
Which CB runtime is that? - Marcin
Ubuntu 18.04 aws/codebuild/standard:4.0 - iosDev
The command aws s3 rm s3://${S3_BUCKET} --recursive looks correct. If you echo ${S3_BUCKET} what does it give? - Marcin
Btw, I assume test is not the real bucket name which you are trying to use? - Marcin
issue solved :) this is issue related to .python-version. - iosDev

1 Answers

0
votes

Can you please try and upgrade to buildspec version 0.2? e.g.

version: 0.2
env:
    variables:
        S3_BUCKET: "test"
phases:
    install:
        runtime-versions:
            python: 3.8
        commands:
            - echo Installing source NPM dependencies...
            - npm install
            - npm install -g @angular/cli
    build:
        commands:
            - echo Build started on `date`
            - ng build --prod -c=staging --output-hashing all
    post_build:
         commands:
            - aws s3 rm s3://${S3_BUCKET} --recursive
            - aws s3 cp dist s3://${S3_BUCKET} --recursive
            - echo Build completed on `date`
artifacts:
    files:
        - '**/*'
    base-directory: 'dist*'
    discard-paths: yes

Based on the output

pyenv: version `2.7.15' is not installed (set by /codebuild/output/src298161583/src/.python-version)

It seems like something is requesting a Python runtime. In one of the comments, you mention that the CodeBuild Docker image Ubuntu 18.04 aws/code-build/standard:4.0 is used. Regrettably, this image only support Python version 3.7 and 3.8 (and not version 2.x), hence the addition of the python: 3.8 in runtime-versions in the updated buildspec above. Consequently, it is not unlikely that there will still be errors that you have to solve.