1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-07-30 19:23:07 +03:00

chore(CI): make createrepo step resilient to one of build or cmapi build steps fails

This commit is contained in:
aleksei.bukhalov
2025-05-06 16:35:33 +02:00
committed by Leonid Fedorov
parent 8bbf373b43
commit 39c8126548
2 changed files with 37 additions and 11 deletions

View File

@ -580,7 +580,7 @@ local Pipeline(branch, platform, event, arch='amd64', server='10.6-enterprise')
},
cmapitest:: {
name: 'cmapi test',
depends_on: ['publish cmapi build', 'smoke'],
depends_on: ['publish cmapi build'],
image: 'docker:git',
volumes: [pipeline._volumes.docker],
environment: {
@ -728,9 +728,12 @@ local Pipeline(branch, platform, event, arch='amd64', server='10.6-enterprise')
name: 'createrepo',
depends_on: ['build', 'cmapi build'],
image: img,
when: {
status: ['success', 'failure'],
},
volumes: [pipeline._volumes.mdb],
commands: [
'bash /mdb/' + builddir + '/storage/columnstore/columnstore/build/createrepo.sh --distro ' + platform,
'bash /mdb/' + builddir + '/storage/columnstore/columnstore/build/createrepo.sh --distro ' + platform,
],
},
{

View File

@ -7,19 +7,17 @@ set -eo pipefail
SCRIPT_LOCATION=$(dirname "$0")
source "$SCRIPT_LOCATION"/utils.sh
optparse.define short=D long=distro desc="OS" variable=OS
source $(optparse.build)
echo "Arguments received: $@"
BUILDDIR="verylongdirnameforverystrangecpackbehavior";
BUILDDIR="verylongdirnameforverystrangecpackbehavior"
COLUMNSTORE_RPM_PACKAGES_PATH="/mdb/${BUILDDIR}/*.rpm"
CMAPI_RPM_PACKAGES_PATH="/mdb/${BUILDDIR}/storage/columnstore/columnstore/cmapi/*.rpm"
COLUMNSTORE_DEB_PACKAGES_PATH="/mdb/*.deb"
CMAPI_DEB_PACKAGES_PATH="/mdb/${BUILDDIR}/storage/columnstore/columnstore/cmapi/*.deb"
RESULT=$(echo "$OS" | sed 's/://g' | sed 's/\//-/g')
if [ "$EUID" -ne 0 ]; then
error "Please run script as root"
@ -27,10 +25,12 @@ if [ "$EUID" -ne 0 ]; then
fi
if [[ -z "${OS:-}" ]]; then
echo "Please provide provide --distro parameter, e.g. ./createrepo.sh --distro ubuntu:24.04"
echo "Please provide --distro parameter, e.g. ./createrepo.sh --distro ubuntu:24.04"
exit 1
fi
RESULT=$(echo "$OS" | sed 's/://g' | sed 's/\//-/g')
pkg_format="deb"
if [[ "$OS" == *"rocky"* ]]; then
pkg_format="rpm"
@ -38,17 +38,40 @@ fi
cd "/mdb/${BUILDDIR}"
if ! compgen -G "/mdb/${BUILDDIR}/*.rpm" > /dev/null \
&& ! compgen -G "/mdb/${BUILDDIR}/storage/columnstore/columnstore/cmapi/*.rpm" > /dev/null \
&& ! compgen -G "/mdb/${BUILDDIR}/*.deb" > /dev/null \
&& ! compgen -G "/mdb/${BUILDDIR}/storage/columnstore/columnstore/cmapi/*.deb" > /dev/null
then
echo "None of the cmapi or columnstore packages found. Failing!"
exit 1
fi
echo "Adding columnstore packages to repository..."
if [[ "${pkg_format}" == "rpm" && $(compgen -G "$COLUMNSTORE_RPM_PACKAGES_PATH") ]]; then
mv -v $COLUMNSTORE_RPM_PACKAGES_PATH "./${RESULT}/"
elif [[ "${pkg_format}" == "deb" && $(compgen -G "$COLUMNSTORE_DEB_PACKAGES_PATH") ]]; then
mv -v $COLUMNSTORE_DEB_PACKAGES_PATH "./${RESULT}/"
else
echo "Columnstore packages are not found!"
fi
echo "Adding cmapi packages to repository..."
if [[ "${pkg_format}" == "rpm" && $(compgen -G "$CMAPI_RPM_PACKAGES_PATH") ]]; then
mv -v $CMAPI_RPM_PACKAGES_PATH "./${RESULT}/"
elif [[ "${pkg_format}" == "deb" && $(compgen -G "$CMAPI_DEB_PACKAGES_PATH") ]]; then
mv -v $CMAPI_DEB_PACKAGES_PATH "./${RESULT}/"
else
echo "Cmapi packages are not found!"
fi
if [[ "${pkg_format}" == "rpm" ]]; then
dnf install -q -y createrepo
mv -v ${COLUMNSTORE_RPM_PACKAGES_PATH} ${CMAPI_RPM_PACKAGES_PATH} "./${RESULT}/"
createrepo "./${RESULT}"
else
apt update && apt install -y dpkg-dev
mv -v ${COLUMNSTORE_DEB_PACKAGES_PATH} ${CMAPI_DEB_PACKAGES_PATH} "./${RESULT}/"
dpkg-scanpackages "${RESULT}" | gzip > "./${RESULT}/Packages.gz"
fi
mkdir -p "/drone/src/${RESULT}"
cp -vrf "./${RESULT}" "/drone/src/${RESULT}"
cp -vrf "./${RESULT}/." "/drone/src/${RESULT}"