How to fix the AWS code-build apt-get update exit status 100 for react application to upload on s3
Asked Answered
V

2

7

I have reactJs application and using AWS s3 to deploy static site. I've setup AWS code build for CI/CD. I'm using bitbucket and when any PR merge to master branch Web-hook comes into picture to trigger react application build and upload build on s3.

It was working fine for last 2 years but in last build I got a below error.

W: GPG error: https://dl.yarnpkg.com/debian stable InRelease: The following signatures were invalid: EXPKEYSIG 23E7166788B63E1E Yarn Packaging [email protected] E: The repository 'https://dl.yarnpkg.com/debian stable InRelease' is not signed.

[Container] 2021/02/04 07:39:02 Command did not exit successfully apt-get update exit status 100 [Container] 2021/02/04 07:39:02 Phase complete: INSTALL State: FAILED [Container] 2021/02/04 07:39:02 Phase context status code: COMMAND_EXECUTION_ERROR Message: Error while executing command: apt-get update. Reason: exit status 100

Here is the full log output.

enter image description here

here is the buildspec.yml file

# aws codebuild for React and deployment to S3
version: 0.2
phases:
  install:
    runtime-versions:
      nodejs: 10
    commands:
      - echo Installing build dependencies...
      - apt-get update
      - apt-get install -y sshpass zip unzip
  pre_build:
    commands:
      - echo Build started on `date`
      - echo Installing source NPM dependencies...
      - npm ci
      - cp src/gatsby-overrides/gatsby-sharp.js node_modules/gatsby-plugin-sharp/index.js
      - cp src/gatsby-overrides/gatsby-image.js node_modules/gatsby-image/index.js
  build:
    commands:
      - npm run build
      - chmod u+x script.sh
      - ./script.sh
    finally:
      - echo Build completed on `date`
cache:
  paths:
    - 'public/**/*'
Verse answered 4/2, 2021 at 15:6 Comment(0)
G
8

The signing key it complains about on line 82, what happens when you install it before apt update? Like suggested here: https://github.com/yarnpkg/yarn/issues/7866

curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
Grice answered 4/2, 2021 at 15:10 Comment(6)
Can you help me what and which line I've to update in buildspec.yml file? It will be very helpful.Verse
do I've to add curl -sS dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add - in pre_build section?Verse
I don't know, apt-get update seems to depend on this, so what about putting it in front of it? What do you think?Grice
after adding this curl command I'm getting this error. [Container] 2021/02/04 15:28:21 Running command curl -sS dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add - /codebuild/output/tmp/script.sh: 4: /codebuild/output/tmp/script.sh: sudo: not foundVerse
Try it without the sudo. Btw this is an ubuntu specific issue, not related to codebuild.Gascony
This is a known issue by AWS and codebuild service team looking into this issueKablesh
O
0

Worked for me without sudo. Below command worked:

curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
Overpay answered 5/2, 2021 at 13:48 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.