/
update-version-and-registry-tags.groovy
45 lines (37 loc) · 1.52 KB
/
update-version-and-registry-tags.groovy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import groovy.json.JsonSlurper
def curlCMD = "https://raw.githubusercontent.com/redhat-developer/devspaces/devspaces-3-rhel-8/dependencies/job-config.json".toURL().text
def jsonSlurper = new JsonSlurper();
def config = jsonSlurper.parseText(curlCMD);
// for 3.yy, return 3.yy+1
def computeNextVersion(String ver){
verBits=ver.tokenize(".")
int vb1=Integer.parseInt(verBits[1])
return verBits[0] + "." + (vb1+1)
}
def JOB_BRANCHES = [computeNextVersion(config.Version+"")] // only one release at a time, latest 2.yy+1
for (String JOB_BRANCH : JOB_BRANCHES) {
pipelineJob("${FOLDER_PATH}/${ITEM_NAME}"){
// keep job disabled until we explicitly need it
disabled(true)
description('''
This job is meant to bootstrap a new release of DS, by bumping versions in
job-config.json, VERSION file and registries, then committing changes.
''')
logRotator {
daysToKeep(5)
numToKeep(5)
artifactDaysToKeep(2)
artifactNumToKeep(2)
}
parameters{
stringParam("DS_VERSION",JOB_BRANCH,"future version of DS to use when updating job-config.json, VERSION file and registry tags")
booleanParam("CLEAN_ON_FAILURE", true, "If false, don't clean up workspace after the build so it can be used for debugging.")
}
definition {
cps{
sandbox(true)
script(readFileFromWorkspace('jobs/DS_CI/Releng/update-version-and-registry-tags.jenkinsfile'))
}
}
}
}