我在 GitHub 上有一个简单的 nodejs 应用程序,我想构建一个 docker 映像并使用 GitHub 操作推送到 AWS ECR。
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
我在repository-home>settings>secrets中添加了AWS_REPOSITORY_URL、AWS_ACCESS_KEY_ID、AWS_SECRET_ACCESS_KEY。
我确定我输入了正确的值,我也在 gitlab-ci 中使用这些值并且它正在工作。
当我推送到沙箱分支时,CI 作业开始并出现以下错误 -
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'
我究竟做错了什么?我的 YML 文件有错误吗?
从日志来看,作业在Checkout步骤失败。它试图从https://api.github.com/repos/actions/checkout/tarball/sandbox下载一些东西,它给出了 404(我试图在浏览器中打开 URL)。我认为它应该尝试从https://api.github.com/repos/actions/checkout/tarball/master下载。我不确定为什么它会这样。