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

  

效果:


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM