首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >Gitlab的工作卡住了,没有积极的跑步者,为什么?

Gitlab的工作卡住了,没有积极的跑步者,为什么?
EN

Stack Overflow用户
提问于 2022-06-06 03:26:52
回答 1查看 1.6K关注 0票数 0

我有一个步骤来建立一个码头形象。通常,当合并发生时,我会这样做,但是在这种情况下,我想证明它是有效的,所以我试图迫使它在正常构建过程中运行。然而,不管Gitlab (云版本)不能也不会找到一个“运行者”来完成这个任务。这是我的..gitlab ci.yml文件。所讨论的阶段/步骤是

建码头-形象

此作业仍处于挂起状态,并有以下消息:

代码语言:javascript
运行
复制
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
代码语言:javascript
运行
复制
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
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2022-06-06 14:24:06

.gitlab-ci.yml中的标记将作业映射到运行程序。如果没有使用build-docker-image标记的运行程序,则会收到以下错误消息:

代码语言:javascript
运行
复制
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

如果要使用与管道中的其他步骤相同的运行程序,请更改以下内容:

代码语言:javascript
运行
复制
##########################################
# Build Docker Image
##########################################
build-docker-image:
  stage: build-docker-image
  # ...
  tags:
    - build
  script:
  # ...
票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/72512751

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档