We use CircleCI to run node.js integration tests, and it works great for us. We can run them manually or by checking in code to the corresponding github branch. It’s perfect.
However, we’re now trying to gain access to aws in one of the tests, and I’m a bit confused on how to do this. Here’s our current (somewhat simplified) config.ym file:
jobs:
build:
docker:
- image: circleci/node:12.9
working_directory: ~/test-runner
steps:
- checkout
- restore_cache:
keys:
- v1-dependencies-{{ checksum "package.json" }}
- v1-dependencies-
- run: echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc
- run: npm install
- save_cache:
paths:
- node_modules
key: v1-dependencies-{{ checksum "package.json" }}
- run: npm run test
- run: cd ~/test-runner
- run: echo "[default]" > ~/.aws/credentials
- run: echo "aws_access_key_id = ${AWS_ACCESS_KEY}" >> ~/.aws/credentials
- run: echo "aws_secret_access_key = ${AWS_SECRET_ACCESS_KEY}" >> ~/.aws/credentials
- run: echo "[default]" > ~/.aws/config
- run: echo "region = us-east-1" >> ~/.aws/config
workflows:
version: 2
workflow:
jobs:
- build
As you can see, we’re using your circleci/node image currently, and I’m in the process of getting our aws credentials lined up in the executor. That said, I’m not quite sure I follow orb usage…would the aws-cli orb replace our node image? Or augment it somehow, in the orbs
section of the config?
Also, I had a question about running shell scripts and how best to do it in CircleCI. As the config above shows I’m doing some pretty simple stuff, single-line commands and simple run
statements. What we’ll need to do with aws is run a script like this one to grant some whitelisting in our aws instance using the aws cli and a shell script.
How do I run or call a script like that in CircleCI, is it done from my config file, and if so do I echo it out somehow or some other way?
Sorry for the basic nature of these questions, it’s just that I’ve never done these things in CircleCI.