From 0b1c75c675ced98bbe166e9f8ced61af04b335b0 Mon Sep 17 00:00:00 2001 From: garciadeblas Date: Tue, 11 Nov 2025 23:04:39 +0100 Subject: [PATCH] Feature 11077: new option to install specific components with a specific tag from CICD Change-Id: Id49c65d3f22e123d7e4ad3c83cf93df2281ea6ad Signed-off-by: garciadeblas --- installers/00-default-install-options.rc | 1 + installers/01-export-osm-install-options.sh | 1 + installers/40-deploy-osm.sh | 19 +++++++++++++++++++ installers/full_install_osm.sh | 17 +++++++++++++++-- installers/install_osm.sh | 5 +++-- 5 files changed, 39 insertions(+), 4 deletions(-) diff --git a/installers/00-default-install-options.rc b/installers/00-default-install-options.rc index 59ee5494..6159a524 100644 --- a/installers/00-default-install-options.rc +++ b/installers/00-default-install-options.rc @@ -33,6 +33,7 @@ export DOCKER_REGISTRY_USER= export DOCKER_REGISTRY_PASSWORD= export DOCKER_REGISTRY_URL= export DOCKER_PROXY_URL= +export MODULES_FOR_TESTING= export MODULE_DOCKER_TAG= export OSM_CLIENT_VERSION="master" export OSM_IM_VERSION="master" diff --git a/installers/01-export-osm-install-options.sh b/installers/01-export-osm-install-options.sh index 7fa03021..a69eb640 100755 --- a/installers/01-export-osm-install-options.sh +++ b/installers/01-export-osm-install-options.sh @@ -49,6 +49,7 @@ export DOCKER_REGISTRY_USER=${DOCKER_REGISTRY_USER} export DOCKER_REGISTRY_PASSWORD=${DOCKER_REGISTRY_PASSWORD} export DOCKER_REGISTRY_URL=${DOCKER_REGISTRY_URL} export DOCKER_PROXY_URL=${DOCKER_PROXY_URL} +export MODULES_FOR_TESTING=${MODULES_FOR_TESTING} export MODULE_DOCKER_TAG=${MODULE_DOCKER_TAG} export OSM_CLIENT_VERSION=${OSM_CLIENT_VERSION} export OSM_IM_VERSION=${OSM_IM_VERSION} diff --git a/installers/40-deploy-osm.sh b/installers/40-deploy-osm.sh index 9d032cf8..492471f8 100755 --- a/installers/40-deploy-osm.sh +++ b/installers/40-deploy-osm.sh @@ -122,6 +122,25 @@ if [ -n "${OSM_BEHIND_PROXY}" ]; then fi fi +# Only applicable to OSM CICD pipeline +# Test specific modules specified in MODULES_FOR_TESTING, using docker tag MODULE_DOCKER_TAG +if [ -n "${MODULES_FOR_TESTING}" ]; then + for module in MON NBI RO LCM KEYSTONE NGUI NG-SA prometheus webhookTranslator; do + if echo ${MODULES_FOR_TESTING} | grep -q ${module} ; then + if [ "${module}" == "NG-SA" ]; then + OSM_HELM_OPTS="${OSM_HELM_OPTS} --set-string airflow.defaultAirflowTag=${MODULE_DOCKER_TAG}" + elif [ "${module}" == "prometheus" ]; then + OSM_HELM_OPTS="${OSM_HELM_OPTS} --set prometheus.server.sidecarContainers.prometheus-config-sidecar.image=${DOCKER_REGISTRY_URL}${DOCKER_USER}/prometheus:${OSM_DOCKER_TAG}" + else + # For the rest of cases, set the image tag normally + helm_entry=${module,,} + echo "Setting custom docker tag ${MODULE_DOCKER_TAG} for module ${module} in helm options" + OSM_HELM_OPTS="${OSM_HELM_OPTS} --set ${helm_entry}.image.tag=${MODULE_DOCKER_TAG}" + fi + fi + done +fi + echo "helm upgrade --install -n $OSM_NAMESPACE --create-namespace $OSM_HELM_RELEASE ${HERE}/helm/osm ${OSM_HELM_OPTS}" helm upgrade --install -n $OSM_NAMESPACE --create-namespace $OSM_HELM_RELEASE ${HERE}/helm/osm ${OSM_HELM_OPTS} # Override existing values.yaml with the final values.yaml used to install OSM diff --git a/installers/full_install_osm.sh b/installers/full_install_osm.sh index 35a9d9eb..589fffab 100755 --- a/installers/full_install_osm.sh +++ b/installers/full_install_osm.sh @@ -35,7 +35,8 @@ function usage(){ echo -e " -s namespace where OSM helm chart will be deployed (default is osm)" echo -e " -d use docker registry URL instead of dockerhub" echo -e " -p set docker proxy URL as part of docker CE configuration" - echo -e " -T specify docker tag for the modules specified with option -m" + echo -e " -m : module to test a specific docker image (NG-UI, NBI, LCM, RO, MON) (can be used several times)" + echo -e " -T use specific docker tag for the module specified with option -m" echo -e " -U : specify docker user to use when pulling images from a private registry" echo -e " -D : use particular devops installation path" echo -e " -e : set the external IP address of the OSM cluster (default is empty, which means autodetect)" @@ -51,7 +52,7 @@ echo "Load default options and export user installation options" source $OSM_DEVOPS/installers/00-default-install-options.rc RE_CHECK='^[a-z0-9]([-a-z0-9]*[a-z0-9])?$' -while getopts ":a:c:e:r:k:u:R:D:s:t:U:d:p:T:M:G:O:-: hy" o; do +while getopts ":a:c:e:r:k:u:R:D:s:t:U:d:p:m:T:M:G:O:-: hy" o; do case "${o}" in a) APT_PROXY_URL=${OPTARG} @@ -101,6 +102,18 @@ while getopts ":a:c:e:r:k:u:R:D:s:t:U:d:p:T:M:G:O:-: hy" o; do p) DOCKER_PROXY_URL="${OPTARG}" ;; + m) + [ "${OPTARG}" == "NG-UI" ] && MODULES_FOR_TESTING="$MODULES_FOR_TESTING NGUI" && continue + [ "${OPTARG}" == "NBI" ] && MODULES_FOR_TESTING="$MODULES_FOR_TESTING NBI" && continue + [ "${OPTARG}" == "LCM" ] && MODULES_FOR_TESTING="$MODULES_FOR_TESTING LCM" && continue + [ "${OPTARG}" == "RO" ] && MODULES_FOR_TESTING="$MODULES_FOR_TESTING RO" && continue + [ "${OPTARG}" == "MON" ] && MODULES_FOR_TESTING="$MODULES_FOR_TESTING MON" && continue + [ "${OPTARG}" == "NG-SA" ] && MODULES_FOR_TESTING="$MODULES_FOR_TESTING NG-SA" && continue + [ "${OPTARG}" == "osmclient" ] && MODULES_FOR_TESTING="$MODULES_FOR_TESTING osmclient" && continue + [ "${OPTARG}" == "prometheus" ] && MODULES_FOR_TESTING="$MODULES_FOR_TESTING prometheus" && continue + [ "${OPTARG}" == "webhookTranslator" ] && MODULES_FOR_TESTING="$MODULES_FOR_TESTING webhookTranslator" && continue + [ "${OPTARG}" == "keystone" ] && MODULES_FOR_TESTING="$MODULES_FOR_TESTING keystone" && continue + ;; T) MODULE_DOCKER_TAG="${OPTARG}" ;; diff --git a/installers/install_osm.sh b/installers/install_osm.sh index 870de5c6..f007bd9f 100755 --- a/installers/install_osm.sh +++ b/installers/install_osm.sh @@ -42,7 +42,8 @@ function usage(){ echo -e " -K: Specifies the name of the controller to use - The controller must be already bootstrapped" echo -e " -d use docker registry URL instead of dockerhub" echo -e " -p set docker proxy URL as part of docker CE configuration" - echo -e " -T specify docker tag for the modules specified with option -m" + echo -e " -m : module to test a specific docker image (NG-UI, NBI, LCM, RO, MON) (can be used several times)" + echo -e " -T use specific docker tag for the module specified with option -m" echo -e " --debug: debug mode" echo -e " --uninstall: uninstall OSM: remove the containers and delete NAT rules" } @@ -100,7 +101,7 @@ EOF" [ -z "${DEBUG_INSTALL}" ] || DEBUG end of function } -while getopts ":a:c:e:r:k:u:R:D:s:t:U:d:p:T:M:G:O:-: hy" o; do +while getopts ":a:c:e:r:k:u:R:D:s:t:U:d:p:m:T:M:G:O:-: hy" o; do case "${o}" in D) DEVOPS_PATH="${OPTARG}" -- 2.25.1