3

I have a simple nodejs app on GitHub and I want to build a docker image and push to AWS ECR with GitHub actions.

aws.yml:-

name: foo-bar CI

on:
  pull_request:
    branches:         
    - sandbox
  push:
    branches:         
    - sandbox   

env:
  AWS_REPOSITORY_URL: ${{ secrets.AWS_REPOSITORY_URL }}
  AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
  AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}

jobs:
  build-and-push:
    name: Build and push image to AWS ECR
    runs-on: ubuntu-latest
    steps:

    - name: Checkout
      uses: actions/checkout@master

    - name: Check REPO url
      run: echo $AWS_REPOSITORY_URL

    - name: Setup ECR
      run: $( aws ecr get-login --no-include-email --region ap-south-1)

    - name: Build and tag the image
      run: docker build -t $AWS_REPOSITORY_URL .

    - name: Push
      run: docker push $AWS_REPOSITORY_URL

I have added AWS_REPOSITORY_URL, AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY in the repository-home>settings>secrets.

I am sure I have entered the correct values, I am also using these values in gitlab-ci and it's working.

When I pushed to sandbox branch, the CI job started and it gave the following error -

Current runner version: '2.263.0'
Operating System
  Ubuntu
  18.04.4
  LTS
Virtual Environment
  Environment: ubuntu-18.04
  Version: 20200525.2
  Included Software: https://github.com/actions/virtual-environments/blob/ubuntu18/20200525.2/images/linux/Ubuntu1804-README.md
Prepare workflow directory
Prepare all required actions
Download action repository 'actions/checkout@sandbox'
##[error]An action could not be found at the URI 'https://api.github.com/repos/actions/checkout/tarball/sandbox'

What am I doing wrong? Does my YML file have errors?

Judging by the logs, the job fails at Checkout step. It's trying to download something from https://api.github.com/repos/actions/checkout/tarball/sandbox which gives 404 (I tried to open the URL in the browser). I think it should have tried to download from https://api.github.com/repos/actions/checkout/tarball/master. I am not sure though why it's behaving this way.

1 Answer 1

4

For some reason GitHub misinterpreting Checkout step.

It was using actions/checkout@sandbox instead of actions/checkout@master at the time of execution. Probably it's a bug in https://github.com/aws-actions/ with the master branch. I tried v2 tag instead and it worked.

So the updated Checkout step is -

- name: Checkout
  uses: actions/checkout@v2
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.