2020-03-02 22:14:29 +03:00
// Documentation: https://github.com/coreos/coreos-ci/blob/master/README-upstream-ci.md
2019-12-13 20:12:53 +03:00
2019-07-22 19:50:18 +03:00
stage("Build") {
parallel rpms: {
2020-07-13 02:35:42 +03:00
cosaPod(buildroot: true, runAsUser: 0, memory: "2Gi") {
2019-07-22 19:50:18 +03:00
checkout scm
2020-03-02 22:14:29 +03:00
shwrap("""
2019-12-13 20:14:32 +03:00
# fetch tags so `git describe` gives a nice NEVRA when building the RPM
git fetch origin --tags
2019-07-22 19:50:18 +03:00
git submodule update --init
2020-12-31 19:55:19 +03:00
ci/installdeps.sh
ci/install-extra-builddeps.sh
# Not in the path by default
2020-06-17 21:05:06 +03:00
export PATH="\$HOME/.cargo/bin:\$PATH"
2020-12-31 19:55:19 +03:00
# Our primary CI build goes via RPM rather than direct to binaries
# to better test that path, including our vendored spec file, etc.
# However, to do that we need to generate
# the source code expected via the RPM path. Because the binding
# build rules are part of an Automake-generated Makefile we end
# up running autotools twice, which is annoying but extracting
#
env NOCONFIGURE=1 ./autogen.sh
./configure --prefix=/usr
make -f Makefile.bindings bindings
2019-07-22 19:50:18 +03:00
cd packaging
make -f Makefile.dist-packaging rpm
2019-12-22 01:42:11 +03:00
mv \$(find . -name '*.rpm') ..
2020-03-02 22:14:29 +03:00
""")
2019-12-13 20:14:32 +03:00
// make it easy for anyone to download the RPMs
2019-12-22 01:42:11 +03:00
archiveArtifacts '*.rpm'
stash excludes: '*.src.rpm', includes: '*.rpm', name: 'rpms'
2019-07-22 19:50:18 +03:00
}
},
codestyle: {
2020-04-07 00:30:19 +03:00
cosaPod(buildroot: true) {
2019-10-03 22:14:11 +03:00
checkout scm
2020-03-02 22:14:29 +03:00
shwrap("""
2019-07-22 19:50:18 +03:00
# Jenkins by default only fetches the branch it's testing. Explicitly fetch master
# for ci-commitmessage-submodules.sh
git fetch origin +refs/heads/master:refs/remotes/origin/master
2019-10-03 22:14:11 +03:00
ci/ci-commitmessage-submodules.sh
2019-07-22 19:50:18 +03:00
ci/codestyle.sh
2020-03-02 22:14:29 +03:00
""")
2019-07-22 19:50:18 +03:00
}
},
2020-09-30 22:12:29 +03:00
unit: {
// this branch runs unit tests (both Rust-based and C-based) and makes sure we compile
// fine against the MSRV
2020-07-14 02:18:22 +03:00
def n = 5
cosaPod(buildroot: true, runAsUser: 0, memory: "2Gi", cpu: "${n}") {
2019-07-22 19:50:18 +03:00
checkout scm
2020-09-30 22:12:29 +03:00
shwrap("""
MAKE_JOBS=${n} CARGO_BUILD_JOBS=${n} ci/msrv.sh
""")
2019-07-22 19:50:18 +03:00
}
}}
tests/compose: Target FCOS 31, move off of PAPR
Again, a lot going on here, but essentially, we adapt the compose tests
to run either privileged or fully unprivileged via supermin, just like
cosa.
I actually got more than halfway through this initially using `cosa
build` directly for testing. But in the end, we simply need more
flexibility than that. We want to be able to manipulate exactly how
rpm-ostree is called, and cosa is very opinionated about this (and may
also change from under us in the future).
(Another big difference for example is that cosa doesn't care about
non-unified mode, whereas we *need* to have coverage for this until we
fully kill it.)
Really, the most important bit we want from there is the
unprivileged-via-supermin bits. So we copy and adapt that here. One
obvious improvement then is sharing this code more easily (e.g. a
`cosa runasroot` or something?)
However, we still use the FCOS manifest (frozen at a specific tag). It's
a realistic example, and because of the lockfiles and pool, we get good
reproducibility.
2019-12-22 01:42:09 +03:00
stage("Test") {
2020-04-15 00:51:16 +03:00
parallel insttests: {
2019-12-22 01:42:11 +03:00
def nhosts = 6
def mem = (nhosts * 1024) + 512
2020-03-02 22:14:29 +03:00
cosaPod(runAsUser: 0, memory: "${mem}Mi", cpu: "${nhosts}") {
2019-12-22 01:42:11 +03:00
stage("Build FCOS") {
checkout scm
unstash 'rpms'
// run this stage first without installing deps, so we match exactly the cosa pkgset
// (+ our built rpm-ostree)
2020-03-02 22:14:29 +03:00
shwrap("""
2019-12-22 01:42:11 +03:00
dnf install -y *.rpm
coreos-assembler init --force https://github.com/coreos/fedora-coreos-config
# include our built rpm-ostree in the image
mkdir -p overrides/rpm
mv *.rpm overrides/rpm
2020-04-21 19:56:38 +03:00
coreos-assembler fetch
2019-12-22 01:42:11 +03:00
coreos-assembler build
2020-03-02 22:14:29 +03:00
""")
2019-12-22 01:42:11 +03:00
}
stage("Install Deps") {
2020-03-02 22:14:29 +03:00
// really, we just need test deps, but meh...
shwrap("ci/installdeps.sh")
2019-12-22 01:42:11 +03:00
}
2020-04-15 00:51:16 +03:00
stage("Kola") {
2020-05-23 17:34:57 +03:00
// TODO upstream this into coreos-ci-lib
shwrap("make -C tests/kolainst install")
2020-04-15 00:51:16 +03:00
fcosKola(cosaDir: "${env.WORKSPACE}", extraArgs: "ext.*", parallel: nhosts)
}
stage("vmcheck") {
2019-12-22 01:42:11 +03:00
try {
timeout(time: 30, unit: 'MINUTES') {
2020-03-02 22:14:29 +03:00
shwrap("""
2019-12-22 01:42:11 +03:00
fcos=\$(ls builds/latest/*/*.qcow2) # */
ln -sf "\$(realpath \${fcos})" tests/vmcheck/image.qcow2
JOBS=${nhosts} tests/vmcheck.sh
2020-03-02 22:14:29 +03:00
""")
2019-12-22 01:42:11 +03:00
}
} finally {
2020-03-02 22:14:29 +03:00
shwrap("""
2019-12-22 01:42:11 +03:00
if [ -d vmcheck-logs ]; then
tar -C vmcheck-logs -cf- . | xz -c9 > vmcheck-logs.tar.xz
fi
2020-03-02 22:14:29 +03:00
""")
2019-12-22 01:42:11 +03:00
archiveArtifacts allowEmptyArchive: true, artifacts: 'vmcheck-logs.tar.xz'
Rework vmcheck to use `kola spawn`, move off of PAPR
There's a lot going on here, but essentially:
1. We change the `vmcheck` model so that it always operates on an
immutable base image. It takes that image and dynamically launches a
separate VM for each test using `kola spawn`. This means we can drop
a lot of hacks around re-using the same VMs.
2. Following from 1., `vmoverlay` now takes as input a base image,
overlays the built rpm-ostree bits, then creates a new base image. Of
course, we don't have to do this in CI, because we build FCOS with
the freshly built RPMs (so it uses `SKIP_VMOVERLAY=1`). `vmoverlay`
then will be more for the developer case where one doesn't want to
iterate via `cosa build` to test rpm-ostree changes. I say "will"
because the functionality doesn't exist yet; I'd like to enhance
`cosa dev-overlay` to do this. (Note `vmsync` should still works just
as before too.)
3. `vmcheck` can be run without building the tree first, as
`tests/vmcheck.sh`. The `make vmcheck` target still exists though for
finger compatibility and better meshing with `vmoverlay` in the
developer case.
What's really nice about using kola spawn is that it takes care of a lot
of things for us, such as the qemu command, journal and console
gathering, and SSH.
Similarly to the compose testsuites, we're using parallel here to run
multiple vmcheck tests at once. (On developer laptops, we cap
parallelism at `$(nproc) - 1`).
2019-12-13 20:23:41 +03:00
}
2020-04-15 00:51:16 +03:00
}
2019-12-22 01:42:11 +03:00
}
tests/compose: Target FCOS 31, move off of PAPR
Again, a lot going on here, but essentially, we adapt the compose tests
to run either privileged or fully unprivileged via supermin, just like
cosa.
I actually got more than halfway through this initially using `cosa
build` directly for testing. But in the end, we simply need more
flexibility than that. We want to be able to manipulate exactly how
rpm-ostree is called, and cosa is very opinionated about this (and may
also change from under us in the future).
(Another big difference for example is that cosa doesn't care about
non-unified mode, whereas we *need* to have coverage for this until we
fully kill it.)
Really, the most important bit we want from there is the
unprivileged-via-supermin bits. So we copy and adapt that here. One
obvious improvement then is sharing this code more easily (e.g. a
`cosa runasroot` or something?)
However, we still use the FCOS manifest (frozen at a specific tag). It's
a realistic example, and because of the lockfiles and pool, we get good
reproducibility.
2019-12-22 01:42:09 +03:00
},
compose: {
2019-12-22 01:42:11 +03:00
def jobs = 5
def mem = (jobs * 2048) + 512
2020-03-02 22:14:29 +03:00
cosaPod(runAsUser: 0, memory: "${mem}Mi", cpu: "${jobs}") {
2019-12-22 01:42:11 +03:00
checkout scm
unstash 'rpms'
stage("Install Deps") {
2020-03-02 22:14:29 +03:00
shwrap("""
2019-12-22 01:42:11 +03:00
ci/installdeps.sh # really, we just need test deps, but meh...
dnf install -y *.rpm # install our built rpm-ostree
2020-03-02 22:14:29 +03:00
""")
tests/compose: Target FCOS 31, move off of PAPR
Again, a lot going on here, but essentially, we adapt the compose tests
to run either privileged or fully unprivileged via supermin, just like
cosa.
I actually got more than halfway through this initially using `cosa
build` directly for testing. But in the end, we simply need more
flexibility than that. We want to be able to manipulate exactly how
rpm-ostree is called, and cosa is very opinionated about this (and may
also change from under us in the future).
(Another big difference for example is that cosa doesn't care about
non-unified mode, whereas we *need* to have coverage for this until we
fully kill it.)
Really, the most important bit we want from there is the
unprivileged-via-supermin bits. So we copy and adapt that here. One
obvious improvement then is sharing this code more easily (e.g. a
`cosa runasroot` or something?)
However, we still use the FCOS manifest (frozen at a specific tag). It's
a realistic example, and because of the lockfiles and pool, we get good
reproducibility.
2019-12-22 01:42:09 +03:00
}
2019-12-22 01:42:11 +03:00
stage("Run") {
try {
2020-08-24 16:25:01 +03:00
timeout(time: 60, unit: 'MINUTES') {
2020-03-02 22:14:29 +03:00
shwrap("""
mkdir -p compose-logs /srv/tmpdir
2019-12-22 01:42:11 +03:00
TMPDIR=/srv/tmpdir JOBS=${jobs} ./tests/compose.sh
2020-03-02 22:14:29 +03:00
""")
2019-12-22 01:42:11 +03:00
}
} finally {
2020-03-02 22:14:29 +03:00
shwrap("""
2019-12-22 01:42:11 +03:00
if [ -d compose-logs ]; then
tar -C compose-logs -cf- . | xz -c9 > compose-logs.tar.xz
fi
2020-03-02 22:14:29 +03:00
""")
2019-12-22 01:42:11 +03:00
archiveArtifacts allowEmptyArchive: true, artifacts: 'compose-logs.tar.xz'
}
}
}
tests/compose: Target FCOS 31, move off of PAPR
Again, a lot going on here, but essentially, we adapt the compose tests
to run either privileged or fully unprivileged via supermin, just like
cosa.
I actually got more than halfway through this initially using `cosa
build` directly for testing. But in the end, we simply need more
flexibility than that. We want to be able to manipulate exactly how
rpm-ostree is called, and cosa is very opinionated about this (and may
also change from under us in the future).
(Another big difference for example is that cosa doesn't care about
non-unified mode, whereas we *need* to have coverage for this until we
fully kill it.)
Really, the most important bit we want from there is the
unprivileged-via-supermin bits. So we copy and adapt that here. One
obvious improvement then is sharing this code more easily (e.g. a
`cosa runasroot` or something?)
However, we still use the FCOS manifest (frozen at a specific tag). It's
a realistic example, and because of the lockfiles and pool, we get good
reproducibility.
2019-12-22 01:42:09 +03:00
}}