Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

circleci 2.0 can't find awscli

I'm using circleCI 2.0 and they can't find aws but their documents clearly say that aws is installed in default

when I use this circle.yml

version: 2
jobs:
  build:
    working_directory: ~/rian
    docker:
        - image: node:boron
    steps:
        - checkout
        - run:
            name: Pre-Dependencies
            command: mkdir ~/rian/artifacts
        - restore_cache:
            keys: 
              - rian-{{ .Branch }}-{{ checksum "yarn.lock" }}
              - rian-{{ .Branch }}
              - rian-master
        - run:
            name: Install Dependencies
            command: yarn install
        - run:
            name: Test
            command: |
              node -v
              yarn run test:ci
        - save_cache:
            key: rian-{{ .Branch }}-{{ checksum "yarn.lock" }}
            paths:
              - "~/.cache/yarn"
        - store_artifacts:
            path: ~/rian/artifacts
            destination: prefix
        - store_test_results:
            path: ~/rian/test-results
        - deploy:
            command: aws s3 sync ~/rian s3://rian-s3-dev/ --delete

following error occurs:

/bin/bash: aws: command not found
Exited with code 127

so if I edit the code this way

    - deploy:
        command: |
          apt-get install awscli
          aws s3 sync ~/rian s3://rian-s3-dev/ --delete

then i get another kind of error:

Reading package lists... Done


Building dependency tree       


Reading state information... Done

E: Unable to locate package awscli
Exited with code 100

Anyone knows how to fix this???

like image 873
Duck Yeon Kim Avatar asked Sep 06 '25 03:09

Duck Yeon Kim


1 Answers

The document you are reading is for CircleCI 1.0 and for 2.0 is here:

https://circleci.com/docs/2.0/

In CircleCI 2.0, you can use your favorite Docker image. The image you are currently setting is node:boron, which does not include the aws command.

  • https://hub.docker.com/_/node/
  • https://github.com/nodejs/docker-node/blob/14681db8e89c0493e8af20657883fa21488a7766/6.10/Dockerfile

If you just want to make it work for now, you can install the aws command yourself in circle.yml.

apt-get update && apt-get install -y awscli

However, to take full advantage of Docker's benefits, it is recommended that you build a custom Docker image that contains the necessary dependencies such as the aws command.

You can write your custom aws-cli Docker image something like this:

FROM circleci/python:3.7-stretch

ENV AWS_CLI_VERSION=1.16.138
RUN sudo pip install awscli==${AWS_CLI_VERSION}
like image 199
minamijoyo Avatar answered Sep 07 '25 21:09

minamijoyo