運行流水線任務
在gitlab倉庫中項目根目錄添加一個.gitlab-ci.yml文件,文件內容如下。
yaml文件
這個流水線共包含兩個job,分別是build 和 deploy
。
build
job包含一個stage build
。 build
stage配置了在具有build
標籤的runner中運行,限制爲master分支提交,運行構建命令。
deploy
job包含一個stage deploy
。 deploy
stage配置了在具有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分支提交代碼。此時會發現流水線正在運行。
測試流水線
一起學習呀: