我有一个.gitlab-ci.yml
并且我希望从我的 ECR 中提取跑步者使用的图像。我认为这应该很容易,我让跑步者从 ECR 获取凭据,然后在其他工作之前运行的作业中提取图像:
get_image:
image: node
stage: get_image
script: |
npm install -g aws-cli
source ./build_scripts/assume-role.sh "${REGION}" "${CI_COMMIT_TAG}" "${CODE_SERVICE_ROLE}"
aws ecr get-login --region us-east-1 --no-include-email >> creds.txt
build:
stage: build
image: ${IMAGE_URL}
script: |
...
artifacts:
paths:
- "*/*"
only:
- dev
但是,它会尝试在任何作业运行之前拉取 docker 映像,这意味着它在登录之前就失败了。有什么想法吗?