Files
jenkins-pipeline/多分支集成.groovy

44 lines
1.4 KiB
Groovy
Raw Normal View History

2025-10-20 19:42:34 +08:00
pipeline {
agent any
parameters {
// 单选:基础分支
gitParameter(
branchFilter: 'origin/(.*)',
defaultValue: 'dxin',
name: 'BASE_BRANCH',
type: 'PT_BRANCH',
selectedValue: 'DEFAULT',
sortMode: 'ASCENDING_SMART',
description: '选择基础分支',
quickFilterEnabled: true,
tagFilter: '*',
listSize: "1"
)
// 多选:要合并的特性分支
gitParameter(
branchFilter: 'origin/(?!master|mainsit|dxin|release).*', // 排除主干分支,只显示特性分支
name: 'MERGE_BRANCHES',
type: 'PT_MULTI_BRANCH',
description: '选择要集成的特性分支',
quickFilterEnabled: true,
tagFilter: '*',
listSize: "1"
)
booleanParam(name: 'DELETE_INTEGRATION_BRANCH', defaultValue: true, description: '构建完成后删除临时分支?')
}
stages {
stage('拉取基础分支') {
steps {
// 拉取指定分支代码(通过参数 params.Code_branch 动态指定)
git branch: "${params.BASE_BRANCH}",
credentialsId: 'fly_gitlab_auth',
url: 'http://106.53.194.199/python/lessie-sourcing-agents.git'
}
}
}
}