34,k8s jenkins 之微服務自動化部署 之jenkins pipeline測試
阿新 • • 發佈:2020-08-15
1,由於預設外掛源在國外伺服器,大多數網路無法順利下載,需修改國內外掛源地址: cd jenkins_home/updates sed -i 's/http:\/\/updates.jenkins-ci.org\/download/https:\/\/mirrors.tuna.tsinghua.edu.cn\/jenkins/g' default.json && \ sed -i 's/http:\/\/www.google.com/https:\/\/www.baidu.com/g' default.json 然後重啟Jenkins:http://192.168.0.14:30006/restart 2,先安裝pipeline外掛。 pipeline { agent any stages { stage('1,拉取程式碼') { steps { echo "1" } } stage('1,程式碼編譯') { steps { echo "2" } } stage('1,單元測試') { steps { echo "3" } } } }
拉取程式碼:
pipeline { agent any parameters { choice choices: ['192.168.0.11:/root/a.git', '192.168.0.11:/root/b.git', '192.168.0.11:/root/c.git'], description: '請選擇要釋出專案的git地址', name: 'git' choice choices: ['192.168.0.10', '192.168.0.11', '192.168.0.12'], description: '請選擇要釋出專案的伺服器', name: 'host' } stages { stage('1,拉取程式碼') { steps { echo "1" } } stage('1,程式碼編譯') { steps { echo "2" } } stage('1,單元測試') { steps { echo "3" } } } }