提交那个分支,就那个分支自动发布。
- 配置Jenkins参数
- 修改jenkinsfile
#!groovy
@Library('jenkinslib@master') _
//func from shareibrary
def build = new org.devops.build()
def deploy = new org.devops.deploy()
//env
String buildShell = "${env.buildShell}"
String buildType = "${env.buildType}"
String deployHosts = "${env.deployHosts}"
String srcUrl = "${env.srcUrl}"
String branchName = "${env.branchName}"
//pipeline
pipeline{
agent { node { label "master"}}
stages{
stage("CheckOut"){
steps{
script{
if ("${runOpts}" == "GitlabPush"){
branchName = branch - "refs/heads/"
}
println("${branchName}")
checkout([$class: 'GitSCM', branches: [[name:"${branchName}"]], extensions: [], userRemoteConfigs: [[credentialsId: 'ef208191-527c-4630-a677-b81696446562', url: "${srcUrl}"]]])
}
}
}
stage("build"){
steps{
script{
build.Build(buildType,buildShell)
}
}
}
}
}
- 在test01修改代码后,会默认发版这个分支的代码。
- 我的QQ
- QQ扫一扫
-
- 我的头条
- 头条扫一扫
-
评论