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
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
2020-07-16 18:42:57 +03:00
env MAKE_JOBS=${n} SKIP_INSTALLDEPS=1 ./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
make syntax-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
""")
}
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
// Build FCOS and do a kola basic run
2022-05-31 16:59:02 +03:00
stage("FCOS") {
2021-03-26 17:12:37 +03:00
cosaPod(runAsUser: 0, memory: "3072Mi", cpu: "4") {
2020-02-03 23:45:07 +03:00
stage("Build FCOS") {
checkout scm
unstash 'build'
2020-03-02 22:22:14 +03:00
shwrap("""
2021-03-26 17:12:37 +03:00
# Move the bits into the cosa pod
rsync -rlv installed/rootfs/ /
rsync -rlv installed/tests/ /
2020-02-03 23:45:07 +03:00
coreos-assembler init --force https://github.com/coreos/fedora-coreos-config
mkdir -p overrides/rootfs
2021-03-26 17:12:37 +03:00
# And override the on-host bits
mv installed/rootfs/* overrides/rootfs/
rm installed -rf
2020-04-21 22:25:40 +03:00
coreos-assembler fetch
2020-02-03 23:45:07 +03:00
coreos-assembler build
2020-07-31 13:57:58 +03:00
coreos-assembler buildextend-metal
coreos-assembler buildextend-metal4k
2020-08-01 21:14:30 +03:00
coreos-assembler buildextend-live --fast
2021-03-26 17:12:37 +03:00
2020-03-02 22:22:14 +03:00
""")
2020-02-03 23:45:07 +03:00
}
2020-07-31 13:57:58 +03:00
stage("Test") {
parallel metal: {
try {
2020-08-11 08:02:12 +03:00
shwrap("kola testiso -S --scenarios pxe-install,iso-offline-install,pxe-offline-install --output-dir tmp/kola-testiso-metal")
2020-07-31 13:57:58 +03:00
} finally {
2020-08-01 21:14:30 +03:00
shwrap("tar -cf - tmp/kola-testiso-metal/ | xz -c9 > ${env.WORKSPACE}/kola-testiso-metal.tar.xz")
2020-07-31 13:57:58 +03:00
archiveArtifacts allowEmptyArchive: true, artifacts: 'kola-testiso*.tar.xz'
}
}, kola: {
fcosKola(cosaDir: "${env.WORKSPACE}")
}
}
2020-02-03 23:45:07 +03:00
}
}