Home > database >  AWS not found using gitlab ci
AWS not found using gitlab ci

Time:03-20

I have a following gitlab-ci.yml file and when the pipeline runs it gives me below error.

image: registry.gitlab.com/gitlab-org/cloud-deploy/aws-base:v0.3.6

variables:
  ARTIFACT_NAME: node-app.zip

stages:
  - Preproduction

Preproduction:
  stage: Preproduction
  image: alpine:latest
  script:
    - aws s3 cp $ARTIFACT_NAME s3://$S3_BUCKET/$ARTIFACT_NAME // <-- Here is the error
...

The error is

Running with gitlab-runner 14.8.0~beta.44.g57df0d52 (57df0d52)
  on blue-3.shared.runners-manager.gitlab.com/default zxwgkjAP
Preparing the "docker machine" executor
00:06
Using Docker executor with image alpine:latest ...
Pulling docker image alpine:latest ...
Using docker image sha256:e9adb5357e84d853cc3eb08cd4d3f9bd6cebdb8a67f0415cc884be7b0202416d for alpine:latest with digest alpine@sha256:d6d0a0eb4d40ef96f2310ead734848b9c819bb97c9d846385c4aca1767186cd4 ...
Preparing environment
00:01
Running on runner-zxwgkjap-project-34634909-concurrent-0 via runner-zxwgkjap-shared-1647747126-3b689cf2...
Getting source from Git repository
00:01
$ eval "$CI_PRE_CLONE_SCRIPT"
Fetching changes with git depth set to 20...
Initialized empty Git repository in /builds/gemmyapp/node-app/.git/
Created fresh repository.
Checking out ceeb21ea as master...
Skipping Git submodules setup
Downloading artifacts
00:01
Downloading artifacts for Build (2225270126)...
Downloading artifacts from coordinator... ok        id=2225270126 responseStatus=200 OK token=SXxyo5zN
Executing "step_script" stage of the job script
00:01
Using docker image sha256:e9adb5357e84d853cc3eb08cd4d3f9bd6cebdb8a67f0415cc884be7b0202416d for alpine:latest with digest alpine@sha256:d6d0a0eb4d40ef96f2310ead734848b9c819bb97c9d846385c4aca1767186cd4 ...
/bin/sh: eval: line 126: aws: not found
$ aws s3 cp $ARTIFACT_NAME s3://$S3_BUCKET/$ARTIFACT_NAME
Cleaning up project directory and file based variables
00:00
ERROR: Job failed: exit code 127

CodePudding user response:

Your Preproduction stage is using alpine:latest image, which doesn't come with AWS CLI bundled. Change that to registry.gitlab.com/gitlab-org/cloud-deploy/aws-base:v0.3.6 and it should work.

Preproduction:
  stage: Preproduction
  image: registry.gitlab.com/gitlab-org/cloud-deploy/aws-base:v0.3.6
  script:
    - aws s3 cp $ARTIFACT_NAME s3://$S3_BUCKET/$ARTIFACT_NAME
  • Related