Gitlab CI-启动普通回购协议的共享运行器 [英] Gitlab CI - Start Shared Runner for normal repos

查看:112
本文介绍了Gitlab CI-启动普通回购协议的共享运行器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是Gitlab CI的新手.

I'm new to Gitlab CI.

我已经配置了.gitlab-ci.yml文件,并使用CI Lint通过了验证过程.

I have configured .gitlab-ci.yml file, and using CI Lint it has passed the validation process.

基于此文档,我可以看到应该在其中配置特定的运行器一个虚拟机,一个VPS,一个裸机,一个Docker容器甚至是一组容器.

Based on this documentation, I can see a specific runner should be configured on a virtual machine, a VPS, a bare-metal machine, a docker container or even a cluster of containers.

我可以看到gitlab有自己的共享运行器,并且默认情况下启用了 .

And I can see gitlab has its own shared runners and enabled by default.

当我访问管道"页面时,我只能看到蓝色的"管道入门" 按钮,单击该按钮后,我将被重定向到

When I visit the Pipeline page I can only see the blue Get Started with Pipeline button and when clicked I was redirected to this page.

" Gitlab CI-如何启动Shared Runner "表示Gitlab CI仅会为分支,但是,除非在非常特殊的情况下,否则我的git都不会使用分支.所以

The "Gitlab CI - How to start Shared Runner" says that Gitlab CI will only run the job for the testing branch, however, none of my git use branch unless for very specific cases. So

问题是如何在只有一个master分支的普通(私有)存储库中使用此共享运行器?

The question is how to use this shared runner in my normal (private) repo that has only the single master branch?

推荐答案

共享运行程序将在 any 分支中运行,因此在master分支中也将运行(除非您否则进行配置.

Shared runners will run for any branch, so for the master branch too (unless you configure otherwise).

另外,

  • you can pick-up a specific runner if you define a tag for your job.
  • you can filter if the job will be triggered via only and/or except directives.

例如,尽管有分支,以下作业将触发任何推送:

For example, following job will trigger for any push, despite the branch:

buildClient:
  stage: buildComponents
  script:
  - echo "Building the client..."

另一方面,此作业仅在推送到develop分支时才会触发,并且任何具有docker标记的可用运行器都将对其进行处理:

On the other hand, this job will trigger only for push to the develop branch and it will be processed by any available runner with the docker tag:

buildServer:
  stage: buildComponents
  script:
  - echo "Building the server with Docker..."
  only:
  - develop
  tags:
  - docker


根据蓝色的管道入门按钮:您需要将.gitlab-ci.yml文件添加到项目的根目录并将其推送到GitLab.该文件定义了构建管道的 stages jobs .然后,跑步者根据给定的配置选择工作.例如.简单的.gitlab-ci.yml看起来可能像这样:


According the blue Get Started with Pipeline button: You need to add a .gitlab-ci.yml file to the root of your project and push it to GitLab. This file defines stages and jobs of your build pipeline. Jobs are then picked-up by runners according the given configuration. E.g. simple .gitlab-ci.yml can look like this:

image: alpine:latest

stages:
  - test
  - build

testApp:
  stage: test
  script: echo "Testing..."

buildApp:
  stage: build
  script: echo "Building..."

请参见使用.gitlab-ci.yml配置工作在GitLab文档中获取更多详细信息.

See Configuration of your jobs with .gitlab-ci.yml in GitLab documentation for more details.

这篇关于Gitlab CI-启动普通回购协议的共享运行器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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