gitlab的yml官方文档

https://docs.gitlab.com/ee/ci/yaml/README.html#allow_failure

1、新建作业(job)、定义阶段(stage)、允许失败(allow_failure)、人工触发(when: manual)、作业运行前执行的脚本(before_script)、作业运行后执行的脚本(after_script)

案例1:.gitlab-ci.yml中内容

before_script:
  - echo "Before script section"
  - echo "For example you might run an update here or install a build dependency"
  - echo "Or perhaps you might print out some debugging details"
  - ping -c 2 127.0.0.1
  - echo "$ci_test01"
  - ping -c $ci_time_sec2 127.0.0.1
   
after_script:
  - echo "After script section"
  - echo "For example you might do some cleanup here"
  - ping -c 2 127.0.0.1
   
build1:
  stage: build
  script:
    - echo "Do your build here"
    - ping -c 3 127.0.0.1
#  when: manual
   
test1:
  stage: test
  script: 
    - echo "Do a test here"
    - echo "For example run a test suite"
    - ping -c 1 10.5.6.7
  #when: manual
  allow_failure: true
  
test2:
  stage: test
  script: 
    - echo "Do another parallel test here"
    - echo "For example run a lint test"
    - ping -c 3 127.0.0.1
  #when: manual
   
deploy1:
  stage: deploy
  script:
    - echo "Do your deploy here"
    - ping -c 3 127.0.0.1
  #when: manual

  

效果:

gitlab的yml语法-小结

相关文章:

  • 2022-01-07
  • 2021-12-24
  • 2022-02-15
  • 2021-06-18
  • 2022-01-07
  • 2021-07-15
猜你喜欢
  • 2021-06-12
  • 2021-10-14
  • 2022-12-23
  • 2022-03-04
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案