2021-05-07 16:44:06 +02:00
// Documentation: https://github.com/coreos/coreos-ci/blob/main/README-upstream-ci.md
2020-02-03 15:42:28 +00:00
2023-11-21 15:31:38 -05:00
properties([
// abort previous runs when a PR is updated to save resources
disableConcurrentBuilds(abortPrevious: true)
])
2020-02-03 15:42:28 +00:00
stage("Build") {
2020-07-16 11:42:57 -04:00
def n = 5
2022-05-16 12:37:15 -04:00
buildPod(memory: "2Gi", cpu: "${n}") {
2020-02-03 15:42:28 +00:00
checkout scm
2022-05-31 10:57:00 -04:00
stage("Static analysis") {
shwrap("./ci/codestyle.sh")
}
2020-02-03 20:45:07 +00:00
stage("Core build") {
2020-03-02 14:22:14 -05:00
shwrap("""
# fetch tags so `git describe` gives a nice NEVRA when building the RPM
git fetch origin --tags
git submodule update --init
2020-02-03 15:42:28 +00:00
2023-12-03 15:24:52 -05:00
env MAKE_JOBS=${n} ./ci/build.sh
2020-03-02 14:22:14 -05:00
""")
2020-02-03 20:45:07 +00:00
}
stage("Unit tests") {
2020-03-02 14:22:14 -05:00
try {
shwrap("""
make check
""")
} finally {
2021-03-26 14:12:37 +00:00
shwrap("cat test-suite.log || true")
2020-03-02 14:22:14 -05:00
archiveArtifacts allowEmptyArchive: true, artifacts: 'test-suite.log'
}
2020-02-03 20:45:07 +00:00
}
2021-03-26 14:12:37 +00:00
stage("Build installed tests") {
shwrap("make -C tests/kolainst")
}
stage("Generate artifacts") {
shwrap("""
make install DESTDIR=\$(pwd)/installed/rootfs
make -C tests/kolainst install DESTDIR=\$(pwd)/installed/tests
2022-11-18 10:42:58 -05:00
bash -c '. /usr/lib/os-release && echo \$VERSION_ID' >\$(pwd)/installed/buildroot-id
2021-03-26 14:12:37 +00:00
""")
}
stash includes: "installed/", name: 'build'
2020-02-03 20:45:07 +00:00
}
2020-02-03 15:42:28 +00:00
}
2020-02-03 20:45:07 +00:00
2022-10-13 09:14:08 -04:00
// Build FCOS and run kola tests.
2022-11-11 15:03:30 -05:00
// There's some parallelization in testiso up to 8G, add 1G for overhead
cosaPod(runAsUser: 0, memory: "9Gi", cpu: "4") {
2022-10-13 09:16:19 -04:00
stage("Build FCOS") {
checkout scm
unstash 'build'
shwrap("""
2022-11-18 10:42:58 -05:00
# Move the bits into the cosa pod (but only if major versions match)
buildroot_id=\$(cat installed/buildroot-id)
osver=\$(. /usr/lib/os-release && echo \$VERSION_ID)
if test \$osver = \$buildroot_id; then
rsync -rlv installed/rootfs/ /
fi
2022-10-13 09:16:19 -04:00
rsync -rlv installed/tests/ /
2023-09-19 14:41:36 -04:00
coreos-assembler init --force https://github.com/coreos/fedora-coreos-config
mkdir -p overrides/rootfs
2022-10-13 09:16:19 -04:00
# And override the on-host bits
mv installed/rootfs/* overrides/rootfs/
rm installed -rf
2023-09-19 14:41:36 -04:00
coreos-assembler fetch
coreos-assembler build
coreos-assembler buildextend-metal
coreos-assembler buildextend-metal4k
coreos-assembler buildextend-live --fast
2022-10-13 09:16:19 -04:00
""")
2020-02-03 20:45:07 +00:00
}
2022-10-13 09:18:08 -04:00
kola(cosaDir: "${env.WORKSPACE}")
2023-03-01 09:42:46 -05:00
kolaTestIso(cosaDir: "${env.WORKSPACE}", extraArgs: "--denylist-test *.4k.* --denylist-test *.mpath.*")
2020-02-03 20:45:07 +00:00
}