Skip to content

Commit

Permalink
KIECLOUD-659 - Add nightly build for ba-operator /2
Browse files Browse the repository at this point in the history
Signed-off-by: Davide Salerno <dsalerno@redhat.com>
  • Loading branch information
davidesalerno committed Mar 1, 2023
1 parent 5dd1ca2 commit e79ba68
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 48 deletions.
23 changes: 20 additions & 3 deletions hack/build-osbs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ DEBUG=
GIT_USER=${GIT_USER:-"Your Name"}
GIT_EMAIL=${GIT_EMAIL:-"yourname@email.com"}
WORK_DIR=$(pwd)/build-temp
CEKIT_RESPOND_YES=true

export CEKIT_OSBS_BUILD=true
export CEKIT_RESPOND_YES=true

function help()
{
Expand All @@ -23,6 +25,7 @@ function help()
echo ""
echo "Optional:"
echo " -h Print this help message"
echo " -c COMPONENT Component for which an image is being built."
echo " -p KERBEROS_PRINCIPAL Kerberos principal to use with to access build systems. If not specified,"
echo " the script assumes there is a valid kerberos ticket in force. If it is specified"
echo " then one of KERBEROS_KEYTAB or KERBEROS_PASSWORD is required."
Expand All @@ -36,6 +39,7 @@ function help()
echo " -e GIT_EMAIL Email config for git commits to internal repositories. Default is 'yourname@email.com'"
echo " -o CEKIT_BUILD_OPTIONS Additional options to pass through to the cekit build command, should be quoted"
echo " -l CEKIT_CACHE_LOCAL Comma-separated list of urls to download and add to the local cekit cache"
echo " -d CEKIT_OSBS_SUBDIR The cekit local directory for the OSBS content (on Jenkins it should be /home/jenkins/.cekit/osbs/containers/rhpam-7-operator)"
echo " -g Debug setting, currently sets verbose flag on cekit commands"
}

Expand Down Expand Up @@ -108,7 +112,7 @@ function set_git_config() {
}


while getopts gu:e:v:t:o:r:n:d:p:k:s:b:l:i:w:h option; do
while getopts gu:e:v:c:t:o:r:n:d:p:k:s:b:l:i:w:h option; do
case $option in
g)
DEBUG=true
Expand All @@ -122,6 +126,9 @@ while getopts gu:e:v:t:o:r:n:d:p:k:s:b:l:i:w:h option; do
v)
PROD_VERSION=$OPTARG
;;
c)
COMPONENT=$OPTARG
;;
t)
OSBS_BUILD_TARGET=$OPTARG
;;
Expand All @@ -143,6 +150,9 @@ while getopts gu:e:v:t:o:r:n:d:p:k:s:b:l:i:w:h option; do
l)
CEKIT_CACHE_LOCAL=$OPTARG
;;
d)
CEKIT_OSBS_SUBDIR=$OPTARG
;;
i)
OSBS_BUILD_USER=$OPTARG
;;
Expand Down Expand Up @@ -187,7 +197,14 @@ if [ -n "$OSBS_BUILD_USER" ]; then
builduser="$OSBS_BUILD_USER"
fi

if [ -n "$CEKIT_OSBS_SUBDIR" ]; then
export OPERATOR_PATH="$CEKIT_OSBS_SUBDIR"
fi

cd ../
git apply hack/image-osbs.patch

COMMIT_HASH=$(git rev-parse HEAD)
sed -i "s/ref:.*/ref: $COMMIT_HASH/g" image-prod.yaml
sed -i "s/rhba-7-rhel-8/rhba-7-rhel-8-nightly/g" image-prod.yaml
# Building the operator
make rhel-nightly
16 changes: 13 additions & 3 deletions hack/go-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,13 @@ OPERATOR_VERSION=$(go run getversion.go -csv)
REGISTRY=quay.io/kiegroup
IMAGE=kie-cloud-operator
TAR=modules/builder/${IMAGE}.tar.gz
OVERRIDE_IMG_DESCRIPTOR=""

URL=${REPO}/archive/${OPERATOR_VERSION}.tar.gz
if [[ -z ${BRANCH_NIGHTLY} ]]; then
BRANCH_NIGHTLY="main"
fi
URL_NIGHTLY=${REPO}/tarball/${BRANCH_NIGHTLY}

CFLAGS="${1}"

Expand All @@ -19,7 +24,7 @@ fi

./hack/go-gen.sh

if [[ -z ${CI} ]]; then
if [[ -z ${CI} || -n ${CEKIT_OSBS_BUILD} ]]; then
echo Now building operator:
echo
if [[ ${2} == "rhel" ]]; then
Expand All @@ -29,16 +34,21 @@ if [[ -z ${CI} ]]; then
CFLAGS+=" --release"
wget -q ${URL} -O ${TAR}
fi
if [[ ${3} == "nightly" ]]; then
OVERRIDE_IMG_DESCRIPTOR=" --descriptor image-prod.yaml"
fi
if [[ ! -z ${CEKIT_RESPOND_YES+z} ]]; then
CFLAGS+=" -y"
fi
fi

echo ${CFLAGS}
cekit --verbose --redhat build \
cekit --verbose ${OVERRIDE_IMG_DESCRIPTOR} --redhat build \
--overrides '{version: '${PRODUCT_VERSION}'}' \
${CFLAGS}
rm ${TAR} 2>&1 /dev/null
if [[ -f ${TAR} ]]; then
rm ${TAR}
fi
else
echo
echo Will build console first:
Expand Down
41 changes: 0 additions & 41 deletions hack/image-osbs.patch

This file was deleted.

4 changes: 3 additions & 1 deletion modules/builder-prod/install
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
go version
export GOFLAGS=-mod=vendor

OPERATOR_PATH=/usr/local/bin/kie-cloud-operator
if [[ -z "$OPERATOR_PATH" ]] ; then
OPERATOR_PATH=/usr/local/bin/kie-cloud-operator
fi
UI_PATH=/usr/local/bin/console-cr-form

cd $REMOTE_SOURCE_DIR/app && pwd
Expand Down

0 comments on commit e79ba68

Please sign in to comment.