DO-143 code freeze (#15)

Reviewed-on: https://git.avroid.tech/DevOps/jenkins-pipelines/pulls/15
Co-authored-by: aleksandr.vodyanov <aleksandr.vodyanov@avroid.tech>
Co-committed-by: aleksandr.vodyanov <aleksandr.vodyanov@avroid.tech>
This commit is contained in:
aleksandr.vodyanov
2024-01-30 16:34:15 +03:00
committed by Aleksandr Vodyanov
parent b4435cf119
commit ce9e9cd67a
2 changed files with 158 additions and 0 deletions

View File

@@ -0,0 +1,56 @@
pipelineJob('Release-activity/tavro/code_freeze') {
logRotator {
numToKeep(10)
artifactNumToKeep(10)
}
parameters {
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')
}
}
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/code_freeze.groovy')
}
}
}