Skip to content

Instantly share code, notes, and snippets.

@scottgigante-immunai
Last active December 7, 2023 21:07
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save scottgigante-immunai/d9cf7c4bdbd1746fcb208a7c96b07c2b to your computer and use it in GitHub Desktop.
Save scottgigante-immunai/d9cf7c4bdbd1746fcb208a7c96b07c2b to your computer and use it in GitHub Desktop.
Running GitHub Actions on an AWS ECR image
name: Run tests
on:
push:
branches:
- 'main'
jobs:
ecr_login:
runs-on: ubuntu-latest
outputs:
ecr_password: ${{ steps.retrieve_password.outputs.ecr_password }}
steps:
- name: Set up AWS CLI
uses: chrislennon/action-aws-cli@1.1
- id: retrieve_password
name: Retrieve ECR password and store as secret
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: us-west-2
run: echo "::set-output name=ecr_password::$(aws ecr get-login-password)"
test:
needs: ecr_login
runs-on: ubuntu-latest
container:
image: ACCOUNT_ID.dkr.ecr.REGION.amazonaws.com/IMAGE:TAG
credentials:
username: AWS
password: ${{ needs.ecr_login.outputs.ecr_password }}
steps:
- run: echo "Running my tests inside a container pulled from ECR \o/"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment