AWS我已经在现场实例上自动缩放了 gitlab-runner 。而且效果很好。
我在运行作业时遇到问题。下面是我的.gitlab-ci.yml,它有两个阶段。
stages:
- build
- dev1:build
build:
stage: build
script:
- docker build --rm -t broker-connect-dev1-${CI_COMMIT_SHORT_SHA} -f BrokerConnect/Dockerfile .
only:
- dev1/release
tags:
- itela-spot-runner
build-dev1:
stage: dev1:build
script:
- docker tag broker-connect-dev1-${CI_COMMIT_SHORT_SHA}:latest 19950818/broker-connect:${DEV1_TAG}
only:
- dev1/release
tags:
- itela-spot-runner
Run Code Online (Sandbox Code Playgroud)
问题来了,因为我使用竞价实例来运行作业,有时该build阶段发生在一个竞价实例中,而该dev1:build阶段发生在另一个竞价实例中。当这种情况发生时,dev1:build它会失败,因为它无法找到图像,broker-connect-dev1-${CI_COMMIT_SHORT_SHA}因为它是在单独的 Spot 实例中构建的。在 gitlab 或 gitlab-runner 中,有没有办法控制这种行为并在同一个现场实例中运行这两个build作业dev1:build?