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-02-03 23:45:07 +03:00
parallel normal: {
2020-07-16 18:42:57 +03:00
def n = 5
2021-03-26 17:12:37 +03:00
buildPod(runAsUser:0, memory: "2Gi", cpu: "${n}") {
2020-02-03 18:42:28 +03:00
checkout scm
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
}
},
// A minimal build, helps test our build options
minimal: {
2021-03-26 17:12:37 +03:00
buildPod(runAsUser:0) {
2020-02-03 23:45:07 +03:00
checkout scm
2020-03-02 22:22:14 +03:00
shwrap("""
2020-02-03 23:45:07 +03:00
git submodule update --init
2020-02-03 18:42:28 +03:00
env NOCONFIGURE=1 ./autogen.sh
2020-02-03 23:45:07 +03:00
./configure --without-curl --without-soup --disable-gtk-doc --disable-man \
--disable-rust --without-libarchive --without-selinux --without-smack \
--without-openssl --without-avahi --without-libmount --disable-rofiles-fuse \
2021-04-07 20:10:44 +03:00
--without-libsodium
2020-02-03 18:42:28 +03:00
make
2020-03-02 22:22:14 +03:00
""")
2020-02-03 18:42:28 +03:00
}
},
codestyle: {
2021-03-26 17:12:37 +03:00
buildPod(runAsUser:0) {
2020-02-03 18:42:28 +03:00
checkout scm
2020-03-02 22:22:14 +03:00
shwrap("""
2021-05-07 17:38:16 +03:00
# Jenkins by default only fetches the branch it's testing. Explicitly fetch main
2020-02-03 18:42:28 +03:00
# for ci-commitmessage-submodules.sh
2021-05-07 17:38:16 +03:00
git fetch origin +refs/heads/main:refs/remotes/origin/main
2020-02-03 18:42:28 +03:00
ci/ci-commitmessage-submodules.sh
2020-03-02 22:22:14 +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
stage("More builds and test") {
parallel 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
}
},
buildopts: {
2020-07-16 18:42:57 +03:00
def n = 5
2021-03-26 17:12:37 +03:00
buildPod(memory: "2Gi", cpu: "${n}") {
2020-02-03 23:45:07 +03:00
checkout scm
2020-03-02 22:22:14 +03:00
shwrap("""
2020-02-03 23:45:07 +03:00
git submodule update --init
git worktree add build-libsoup && cd build-libsoup
2020-07-16 18:42:57 +03:00
env MAKE_JOBS=${n} CONFIGOPTS="--without-curl --without-openssl --with-soup" SKIP_INSTALLDEPS=1 ./ci/build.sh
2020-02-03 23:45:07 +03:00
make check
cd .. && rm -rf build-libsoup
2020-03-02 22:22:14 +03:00
""")
2020-02-03 23:45:07 +03:00
}
}
}