[DO-290] fixed creating release branch (!18)
Reviewed-on: https://git.avroid.tech/DevOps/jenkins-pipelines/pulls/18 Co-authored-by: aleksandr.vodyanov <aleksandr.vodyanov@avroid.tech> Co-committed-by: aleksandr.vodyanov <aleksandr.vodyanov@avroid.tech>
This commit is contained in:
committed by
Aleksandr Vodyanov
parent
8f7b47fe0d
commit
358a1e1f51
@@ -83,7 +83,8 @@ podTemplate(workspaceVolume: hostPathWorkspaceVolume(hostPath: "/data"),
|
|||||||
Gitea tavroRepo = new Gitea(this, apiRepoURL, "${env.JENKINS_GIT_CREDENTIALS_HTTP}")
|
Gitea tavroRepo = new Gitea(this, apiRepoURL, "${env.JENKINS_GIT_CREDENTIALS_HTTP}")
|
||||||
branch = params.BRANCH_TYPE.toLowerCase() + params.VERSION
|
branch = params.BRANCH_TYPE.toLowerCase() + params.VERSION
|
||||||
|
|
||||||
if (!params.VERSION.matches(versionPattern)) {
|
if (!params.VERSION.matches(versionPattern) || \
|
||||||
|
(params.BRANCH_TYPE == 'Release' && params.VERSION.matches(/^\d+\.\d+\.\d+.*/))) {
|
||||||
println('You must specify correct version, see description!')
|
println('You must specify correct version, see description!')
|
||||||
error()
|
error()
|
||||||
}
|
}
|
||||||
|
|||||||
66
tavro.groovy
66
tavro.groovy
@@ -1,66 +0,0 @@
|
|||||||
pipelineJob('Release-activity/Tavro') {
|
|
||||||
logRotator {
|
|
||||||
numToKeep(10)
|
|
||||||
artifactNumToKeep(10)
|
|
||||||
}
|
|
||||||
|
|
||||||
parameters {
|
|
||||||
choice {
|
|
||||||
name('BRANCH_TYPE')
|
|
||||||
choices(['Release', 'RC', 'Smoke']),
|
|
||||||
description('Select one of branch types')
|
|
||||||
choiceParameter {
|
|
||||||
name('SOURCE_BRANCH_NAME')
|
|
||||||
randomName('')
|
|
||||||
filterable(true)
|
|
||||||
filterLength(1)
|
|
||||||
script {
|
|
||||||
groovyScript {
|
|
||||||
fallbackScript {
|
|
||||||
script('')
|
|
||||||
sandbox(false)
|
|
||||||
}
|
|
||||||
script {
|
|
||||||
sandbox(false)
|
|
||||||
script(
|
|
||||||
"""import groovy.json.JsonSlurperClassic
|
|
||||||
def sout = new StringBuffer(), serr = new StringBuffer()
|
|
||||||
def proc = 'curl --connect-timeout 15 -u \${gitLogin}:\${gitPass} \${env.JENKINS_GIT_REPOSITORY_HTTP_URL}/api/v1/repos/\${repoName}/branches'.execute()
|
|
||||||
proc.consumeProcessOutput(sout, serr)
|
|
||||||
proc.waitForOrKill(5000)
|
|
||||||
JSONInfo = new JsonSlurperClassic().parseText(sout.toString())
|
|
||||||
List branches = []
|
|
||||||
JSONInfo.each{ branch ->
|
|
||||||
branches.add(branch.name)
|
|
||||||
}
|
|
||||||
return branches.sort()
|
|
||||||
"""
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
choiceType('PT_SINGLE_SELECT')
|
|
||||||
}
|
|
||||||
|
|
||||||
string {
|
|
||||||
name('VERSION')
|
|
||||||
defaultValue('')
|
|
||||||
description('Release version eg. (1.4 or 1.4-demo)')
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
definition {
|
|
||||||
cpsScm {
|
|
||||||
scm {
|
|
||||||
git {
|
|
||||||
remote {
|
|
||||||
url("${JENKINS_GIT_REPOSITORY_URL}/DevOps/jenkins-pipelines.git")
|
|
||||||
credentials("${JENKINS_GIT_CREDENTIALS_HTTP}")
|
|
||||||
}
|
|
||||||
branch('master')
|
|
||||||
}
|
|
||||||
}
|
|
||||||
scriptPath('pipelines/Release-activity/tavro.groovy')
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user