jenkinsfile流水线

 

参考: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 '''
        
       '''
      }
    }
  }
}

 

posted @ 2024-05-17 18:01  苦逼yw  阅读(5)  评论(0编辑  收藏  举报