From 1c5cfd13061d789519daa217756b83021a8362a1 Mon Sep 17 00:00:00 2001 From: Zack Cerza Date: Wed, 27 Nov 2024 12:58:11 -0700 Subject: [PATCH] ceph-*build: move container build to separate script Signed-off-by: Zack Cerza --- ceph-build/config/definitions/ceph-build.yml | 1 + ceph-dev-build/build/build_rpm | 23 -------------- .../config/definitions/ceph-dev-build.yml | 1 + ceph-dev-new-build/build/build_rpm | 24 --------------- ceph-dev-new-build/build/setup_rpm | 4 --- .../config/definitions/ceph-dev-new-build.yml | 1 + scripts/build_container | 30 +++++++++++++++++++ 7 files changed, 33 insertions(+), 51 deletions(-) create mode 100755 scripts/build_container diff --git a/ceph-build/config/definitions/ceph-build.yml b/ceph-build/config/definitions/ceph-build.yml index c7cd1b4d..30dc290e 100644 --- a/ceph-build/config/definitions/ceph-build.yml +++ b/ceph-build/config/definitions/ceph-build.yml @@ -101,6 +101,7 @@ - ../../../scripts/build_utils.sh - ../../build/setup_rpm - ../../build/build_rpm + - ../../../scripts/build_container - ../../../scripts/status_completed publishers: - postbuildscript: diff --git a/ceph-dev-build/build/build_rpm b/ceph-dev-build/build/build_rpm index c2bb23b0..06116874 100644 --- a/ceph-dev-build/build/build_rpm +++ b/ceph-dev-build/build/build_rpm @@ -81,26 +81,3 @@ EOF echo Check the status of the repo at: https://shaman.ceph.com/api/repos/${chacra_endpoint}/flavors/${FLAVOR}/ fi - -# XXX perhaps use job parameters instead of literals; then -# later stages can also use them to compare etc. -if [[ "$CI_CONTAINER" == true && $DISTRO == "centos" && "$RELEASE" =~ 8|9 ]] ; then - loop=0 - ready=false - while ((loop < 15)); do - curl -s "https://shaman.ceph.com/api/search/?project=ceph&distros=centos/${RELEASE}/${ARCH}&sha1=${SHA1}&ref=${BRANCH}&flavor=${FLAVOR}" > shaman.status - if [[ ($(jq -r '.[0].extra.build_url' < shaman.status) == ${BUILD_URL}) && ($(jq -r '.[0].status' < shaman.status) == 'ready') ]] ; then ready=true; break; fi - ((loop = loop + 1)) - sleep 60 - done - - if [[ "$ready" == "false" ]] ; then - echo "FAIL: timed out waiting for shaman repo to be built: https://shaman.ceph.com/api/repos/${chacra_endpoint}/flavors/${FLAVOR}/" - # don't fail the build here on purpose - # update_build_status "failed" "ceph" $NORMAL_DISTRO $NORMAL_DISTRO_VERSION $NORMAL_ARCH - # exit 1 - fi - # get into $WORKSPACE/$dist/ceph-$cephver, where the copied source tree is - cd ${WORKSPACE}/dist/ceph-${cephver}/container - CEPH_SHA1=${SHA1} ./build.sh -fi diff --git a/ceph-dev-build/config/definitions/ceph-dev-build.yml b/ceph-dev-build/config/definitions/ceph-dev-build.yml index da0733a5..df4e71da 100644 --- a/ceph-dev-build/config/definitions/ceph-dev-build.yml +++ b/ceph-dev-build/config/definitions/ceph-dev-build.yml @@ -92,6 +92,7 @@ - ../../../scripts/build_utils.sh - ../../build/setup_rpm - ../../build/build_rpm + - ../../../scripts/build_container - ../../../scripts/status_completed # osc build scripts - shell: diff --git a/ceph-dev-new-build/build/build_rpm b/ceph-dev-new-build/build/build_rpm index 142c520d..da72c25a 100644 --- a/ceph-dev-new-build/build/build_rpm +++ b/ceph-dev-new-build/build/build_rpm @@ -84,27 +84,3 @@ EOF echo Check the status of the repo at: https://shaman.ceph.com/api/repos/${chacra_endpoint}/flavors/${FLAVOR}/ fi - -# XXX perhaps use job parameters instead of literals; then -# later stages can also use them to compare etc. -# build container image that supports building crimson-osd -if [[ $CI_CONTAINER == "true" && $DISTRO == "centos" && "$RELEASE" =~ 8|9 ]] ; then - loop=0 - ready=false - while ((loop < 15)); do - curl -s "https://shaman.ceph.com/api/search/?project=ceph&distros=centos/${RELEASE}/${ARCH}&sha1=${SHA1}&ref=${BRANCH}&flavor=${FLAVOR}" > shaman.status - if [[ ($(jq -r '.[0].extra.build_url' < shaman.status) == ${BUILD_URL}) && ($(jq -r '.[0].status' < shaman.status) == 'ready') ]] ; then ready=true; break; fi - ((loop = loop + 1)) - sleep 60 - done - - if [[ "$ready" == "false" ]] ; then - echo "FAIL: timed out waiting for shaman repo to be built: https://shaman.ceph.com/api/repos/${chacra_endpoint}/flavors/${FLAVOR}/" - # don't fail the build here on purpose - # update_build_status "failed" "ceph" $NORMAL_DISTRO $NORMAL_DISTRO_VERSION $NORMAL_ARCH - # exit 1 - fi - # get into $WORKSPACE/$dist/ceph-$cephver, where the copied source tree is - cd ${WORKSPACE}/dist/ceph-${cephver}/container - CEPH_SHA1=${SHA1} ./build.sh -fi diff --git a/ceph-dev-new-build/build/setup_rpm b/ceph-dev-new-build/build/setup_rpm index 8a6908b6..068597ce 100644 --- a/ceph-dev-new-build/build/setup_rpm +++ b/ceph-dev-new-build/build/setup_rpm @@ -44,10 +44,6 @@ pwd setup_rpm_build_deps -if [[ $CI_CONTAINER == "true" && $DISTRO == "centos" && "$RELEASE" =~ 8|9 ]] ; then - podman login -u $CONTAINER_REPO_USERNAME -p $CONTAINER_REPO_PASSWORD $CONTAINER_REPO_HOSTNAME/$CONTAINER_REPO_ORGANIZATION -fi - cd $WORKSPACE pkgs=( "chacractl>=0.0.21" ) diff --git a/ceph-dev-new-build/config/definitions/ceph-dev-new-build.yml b/ceph-dev-new-build/config/definitions/ceph-dev-new-build.yml index 1ddba7ee..a6a56034 100644 --- a/ceph-dev-new-build/config/definitions/ceph-dev-new-build.yml +++ b/ceph-dev-new-build/config/definitions/ceph-dev-new-build.yml @@ -100,6 +100,7 @@ - ../../../scripts/setup_sccache.sh - ../../build/setup_rpm - ../../build/build_rpm + - ../../../scripts/build_container - ../../../scripts/status_completed # osc build scripts - shell: diff --git a/scripts/build_container b/scripts/build_container new file mode 100755 index 00000000..5ac6087b --- /dev/null +++ b/scripts/build_container @@ -0,0 +1,30 @@ +#!/bin/bash +# vim: ts=4 sw=4 expandtab +set -ex +PS4="\$(date --rfc-3339=seconds) + " + +# XXX perhaps use job parameters instead of literals; then +# later stages can also use them to compare etc. +# build container image that supports building crimson-osd +if [[ $CI_CONTAINER == "true" && $DISTRO == "centos" && "$RELEASE" =~ 8|9 ]] ; then + podman login -u $CONTAINER_REPO_USERNAME -p $CONTAINER_REPO_PASSWORD $CONTAINER_REPO_HOSTNAME/$CONTAINER_REPO_ORGANIZATION + loop=0 + ready=false + while ((loop < 15)); do + curl -s "https://shaman.ceph.com/api/search/?project=ceph&distros=centos/${RELEASE}/${ARCH}&sha1=${SHA1}&ref=${BRANCH}&flavor=${FLAVOR}" > shaman.status + if [[ ($(jq -r '.[0].extra.build_url' < shaman.status) == ${BUILD_URL}) && ($(jq -r '.[0].status' < shaman.status) == 'ready') ]] ; then ready=true; break; fi + ((loop = loop + 1)) + sleep 60 + done + + if [[ "$ready" == "false" ]] ; then + chacra_endpoint="ceph/${BRANCH}/${SHA1}/${DISTRO}/${RELEASE}" + echo "FAIL: timed out waiting for shaman repo to be built: https://shaman.ceph.com/api/repos/${chacra_endpoint}/flavors/${FLAVOR}/" + # don't fail the build here on purpose + # update_build_status "failed" "ceph" $NORMAL_DISTRO $NORMAL_DISTRO_VERSION $NORMAL_ARCH + # exit 1 + fi + # get into $WORKSPACE/$dist/ceph-$cephver, where the copied source tree is + cd ${WORKSPACE}/dist/ceph-${cephver}/container + CEPH_SHA1=${SHA1} ./build.sh +fi -- 2.39.5