2021-05-05 12:30:07 -08:00
|
|
|
// Documentation: https://github.com/coreos/coreos-ci/blob/main/README-upstream-ci.md
|
2019-08-02 17:42:06 -08:00
|
|
|
|
2023-11-21 11:31:38 -09:00
|
|
|
properties([
|
|
|
|
|
// abort previous runs when a PR is updated to save resources
|
|
|
|
|
disableConcurrentBuilds(abortPrevious: true)
|
|
|
|
|
])
|
|
|
|
|
|
2026-06-05 12:05:03 -08:00
|
|
|
// We run kola tests including iso.* tests which are resource
|
|
|
|
|
// intensive. Let's give the system a lot of memory.
|
|
|
|
|
cosaPod(cpus: 4, memory: "12Gi") {
|
2020-10-06 10:07:18 -08:00
|
|
|
checkoutToDir(scm, 'config')
|
2020-02-20 12:38:04 -09:00
|
|
|
|
2021-03-29 11:05:46 -08:00
|
|
|
def basearch = shwrapCapture("cosa basearch")
|
2021-07-14 06:54:36 -08:00
|
|
|
def mechanical_streams = ['branched', 'rawhide']
|
2021-03-29 11:05:46 -08:00
|
|
|
|
2020-10-06 10:07:18 -08:00
|
|
|
shwrap("cd config && ci/validate")
|
2020-02-20 12:38:04 -09:00
|
|
|
|
|
|
|
|
shwrap("""
|
2022-10-13 09:45:53 -08:00
|
|
|
mkdir -p /srv/coreos && cd /srv/coreos
|
2020-10-06 10:07:18 -08:00
|
|
|
cosa init ${env.WORKSPACE}/config
|
2023-06-14 06:03:03 -08:00
|
|
|
python3 /usr/lib/coreos-assembler/download-overrides.py
|
2019-09-20 06:51:55 -08:00
|
|
|
# prep from the latest builds so that we generate a diff on PRs that add packages
|
2025-09-29 05:55:47 -08:00
|
|
|
cosa buildfetch --stream=${env.CHANGE_TARGET}
|
2020-02-20 12:38:04 -09:00
|
|
|
""")
|
|
|
|
|
|
2021-03-18 11:19:03 -08:00
|
|
|
// use a --parent-build arg so we can diff later and it matches prod
|
|
|
|
|
def parent_arg = ""
|
2022-10-13 09:45:53 -08:00
|
|
|
if (shwrapRc("test -e /srv/coreos/builds/latest/${basearch}/meta.json") == 0) {
|
|
|
|
|
shwrap("cp /srv/coreos/builds/latest/${basearch}/meta.json .") // readJSON wants it in the WORKSPACE
|
2021-03-18 11:19:03 -08:00
|
|
|
def meta = readJSON file: "meta.json"
|
|
|
|
|
def version = meta["buildid"]
|
|
|
|
|
parent_arg = "--parent-build ${version}"
|
|
|
|
|
}
|
|
|
|
|
|
2021-07-13 18:07:47 -08:00
|
|
|
// do a build. If we are operating on a mechanical stream then we
|
|
|
|
|
// can pin packages in lockfiles but we don't maintain a full set
|
|
|
|
|
// so we can't do a strict build.
|
|
|
|
|
def no_strict_build = false
|
|
|
|
|
if (env.CHANGE_TARGET in mechanical_streams) {
|
|
|
|
|
no_strict_build = true
|
|
|
|
|
}
|
2019-09-20 06:51:55 -08:00
|
|
|
|
2026-05-04 04:42:41 -08:00
|
|
|
// Don't run tests until all artifacts are built, as iso.* tests are now folded into kola.
|
|
|
|
|
stage("Build") {
|
|
|
|
|
cosaBuild(skipInit: true, skipKola: true, noStrict: no_strict_build, extraFetchArgs: '--with-cosa-overrides', extraArgs: parent_arg)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
stage("Build Artifacts") {
|
2025-02-24 10:54:19 -09:00
|
|
|
shwrap("cd /srv/coreos && cosa osbuild metal metal4k live")
|
2020-09-08 13:46:04 -08:00
|
|
|
}
|
|
|
|
|
|
2026-05-04 04:42:41 -08:00
|
|
|
stage("Kola Tests") {
|
|
|
|
|
kola()
|
2020-09-08 13:46:04 -08:00
|
|
|
}
|
|
|
|
|
|
2019-09-20 06:51:55 -08:00
|
|
|
// also print the pkgdiff as a separate stage to make it more visible
|
2021-03-12 12:27:23 -09:00
|
|
|
if (parent_arg != "") {
|
|
|
|
|
stage("RPM Diff") {
|
|
|
|
|
shwrap("""
|
2022-10-13 09:45:53 -08:00
|
|
|
cd /srv/coreos
|
2025-09-16 14:22:15 -08:00
|
|
|
cosa diff --rpms | tee tmp/diff.txt
|
2021-03-12 12:28:27 -09:00
|
|
|
if grep -q Downgraded tmp/diff.txt; then
|
|
|
|
|
echo "Downgrade detected. This is likely unintentional. If not, you may safely ignore this error."
|
|
|
|
|
exit 1
|
|
|
|
|
fi
|
2021-03-12 12:27:23 -09:00
|
|
|
""")
|
|
|
|
|
}
|
2019-09-20 06:51:55 -08:00
|
|
|
}
|
2019-08-02 17:42:06 -08:00
|
|
|
}
|