gitlab的yml语法-小结
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
效果: