我有一个步骤来建立一个码头形象。通常,当合并发生时,我会这样做,但是在这种情况下,我想证明它是有效的,所以我试图迫使它在正常构建过程中运行。然而,不管Gitlab (云版本)不能也不会找到一个“运行者”来完成这个任务。这是我的..gitlab ci.yml文件。所讨论的阶段/步骤是
建码头-形象
此作业仍处于挂起状态,并有以下消息:
This job is stuck because of one of the following problems. There are no active runners online, no runners for the protected branch , or no runners that match all of the job's tags: build-docker-image
Go to project CI settings
stages:
- build-app
- test
- build-docker-image
- deploy-develop
- deploy-staging
- deploy-prod
variables:
APP: myapp
##########################################
# Build
##########################################
build-app:
stage: build-app
image:
name: mirror.gcr.io/library/maven:3.8.4-openjdk-17
variables:
GIT_DEPTH: 5
cache:
key: Maven
paths:
- .mvn/
artifacts:
paths:
- target/myapp-*.jar
expire_in: 1 month
tags:
- build
script:
- mvn -DskipTests -Dmaven.repo.local=$(pwd)/.mvn package
##########################################
# Test
##########################################
test:
stage: test
image:
name: mirror.gcr.io/library/maven:3.8.4-openjdk-17
variables:
GIT_DEPTH: 51
cache:
key: Maven
paths:
- .mvn/
artifacts:
paths:
- target/myapp-*.jar
expire_in: 1 month
tags:
- build
script:
- mvn test -Dmaven.repo.local=$(pwd)/.mvn test
##########################################
# Build Docker Image
##########################################
build-docker-image:
stage: build-docker-image
variables:
GIT_DEPTH: 5
image:
name: gcr.io/kaniko-project/executor:debug
entrypoint: [""]
dependencies:
- build-app
tags:
- build-docker-image
script:
- mkdir -p /kaniko/.docker
- echo $GCP_DOCKER | base64 -d > /kaniko/.docker/config.json
- >-
/kaniko/executor
--context "${CI_PROJECT_DIR}"
--dockerfile "${CI_PROJECT_DIR}/Dockerfile"
--destination "us.gcr.io/mycompany-ops/${CI_PROJECT_NAME}:${CI_COMMIT_SHORT_SHA}"
--build-arg GIT_SHA=${CI_COMMIT_SHORT_SHA}
--build-arg GIT_TAG=${CI_COMMIT_TAG}
--build-arg BUILT_ON="$(date)"
when:
# only:
# - main
发布于 2022-06-06 14:24:06
.gitlab-ci.yml
中的标记将作业映射到运行程序。如果没有使用build-docker-image
标记的运行程序,则会收到以下错误消息:
This job is stuck because of one of the following problems. There are no
active runners online, no runners for the protected branch, or no runners
that match all of the job's tags: build-docker-image
如果要使用与管道中的其他步骤相同的运行程序,请更改以下内容:
##########################################
# Build Docker Image
##########################################
build-docker-image:
stage: build-docker-image
# ...
tags:
- build
script:
# ...
https://stackoverflow.com/questions/72512751
复制相似问题