2.5運行流水線任務

運行流水線任務

在gitlab倉庫中項目根目錄添加一個.gitlab-ci.yml文件,文件內容如下。

yaml文件

這個流水線共包含兩個job,分別是build 和 deploy

buildjob包含一個stage build。 buildstage配置了在具有build標籤的runner中運行,限制爲master分支提交,運行構建命令。

deployjob包含一個stage deploy。 deploystage配置了在具有deploy標籤的runner中運行,限制爲master分支提交,運行發佈命令。

stages:
  - build
  - deploy
 

build:
  stage: build
  tags:
    - build
  only:
    - master
  script:
    - echo "mvn clean "
    - echo "mvn install"


deploy:
  stage: deploy
  tags:
    - deploy
  only:
    - master
  script:
    - echo "hello deploy"

編寫好yml文件之後,開始模擬在master分支提交代碼。此時會發現流水線正在運行。

測試流水線

images

一起學習呀:

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章