|
| 1 | +// Documentation: https://github.com/coreos/coreos-ci/blob/main/README-upstream-ci.md |
| 2 | + |
| 3 | +properties([ |
| 4 | + // abort previous runs when a PR is updated to save resources |
| 5 | + disableConcurrentBuilds(abortPrevious: true) |
| 6 | +]) |
| 7 | + |
| 8 | +stage("Build") { |
| 9 | + def n = 5 |
| 10 | + buildPod(memory: "2Gi", cpu: "${n}") { |
| 11 | + checkout scm |
| 12 | + stage("Static analysis") { |
| 13 | + shwrap("./ci/codestyle.sh") |
| 14 | + } |
| 15 | + stage("Core build") { |
| 16 | + shwrap(""" |
| 17 | + # fetch tags so `git describe` gives a nice NEVRA when building the RPM |
| 18 | + git fetch origin --tags |
| 19 | + git submodule update --init |
| 20 | + |
| 21 | + env MAKE_JOBS=${n} ./ci/build.sh |
| 22 | + """) |
| 23 | + } |
| 24 | + stage("Unit tests") { |
| 25 | + try { |
| 26 | + shwrap(""" |
| 27 | + make -C target/c check |
| 28 | + """) |
| 29 | + } finally { |
| 30 | + shwrap("cat test-suite.log || true") |
| 31 | + archiveArtifacts allowEmptyArchive: true, artifacts: 'test-suite.log' |
| 32 | + } |
| 33 | + } |
| 34 | + stage("Build installed tests") { |
| 35 | + shwrap(""" |
| 36 | + make -C tests/kolainst |
| 37 | + """) |
| 38 | + } |
| 39 | + stage("Generate artifacts") { |
| 40 | + shwrap(""" |
| 41 | + make -C target/c install DESTDIR=\$(pwd)/installed/rootfs |
| 42 | + make -C tests/kolainst install DESTDIR=\$(pwd)/installed/tests |
| 43 | + bash -c '. /usr/lib/os-release && echo \$VERSION_ID' >\$(pwd)/installed/buildroot-id |
| 44 | + """) |
| 45 | + } |
| 46 | + stash includes: "installed/", name: 'build' |
| 47 | + } |
| 48 | +} |
| 49 | + |
| 50 | +// Build FCOS and run kola tests. |
| 51 | +// There's some parallelization in testiso up to 8G, add 1G for overhead |
| 52 | +cosaPod(memory: "9Gi", cpu: "4") { |
| 53 | + stage("Build FCOS") { |
| 54 | + checkout scm |
| 55 | + unstash 'build' |
| 56 | + shwrap(""" |
| 57 | + # Make sure none of the files in the unstashed build are setgid |
| 58 | + chmod -c -R g-s installed/ |
| 59 | + # Move the bits into the cosa pod (but only if major versions match) |
| 60 | + buildroot_id=\$(cat installed/buildroot-id) |
| 61 | + osver=\$(. /usr/lib/os-release && echo \$VERSION_ID) |
| 62 | + if test \$osver = \$buildroot_id; then |
| 63 | + rsync -rlv installed/rootfs/ / |
| 64 | + fi |
| 65 | + rsync -rlv installed/tests/ / |
| 66 | + coreos-assembler init --force https://github.com/coreos/fedora-coreos-config |
| 67 | + mkdir -p overrides/rootfs |
| 68 | + # And override the on-host bits |
| 69 | + mv installed/rootfs/* overrides/rootfs/ |
| 70 | + rm installed -rf |
| 71 | + coreos-assembler build |
| 72 | + coreos-assembler osbuild qemu metal metal4k live |
| 73 | + """) |
| 74 | + } |
| 75 | + kola(cosaDir: "${env.WORKSPACE}") |
| 76 | + kolaTestIso(cosaDir: "${env.WORKSPACE}", extraArgs: "--denylist-test *.4k.* --denylist-test *.mpath.*") |
| 77 | +} |
0 commit comments