From 7268ac98759dabc6701d36b5f544b94fccf64516 Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Wed, 3 Feb 2021 20:54:24 +0000 Subject: [PATCH] ci: Consistently source libbuild Since we need to set HOME and PATH, let's do that in a central place rather than scattering it around by having all of our entrypoint scripts source the `libbuild.sh` shell "library". Move the CoreOS CI entrypoint into a script like the others. --- .cci.jenkinsfile | 19 +++---------------- ci/build-check.sh | 4 ---- ci/build.sh | 1 - ci/clang-build-check.sh | 4 ---- ci/commit-validation.sh | 1 + ci/coreosci-rpmbuild.sh | 17 +++++++++++++++++ ci/libbuild.sh | 2 ++ ci/unit.sh | 4 +++- 8 files changed, 26 insertions(+), 26 deletions(-) create mode 100755 ci/coreosci-rpmbuild.sh diff --git a/.cci.jenkinsfile b/.cci.jenkinsfile index 70035e42..68d4d4ff 100644 --- a/.cci.jenkinsfile +++ b/.cci.jenkinsfile @@ -5,22 +5,9 @@ parallel rpms: { def n = 5 cosaPod(buildroot: true, runAsUser: 0, memory: "2Gi", cpu: "${n}") { checkout scm - shwrap(""" - # fetch tags so `git describe` gives a nice NEVRA when building the RPM - git fetch origin --tags - git submodule update --init - ci/installdeps.sh - ci/install-extra-builddeps.sh - # Not in the path by default - export PATH="\$HOME/.cargo/bin:\$PATH" - # Our primary CI build goes via RPM rather than direct to binaries - # to better test that path, including our vendored spec file, etc. - # The RPM build expects pre-generated bindings, so do that now. - make -f Makefile.bindings bindings - cd packaging - RPM_BUILD_NCPUS=${n} make -f Makefile.dist-packaging rpm - mv \$(find . -name '*.rpm') .. - """) + shwrap("""RPM_BUILD_NCPUS=${n} ./ci/coreosci-rpmbuild.sh + mv packaging/*/*.rpm . + """) // make it easy for anyone to download the RPMs archiveArtifacts '*.rpm' stash excludes: '*.src.rpm', includes: '*.rpm', name: 'rpms' diff --git a/ci/build-check.sh b/ci/build-check.sh index 106049e3..288e3dc3 100755 --- a/ci/build-check.sh +++ b/ci/build-check.sh @@ -7,9 +7,5 @@ set -xeuo pipefail dn=$(dirname $0) . ${dn}/libbuild.sh - -# add cargo's directory to the PATH like we do in CoreOS CI -export PATH="$HOME/.cargo/bin:$PATH" - ${dn}/build.sh make check diff --git a/ci/build.sh b/ci/build.sh index e773af87..bdfd194f 100755 --- a/ci/build.sh +++ b/ci/build.sh @@ -7,7 +7,6 @@ dn=$(dirname $0) . ${dn}/libbuild.sh ${dn}/install-extra-builddeps.sh -export PATH="$HOME/.cargo/bin:$PATH" ${dn}/installdeps.sh # make it clear what rustc version we're compiling with (this is grepped in CI) rustc --version diff --git a/ci/clang-build-check.sh b/ci/clang-build-check.sh index b863fc2a..5ec44821 100755 --- a/ci/clang-build-check.sh +++ b/ci/clang-build-check.sh @@ -7,10 +7,6 @@ set -xeuo pipefail dn=$(dirname $0) . ${dn}/libbuild.sh - -# add cargo's directory to the PATH like we do in CoreOS CI -export PATH="$HOME/.cargo/bin:$PATH" - export CC=clang CXX=clang++ ${dn}/build.sh make check diff --git a/ci/commit-validation.sh b/ci/commit-validation.sh index 26eb0359..55a5fa10 100755 --- a/ci/commit-validation.sh +++ b/ci/commit-validation.sh @@ -2,5 +2,6 @@ set -xeuo pipefail # Add cheap (non-building) checks here dn=$(dirname $0) +. ${dn}/libbuild.sh ${dn}/codestyle.sh ${dn}/ci-commitmessage-submodules.sh diff --git a/ci/coreosci-rpmbuild.sh b/ci/coreosci-rpmbuild.sh new file mode 100755 index 00000000..ed2d77c6 --- /dev/null +++ b/ci/coreosci-rpmbuild.sh @@ -0,0 +1,17 @@ +#!/bin/bash +set -euo pipefail + +dn=$(dirname $0) +. ${dn}/libbuild.sh + +# fetch tags so `git describe` gives a nice NEVRA when building the RPM +git fetch origin --tags +git submodule update --init --recursive +ci/installdeps.sh +ci/install-extra-builddeps.sh +# Our primary CI build goes via RPM rather than direct to binaries +# to better test that path, including our vendored spec file, etc. +# The RPM build expects pre-generated bindings, so do that now. +make -f Makefile.bindings bindings +cd packaging +make -f Makefile.dist-packaging rpm diff --git a/ci/libbuild.sh b/ci/libbuild.sh index 5a04c676..2dfa3359 100644 --- a/ci/libbuild.sh +++ b/ci/libbuild.sh @@ -5,6 +5,8 @@ if test -z "$HOME" || test ! -w "$HOME"; then export HOME=$(mktemp -d -t --suffix .prowhome) fi +# In some cases we install tools via cargo, ensure that's in PATH +export PATH="$HOME/.cargo/bin:$PATH" pkg_upgrade() { echo "Running dnf -y distro-sync... $(date)" diff --git a/ci/unit.sh b/ci/unit.sh index cd9af714..c958e8ca 100755 --- a/ci/unit.sh +++ b/ci/unit.sh @@ -1,7 +1,9 @@ #!/bin/bash set -euo pipefail +dn=$(dirname $0) +. ${dn}/libbuild.sh + ci/installdeps.sh ci/install-extra-builddeps.sh -export PATH="$HOME/.cargo/bin:$PATH" ci/build.sh