gitlab--job 分组

job 分组作业

当我们的 job 有很多的时候,如果我们写成一个 stage 的话,会显的很多,可以自动将相似的工作组合在一起。如果作业名称以某种方式格式化,它们将在常规管道图(而不是迷你图)中折叠成一个组

要创建一组作业,请在CI/CD 管道配置文件中,用数字和以下内容之一分隔每个作业名称:

  • 斜线 ( /),例如test 1/3test 2/3test 3/3
  • 冒号 ( :),例如test 1:3test 2:3test 3:3
  • 一个空格,例如test 0 3test 1 3test 2 3

通过从左到右写数字来对作业进行排序。通常希望第一个数字是索引,第二个数字是总数

default:
  image: ruby:2.7.5
build-job:
  stage: build #  # build 下面单独的一个
  script:
    - echo "Hello, $GITLAB_USER_LOGIN!"

build ruby 1/3: # build 下面的分组
  stage: build
  script:
    - echo "ruby1"

build ruby 2/3:  # build 下面的分组
  stage: build
  script:
    - echo "ruby2"

build ruby 3/3:  # build 下面的分组
  stage: build
  script:
    - echo "ruby3"

test-job1:
  stage: test
  script:
    - echo "This job tests something"

test-job2:
  stage: test
  script:
    - echo "This job tests something, but takes more time than test-job1."
    - echo "After the echo commands complete, it runs the sleep command for 20 seconds"
    - echo "which simulates a test that runs 20 seconds longer than test-job1"
    - sleep 20


deploy-prod:
  stage: deploy
  script:
    - echo "This job deploys something from the $CI_COMMIT_BRANCH branch."

运行上面的 pipeline,效果如下

posted @   邹邹很busy。  阅读(131)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 分享4款.NET开源、免费、实用的商城系统
· 全程不用写代码,我用AI程序员写了一个飞机大战
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
· 上周热点回顾(2.24-3.2)
历史上的今天:
2020-05-10 Linux--部署Vue项目
点击右上角即可分享
微信分享提示

目录导航