Skip to content

Commit ce363ee

Browse files
committed
test-override: support COPR build
To support builds from any COPR repo and not just the CoreOS continuous repo: `copr/8957796` Fixes: coreos#85
1 parent ec1805e commit ce363ee

File tree

1 file changed

+35
-4
lines changed

1 file changed

+35
-4
lines changed

jobs/test-override.Jenkinsfile

Lines changed: 35 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,12 @@ properties([
1111
parameters([
1212
string(name: 'OVERRIDES',
1313
defaultValue: "",
14-
description: 'Space-separated list of Bodhi or Koji Build or Koji Task (scratch) URLs'),
14+
description: '''Space-separated list of Bodhi or Koji Build or Koji Task (scratch) URLs or COPR Build
15+
For example:
16+
- The Bodhi Build URL is https://bodhi.fedoraproject.org/updates/FEDORA-2025-16cced9e85
17+
- The Koji Build URL is https://koji.fedoraproject.org/koji/buildinfo?buildID=2681652
18+
- The Koji Task (scratch) URL is https://koji.fedoraproject.org/koji/taskinfo?taskID=132021551
19+
- To support COPR builds from any COPR repo, the COPR Build is in the format: copr/<build-id>'''),
1520
choice(name: 'STREAM',
1621
choices: pipeutils.streams_of_type(pipecfg, 'development') +
1722
pipeutils.streams_of_type(pipecfg, 'mechanical'),
@@ -59,10 +64,14 @@ def blueocean_url = "${env.RUN_DISPLAY_URL}"
5964
def bodhi_update_ids = []
6065
def koji_build_ids = []
6166
def koji_scratch_build_ids = []
67+
def copr_build_ids = []
6268

6369
def bodhi_url_prefix = "https://bodhi.fedoraproject.org/updates/"
6470
def koji_url_prefix = "https://koji.fedoraproject.org/koji/buildinfo?buildID="
6571
def koji_scratch_url_prefix = "https://koji.fedoraproject.org/koji/taskinfo?taskID="
72+
// To support builds from any COPR repo and not just the CoreOS continuous repo
73+
// check if the prefix is copr/<build-id>
74+
def copr_build_prefix = "copr/"
6675

6776
for (url in params.OVERRIDES.split()) {
6877
if (url.startsWith(bodhi_url_prefix)) {
@@ -71,12 +80,14 @@ for (url in params.OVERRIDES.split()) {
7180
koji_build_ids += url - koji_url_prefix
7281
} else if (url.startsWith(koji_scratch_url_prefix)) {
7382
koji_scratch_build_ids += url - koji_scratch_url_prefix
83+
} else if (url.startsWith(copr_build_prefix)) {
84+
copr_build_ids += url - copr_build_prefix
7485
} else {
7586
error("don't know how to handle override URL $url")
7687
}
7788
}
7889

79-
if (bodhi_update_ids.size() == 0 && koji_build_ids.size() == 0 && koji_scratch_build_ids.size() == 0) {
90+
if (bodhi_update_ids.size() == 0 && koji_build_ids.size() == 0 && koji_scratch_build_ids.size() == 0 && copr_build_ids.size() == 0) {
8091
error("no overrides provided")
8192
}
8293

@@ -111,12 +122,18 @@ try {
111122
descPrefix = shwrapCapture("curl -sSL https://bodhi.fedoraproject.org/updates/${bodhi_update_ids[0]} | jq -r .update.title")
112123
} else if (!koji_build_ids.isEmpty()) {
113124
descPrefix = koji_build_ids[0]
114-
} else {
125+
} else if (!koji_scratch_build_ids.isEmpty()) {
115126
descPrefix = shwrapCapture("""
116127
koji taskinfo -v -r ${koji_scratch_build_ids[0]} | \
117128
grep SRPM: | head -1 | awk -F '/' '{print \$NF}' | sed 's#.src.rpm\$##'
118129
""")
119-
descPrefix = "scratch: + ${descPrefix}"
130+
descPrefix = "scratch: ${descPrefix}"
131+
} else {
132+
descPrefix = shwrapCapture("""
133+
curl -sSL 'https://copr.fedorainfracloud.org/api_3/build/${copr_build_ids[0]}' | \
134+
jq -r '.source_package | \"\\(.name)-\\(.version)\"'
135+
""")
136+
descPrefix = "copr: ${descPrefix}"
120137
}
121138
}
122139
currentBuild.description = "[${descPrefix}] Running"
@@ -224,6 +241,20 @@ try {
224241
for (id in koji_scratch_build_ids) {
225242
shwrap("cosa shell -- env -C overrides/rpm koji download-task ${id} --arch ${arch} --arch noarch --skip='debug|test'")
226243
}
244+
// Download copr build rpms
245+
for (id in copr_build_ids) {
246+
// get chrootname like fedora-42-x86_64
247+
def manifest_raw = shwrapCapture("cosa shell -- env -C src/config cat manifest.yaml")
248+
def manifest_yaml = readYaml text: manifest_raw
249+
def chrootname = ""
250+
if (manifest_yaml.releasever != "") {
251+
chrootname = "fedora-${manifest_yaml.releasever}-${arch}"
252+
} else {
253+
error("can not find releasever in manifest.yaml")
254+
}
255+
shwrap("cosa shell -- env -C overrides/rpm copr-cli download-build --rpms --chroot ${chrootname} ${id}")
256+
shwrap("cosa shell -- env -C overrides/rpm rsync -av --remove-source-files --exclude='*debug*' --exclude='*test*' --exclude='*src*' ${chrootname}/ .")
257+
}
227258
}
228259
}
229260
}

0 commit comments

Comments
 (0)