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.
This commit is contained in:
Colin Walters 2021-02-03 20:54:24 +00:00 committed by OpenShift Merge Robot
parent 6fcfaee948
commit 7268ac9875
8 changed files with 26 additions and 26 deletions

View File

@ -5,22 +5,9 @@ parallel rpms: {
def n = 5 def n = 5
cosaPod(buildroot: true, runAsUser: 0, memory: "2Gi", cpu: "${n}") { cosaPod(buildroot: true, runAsUser: 0, memory: "2Gi", cpu: "${n}") {
checkout scm checkout scm
shwrap(""" shwrap("""RPM_BUILD_NCPUS=${n} ./ci/coreosci-rpmbuild.sh
# fetch tags so `git describe` gives a nice NEVRA when building the RPM mv packaging/*/*.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') ..
""")
// make it easy for anyone to download the RPMs // make it easy for anyone to download the RPMs
archiveArtifacts '*.rpm' archiveArtifacts '*.rpm'
stash excludes: '*.src.rpm', includes: '*.rpm', name: 'rpms' stash excludes: '*.src.rpm', includes: '*.rpm', name: 'rpms'

View File

@ -7,9 +7,5 @@ set -xeuo pipefail
dn=$(dirname $0) dn=$(dirname $0)
. ${dn}/libbuild.sh . ${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 ${dn}/build.sh
make check make check

View File

@ -7,7 +7,6 @@ dn=$(dirname $0)
. ${dn}/libbuild.sh . ${dn}/libbuild.sh
${dn}/install-extra-builddeps.sh ${dn}/install-extra-builddeps.sh
export PATH="$HOME/.cargo/bin:$PATH"
${dn}/installdeps.sh ${dn}/installdeps.sh
# make it clear what rustc version we're compiling with (this is grepped in CI) # make it clear what rustc version we're compiling with (this is grepped in CI)
rustc --version rustc --version

View File

@ -7,10 +7,6 @@ set -xeuo pipefail
dn=$(dirname $0) dn=$(dirname $0)
. ${dn}/libbuild.sh . ${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++ export CC=clang CXX=clang++
${dn}/build.sh ${dn}/build.sh
make check make check

View File

@ -2,5 +2,6 @@
set -xeuo pipefail set -xeuo pipefail
# Add cheap (non-building) checks here # Add cheap (non-building) checks here
dn=$(dirname $0) dn=$(dirname $0)
. ${dn}/libbuild.sh
${dn}/codestyle.sh ${dn}/codestyle.sh
${dn}/ci-commitmessage-submodules.sh ${dn}/ci-commitmessage-submodules.sh

17
ci/coreosci-rpmbuild.sh Executable file
View File

@ -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

View File

@ -5,6 +5,8 @@
if test -z "$HOME" || test ! -w "$HOME"; then if test -z "$HOME" || test ! -w "$HOME"; then
export HOME=$(mktemp -d -t --suffix .prowhome) export HOME=$(mktemp -d -t --suffix .prowhome)
fi fi
# In some cases we install tools via cargo, ensure that's in PATH
export PATH="$HOME/.cargo/bin:$PATH"
pkg_upgrade() { pkg_upgrade() {
echo "Running dnf -y distro-sync... $(date)" echo "Running dnf -y distro-sync... $(date)"

View File

@ -1,7 +1,9 @@
#!/bin/bash #!/bin/bash
set -euo pipefail set -euo pipefail
dn=$(dirname $0)
. ${dn}/libbuild.sh
ci/installdeps.sh ci/installdeps.sh
ci/install-extra-builddeps.sh ci/install-extra-builddeps.sh
export PATH="$HOME/.cargo/bin:$PATH"
ci/build.sh ci/build.sh