Skip to content

Commit ec1805e

Browse files
committed
test-override: support Koji Task (scratch) build
The input for Koji Task (scratch) build URL is like: https://koji.fedoraproject.org/koji/taskinfo?taskID=131400538
1 parent 63a5f7e commit ec1805e

File tree

1 file changed

+25
-7
lines changed

1 file changed

+25
-7
lines changed

jobs/test-override.Jenkinsfile

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ properties([
1111
parameters([
1212
string(name: 'OVERRIDES',
1313
defaultValue: "",
14-
description: 'Space-separated list of Bodhi or Koji URLs'),
14+
description: 'Space-separated list of Bodhi or Koji Build or Koji Task (scratch) URLs'),
1515
choice(name: 'STREAM',
1616
choices: pipeutils.streams_of_type(pipecfg, 'development') +
1717
pipeutils.streams_of_type(pipecfg, 'mechanical'),
@@ -58,17 +58,25 @@ def blueocean_url = "${env.RUN_DISPLAY_URL}"
5858

5959
def bodhi_update_ids = []
6060
def koji_build_ids = []
61+
def koji_scratch_build_ids = []
62+
63+
def bodhi_url_prefix = "https://bodhi.fedoraproject.org/updates/"
64+
def koji_url_prefix = "https://koji.fedoraproject.org/koji/buildinfo?buildID="
65+
def koji_scratch_url_prefix = "https://koji.fedoraproject.org/koji/taskinfo?taskID="
66+
6167
for (url in params.OVERRIDES.split()) {
62-
if (url.startsWith("https://bodhi.fedoraproject.org/updates/")) {
63-
bodhi_update_ids += url - "https://bodhi.fedoraproject.org/updates/"
64-
} else if (url.startsWith("https://koji.fedoraproject.org/koji/buildinfo?buildID=")) {
65-
koji_build_ids += url - "https://koji.fedoraproject.org/koji/buildinfo?buildID="
68+
if (url.startsWith(bodhi_url_prefix)) {
69+
bodhi_update_ids += url - bodhi_url_prefix
70+
} else if (url.startsWith(koji_url_prefix)) {
71+
koji_build_ids += url - koji_url_prefix
72+
} else if (url.startsWith(koji_scratch_url_prefix)) {
73+
koji_scratch_build_ids += url - koji_scratch_url_prefix
6674
} else {
6775
error("don't know how to handle override URL $url")
6876
}
6977
}
7078

71-
if (bodhi_update_ids.size() == 0 && koji_build_ids.size() == 0) {
79+
if (bodhi_update_ids.size() == 0 && koji_build_ids.size() == 0 && koji_scratch_build_ids.size() == 0) {
7280
error("no overrides provided")
7381
}
7482

@@ -101,8 +109,14 @@ try {
101109
if (descPrefix == "") {
102110
if (!bodhi_update_ids.isEmpty()) {
103111
descPrefix = shwrapCapture("curl -sSL https://bodhi.fedoraproject.org/updates/${bodhi_update_ids[0]} | jq -r .update.title")
104-
} else {
112+
} else if (!koji_build_ids.isEmpty()) {
105113
descPrefix = koji_build_ids[0]
114+
} else {
115+
descPrefix = shwrapCapture("""
116+
koji taskinfo -v -r ${koji_scratch_build_ids[0]} | \
117+
grep SRPM: | head -1 | awk -F '/' '{print \$NF}' | sed 's#.src.rpm\$##'
118+
""")
119+
descPrefix = "scratch: + ${descPrefix}"
106120
}
107121
}
108122
currentBuild.description = "[${descPrefix}] Running"
@@ -206,6 +220,10 @@ try {
206220
// packages nor packages on $arch
207221
shwrap("cosa shell -- env -C overrides/rpm koji download-build ${id} --arch ${arch} --arch noarch")
208222
}
223+
// Download Koji Task (scratch) rpms
224+
for (id in koji_scratch_build_ids) {
225+
shwrap("cosa shell -- env -C overrides/rpm koji download-task ${id} --arch ${arch} --arch noarch --skip='debug|test'")
226+
}
209227
}
210228
}
211229
}

0 commit comments

Comments
 (0)