Gitlab Runner 官方简介

什么是 Runner:what is Gitlab runner

  • Runners are the agents that run the CI/CD jobs that come from GitLab.

安装 Runner 的途径:Install Gitlab runner

  • install GitLab Runner on a machine that’s separate from the one that hosts the GitLab instance

  • GitLab Runner should be the same version as GitLab.

注册 runner:Register runner

  • Register work is build comunication between Runner and Gitlab instance

Runner 的执行器 Executor

  • When you register a runner, you must choose an executor

  • An executor determines the environment each job runs in

    example:

    • If you want your CI/CD job to run PowerShell commands, you might install GitLab Runner on a Windows server and then register a runner that uses the shell executor.

    • If you want your CI/CD job to run commands in a custom Docker container, you might install GitLab Runner on a Linux server and register a runner that uses the Docker executor.

runner 不同类型对应的权限

  • Shared runner 对所有Project 开放

  • Group runner 针对某个群组及其子群组开放

  • Specific runner 针对特定的某一个 Project

还记得对 runner 进行注册的时候,我们输入的那个 token 吗?那个时候就在确定哪些角色有权限访问 runner

runner 标签 Tag

  • 可以在 注册 runner 时,增加标签

  • 当一个CI/CD job 运行时,可以按 tag 指定 runner,你可以在项目的 .gitlab-ci.yml 文件里去指定

    job:
      tags:
        - ruby

    这样当 job 启动的时候,job 启用的是一个 tag 名为 ruby 的 runner

runner 设置项

  • 可以在 config.toml 文件里对 runner 进行配置,这个文件是在 runner 安装时生成的

  • 在 config.toml 文件里,你可以对某个特定的 runner 设置 ,也可以针对全部的 runner 设置

  • 设置项包括:并发项、内存、CPU ,等等

runner 监控工具

  • Prometheus 可以监视你的 runner,例如同时在运行的 runner 数量、占用的CPU等等

使用 runner 运行 job

  • 如果在 .gitlab-ci.yml 已经指定了runner,那么当你在仓库提交代码时,流水线就会自动启动,runner 执行器就开始执行 job

runner 提供者

  • gitlab 官网的 runner 是由 gitlab 自己来管控的,面向所有 project 开放

  • 如果你要用自己的 runner ,则需要安装 runner 后,并在你的 gitlab 上进行注册

你可能感兴趣的:(云原生,gitlab)