參考:https://blog.csdn.net/wx17343624830/article/details/136906665
參考:https://blog.csdn.net/Step_By_XXX/article/details/131470414
pipeline { agent any tools{ maven 'Maven-3.9.6' } parameters { gitParameter branchFilter: 'origin/(.*)', name: 'branch', type: 'Branch', defaultValue: 'prod', description: 'Select the Git branch to build' } environment { //全域性變數,會在所有stage中生效 ip = '192.168.0.157' } stages { stage('拉取git程式碼') { steps { echo "$branch" git branch: "$branch", credentialsId: 'my_id_rsa', url: 'ssh://git@gitlab.seewintech.com:1130/som/data-api-java/ms-provider/som-commerce.git' } } stage('構建程式碼') { steps { sh " mvn clean package -P prod " } } stage('部署') { steps { sh ''' ''' } } } }