mirror of
https://github.com/ostreedev/ostree.git
synced 2024-12-22 17:35:55 +03:00
1f637bf341
There's a lot going on here. First, this is intended to run nicely as part of the new [cosa/kola ext-tests](https://github.com/coreos/coreos-assembler/pull/1252). With Rust we can get one big static binary that we can upload, and include a webserver as part of the binary. This way we don't need to do the hack of running a container with Python or whatever. Now, what's even better about Rust for this is that it has macros, and specifically we are using [commandspec](https://github.com/tcr/commandspec/) which allows us to "inline" shell script. I think the macros could be even better, but this shows how we can intermix pure Rust code along with using shell safely enough. We're using my fork of commandspec because the upstream hasn't merged [a few PRs](https://github.com/tcr/commandspec/pulls?q=is%3Apr+author%3Acgwalters+). This model is intended to replace *both* some of our `make check` tests as well. Oh, and this takes the obvious step of using the Rust OSTree bindings as part of our tests. Currently the "commandspec tests" and "API tests" are separate, but nothing stops us from intermixing them if we wanted. I haven't yet tried to write destructive tests with this but I think it will go well.
105 lines
3.0 KiB
Plaintext
105 lines
3.0 KiB
Plaintext
// Documentation: https://github.com/coreos/coreos-ci/blob/master/README-upstream-ci.md
|
|
|
|
stage("Build") {
|
|
parallel normal: {
|
|
cosaPod(buildroot: true, runAsUser: 0) {
|
|
checkout scm
|
|
stage("Core build") {
|
|
shwrap("""
|
|
# fetch tags so `git describe` gives a nice NEVRA when building the RPM
|
|
git fetch origin --tags
|
|
git submodule update --init
|
|
|
|
env SKIP_INSTALLDEPS=1 ./ci/build.sh
|
|
""")
|
|
}
|
|
stage("Unit tests") {
|
|
try {
|
|
shwrap("""
|
|
make check
|
|
make syntax-check
|
|
""")
|
|
} finally {
|
|
archiveArtifacts allowEmptyArchive: true, artifacts: 'test-suite.log'
|
|
}
|
|
}
|
|
shwrap("""
|
|
make install DESTDIR=\$(pwd)/insttree/
|
|
tar -c -C insttree/ -zvf insttree.tar.gz .
|
|
""")
|
|
stash includes: 'insttree.tar.gz', name: 'build'
|
|
}
|
|
},
|
|
// A minimal build, helps test our build options
|
|
minimal: {
|
|
cosaPod(buildroot: true, runAsUser: 0) {
|
|
checkout scm
|
|
shwrap("""
|
|
git submodule update --init
|
|
|
|
env NOCONFIGURE=1 ./autogen.sh
|
|
./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 \
|
|
--disable-experimental-api --without-libsodium
|
|
make
|
|
""")
|
|
}
|
|
},
|
|
codestyle: {
|
|
cosaPod {
|
|
checkout scm
|
|
shwrap("""
|
|
# 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
|
|
ci/ci-commitmessage-submodules.sh
|
|
""")
|
|
}
|
|
}
|
|
}
|
|
|
|
// Build FCOS and do a kola basic run
|
|
stage("More builds and test") {
|
|
parallel fcos: {
|
|
cosaPod(buildroot: true, runAsUser: 0, memory: "3072Mi", cpu: "4") {
|
|
stage("Build FCOS") {
|
|
checkout scm
|
|
unstash 'build'
|
|
shwrap("""
|
|
mkdir insttree
|
|
tar -C insttree -xzvf insttree.tar.gz
|
|
rsync -rlv insttree/ /
|
|
coreos-assembler init --force https://github.com/coreos/fedora-coreos-config
|
|
mkdir -p overrides/rootfs
|
|
mv insttree/* overrides/rootfs/
|
|
rmdir insttree
|
|
coreos-assembler fetch
|
|
coreos-assembler build
|
|
# Install the tests
|
|
make -C tests/kolainst install
|
|
""")
|
|
}
|
|
fcosKola(cosaDir: "${env.WORKSPACE}")
|
|
}
|
|
},
|
|
buildopts: {
|
|
cosaPod(buildroot: true, runAsUser: 0) {
|
|
checkout scm
|
|
shwrap("""
|
|
git submodule update --init
|
|
|
|
git worktree add build-rust && cd build-rust
|
|
env CONFIGOPTS="--enable-rust" SKIP_INSTALLDEPS=1 ./ci/build.sh
|
|
make check TESTS=tests/test-rollsum
|
|
cd .. && rm -rf build-rust
|
|
|
|
git worktree add build-libsoup && cd build-libsoup
|
|
env CONFIGOPTS="--without-curl --without-openssl --with-soup" SKIP_INSTALLDEPS=1 ./ci/build.sh
|
|
make check
|
|
cd .. && rm -rf build-libsoup
|
|
""")
|
|
}
|
|
}
|
|
}
|