From 9e01ea9ebe8e1102c651ed541a2de0aaf0ede071 Mon Sep 17 00:00:00 2001 From: Riken Maharjan <106988478+rikenm1@users.noreply.github.com> Date: Wed, 18 Sep 2024 09:33:06 -0700 Subject: [PATCH] [2.0] Use Toolchain RPMS when building Golden Container (#10473) --- .../scripts/BuildGoldenContainer.sh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/.pipelines/containerSourceData/scripts/BuildGoldenContainer.sh b/.pipelines/containerSourceData/scripts/BuildGoldenContainer.sh index 58f7aeaf45..911eb2c415 100755 --- a/.pipelines/containerSourceData/scripts/BuildGoldenContainer.sh +++ b/.pipelines/containerSourceData/scripts/BuildGoldenContainer.sh @@ -57,7 +57,7 @@ set -e # -j OUTPUT -k ./rpms.tar.gz -l ~/CBL-Mariner/.pipelines/containerSourceData \ # -m "false" -n "false" -p development -q "false" -u "true" -while getopts ":a:b:c:d:e:f:g:h:i:j:k:l:m:n:o:p:q:r:s:t:u:v:" OPTIONS; do +while getopts ":a:b:c:d:e:f:g:h:i:j:k:l:m:n:o:p:q:r:s:t:u:v:w:" OPTIONS; do case ${OPTIONS} in a ) BASE_IMAGE_NAME_FULL=$OPTARG;; b ) ACR=$OPTARG;; @@ -81,6 +81,7 @@ while getopts ":a:b:c:d:e:f:g:h:i:j:k:l:m:n:o:p:q:r:s:t:u:v:" OPTIONS; do t ) SBOM_SCRIPT=$OPTARG;; u ) DISTROLESS=$OPTARG;; v ) VERSION_EXTRACT_CMD=$OPTARG;; + w ) TOOLCHAIN_RPMS_TARBALL=$OPTARG;; \? ) echo "Error - Invalid Option: -$OPTARG" 1>&2 @@ -124,6 +125,7 @@ function print_inputs { echo "SBOM_TOOL_PATH -> $SBOM_TOOL_PATH" echo "SBOM_SCRIPT -> $SBOM_SCRIPT" echo "DISTROLESS -> $DISTROLESS" + echo "TOOLCHAIN_RPMS_TARBALL -> $TOOLCHAIN_RPMS_TARBALL" } function validate_inputs { @@ -167,6 +169,11 @@ function validate_inputs { exit 1 fi + if [[ ! -f $TOOLCHAIN_RPMS_TARBALL ]]; then + echo "Error - No TOOLCHAIN_RPMS_TARBALL tarball found." + exit 1 + fi + if [ ! -d "$CONTAINER_SRC_DIR" ]; then echo "Error - Container source directory does not exist." exit 1 @@ -262,6 +269,7 @@ function prepare_docker_directory { # Copy files into docker context directory tar -xf "$RPMS_TARBALL" -C "$HOST_MOUNTED_DIR"/ + tar -xf "$TOOLCHAIN_RPMS_TARBALL" -C "$HOST_MOUNTED_DIR/RPMS"/ cp -v "$CONTAINER_SRC_DIR/marinerLocalRepo.repo" "$HOST_MOUNTED_DIR"/ }