Gitlab CI :- 在 gitlab 上推送后获取待处理状态 [英] Gitlab CI :- Getting pending status after push on the gitlab

查看:30
本文介绍了Gitlab CI :- 在 gitlab 上推送后获取待处理状态的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 Gitlab-ci 在推送上创建构建,我还创建了 .gitlab-ci.yml 在我的根目录中.每次在 Gitlab 上推送代码,我都会收到以下消息,如下所示

I am using the Gitlab-ci for the creating the build on the push,I have also creating the .gitlab-ci.yml inside my root directory. With each push the code on the Gitlab , i am getting the following message which are as follow

此作业被卡住,因为您没有任何活跃的跑步者可以运行此作业.

我已经在设置中启用了 Shared Runners 来解决以上问题,例如没有活动成员.

I have already enable the Shared Runners in the Setting getting above problem like Not having active member.

请检查我的 gitlab-ci.yml 文件数据

Please check my gitlab-ci.yml file data

image: jangrewe/gitlab-ci-android

stages:
  - build

before_script:
  - export GRADLE_USER_HOME=$(pwd)/.gradle
  - chmod +x ./gradlew

cache:
  key: ${CI_PROJECT_ID}
  paths:
    - .gradle/

build:
  stage: build
  script:
    - ./gradlew assembleDebug
  artifacts:
    paths:
      - app/build/outputs/

我的所有推送暂停创建构建,请检查一次.

My all push suspended to create the build , please check it once.

即使我手动创建了跑步者,但他们无法执行并获得以下异常

Even though i have created the runner manually but they become fail to execute and getting following excetion

错误:作业失败(系统故障):获取 Kubernetes 配置:无效配置:未提供配置

ERROR: Job failed (system failure): getting Kubernetes config: invalid configuration: no configuration has been provided

请帮我解决这个问题.谢谢

Please help me to short out from the problem. Thanks

推荐答案

如果你有活跃的 shared-runner,那么尝试在 .gitlab-ci.yml 中给出 runner 的标签.假设 shared-runner 的标签是 dev-ci,然后在下面找到更新的代码:

If you have active shared-runner, then try to give the tags of the runner in the .gitlab-ci.yml. Say if the tag for the shared-runner is dev-ci, then find below the updated code:

image: jangrewe/gitlab-ci-android

stages:
  - build

before_script:
  - export GRADLE_USER_HOME=$(pwd)/.gradle
  - chmod +x ./gradlew

cache:
  key: ${CI_PROJECT_ID}
  paths:
    - .gradle/

build:
  stage: build
  tags:
  - dev-ci
  script:
    - ./gradlew assembleDebug
  artifacts:
    paths:
      - app/build/outputs/

跑步者标签截图:

设置跑步者

在为您的项目设置运行器之前,您需要首先:

Before setting up a runner for your project, you need to first:

  1. 安装 gitlab-runner 在与 GitLab 安装位置不同的服务器上.
  2. 注册跑步者 [跑步者分为3种:共享,组和特定的跑步者.根据需要,您可以选择注册哪个跑步者.]
  3. 注册runner时,需要提供tagsrunner 执行器你需要.
  4. 注册完跑者后,进入项目>>设置>>CI/CD>>跑者,可以看到跑者在线.如果您使用的是 Group 或 Shared runner,那么您需要在 Project settings 中启用 runner.
  1. Install gitlab-runner on a server separate than where GitLab is installed.
  2. Register a runner [there are 3 types of runners: shared, group and specific runners. Depending on requirement, you can choose which runner to register.]
  3. While registering the runner, you need to give tags and the type of runner executor you need.
  4. After registering the runner, go to Project >> Settings >> CI/CD >> Runners, you can see the runner is online. If in case you are using Group or Shared runner, then you need to enable the runner in Project settings.

在您的情况下,您可以将 Specific RunnerDocker as Runner-Executor 一起使用,然后在 .gitlab-ci.yml使用您在注册跑步者时提供的标签.

In your case, you can use Specific Runner with Docker as Runner-Executor and then, in the .gitlab-ci.yml use the tags you provided while registering the runner.

这篇关于Gitlab CI :- 在 gitlab 上推送后获取待处理状态的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆