// Documentation: https://github.com/coreos/coreos-ci/blob/main/README-upstream-ci.md properties([ // abort previous runs when a PR is updated to save resources disableConcurrentBuilds(abortPrevious: true) ]) // 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") { checkoutToDir(scm, 'config') def basearch = shwrapCapture("cosa basearch") def mechanical_streams = ['branched', 'rawhide'] shwrap("cd config && ci/validate") shwrap(""" mkdir -p /srv/coreos && cd /srv/coreos cosa init ${env.WORKSPACE}/config python3 /usr/lib/coreos-assembler/download-overrides.py # prep from the latest builds so that we generate a diff on PRs that add packages cosa buildfetch --stream=${env.CHANGE_TARGET} """) // use a --parent-build arg so we can diff later and it matches prod def parent_arg = "" 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 def meta = readJSON file: "meta.json" def version = meta["buildid"] parent_arg = "--parent-build ${version}" } // 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 } // 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") { shwrap("cd /srv/coreos && cosa osbuild metal metal4k live") } stage("Kola Tests") { kola() } // also print the pkgdiff as a separate stage to make it more visible if (parent_arg != "") { stage("RPM Diff") { shwrap(""" cd /srv/coreos cosa diff --rpms | tee tmp/diff.txt 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 """) } } }