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