From 3763099835a202bb52a6d5db7b8e9c89261aec7a Mon Sep 17 00:00:00 2001 From: garciadeblas Date: Tue, 9 May 2023 13:33:22 +0200 Subject: [PATCH] Update install_ngsa.sh to use docker registry and user from CICD Change-Id: I33b96d876a0dbe95846b6c6b123438f6fb17f7f0 Signed-off-by: garciadeblas --- installers/full_install_osm.sh | 4 +++- installers/install_ngsa.sh | 14 ++++++++++++-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/installers/full_install_osm.sh b/installers/full_install_osm.sh index c03f57b2..426b79c9 100755 --- a/installers/full_install_osm.sh +++ b/installers/full_install_osm.sh @@ -532,7 +532,9 @@ function deploy_osm_pla_service() { function install_osm_ngsa_service() { [ -z "${DEBUG_INSTALL}" ] || DEBUG beginning of function - $OSM_DEVOPS/installers/install_ngsa.sh -d ${OSM_HELM_WORK_DIR} -D ${OSM_DEVOPS} -t ${OSM_DOCKER_TAG} ${DEBUG_INSTALL} || \ + NGSA_OPTS="-d ${OSM_HELM_WORK_DIR} -D ${OSM_DEVOPS} -t ${OSM_DOCKER_TAG} -U ${DOCKER_USER} ${DEBUG_INSTALL}" + [ -n "${DOCKER_REGISTRY_URL}" ] && NGSA_OPTS="${NGSA_OPTS} -r ${DOCKER_REGISTRY_URL}" + $OSM_DEVOPS/installers/install_ngsa.sh ${NGSA_OPTS} || \ FATAL_TRACK install_osm_ngsa_service "install_ngsa.sh failed" [ -z "${DEBUG_INSTALL}" ] || DEBUG end of function } diff --git a/installers/install_ngsa.sh b/installers/install_ngsa.sh index 151b6860..c8db90e8 100755 --- a/installers/install_ngsa.sh +++ b/installers/install_ngsa.sh @@ -29,6 +29,8 @@ function install_airflow() { # update airflow-values.yaml to use the right tag echo "Updating Helm values file helm/values/airflow-values.yaml to use defaultAirflowTag: ${OSM_DOCKER_TAG}" sudo sed -i "s#defaultAirflowTag:.*#defaultAirflowTag: ${OSM_DOCKER_TAG}#g" ${OSM_HELM_WORK_DIR}/airflow-values.yaml + echo "Updating Helm values file helm/values/airflow-values.yaml to use the right image: ${DOCKER_REGISTRY_URL}${DOCKER_USER}/airflow" + sudo sed -i "s#defaultAirflowRepository:-*#defaultAirflowRepository: ${DOCKER_REGISTRY_URL}${DOCKER_USER}/airflow#g" ${OSM_HELM_WORK_DIR}/airflow-values.yaml if ! helm -n osm status airflow 2> /dev/null ; then # if it does not exist, create secrets and install kubectl -n osm create secret generic airflow-webserver-secret --from-literal="webserver-secret-key=$(python3 -c 'import secrets; print(secrets.token_hex(16))')" @@ -80,11 +82,13 @@ function install_prometheus_alertmanager() { # main +DOCKER_REGISTRY_URL= +DOCKER_USER="opensourcemano" OSM_DEVOPS="/usr/share/osm-devops" -OSM_HELM_WORK_DIR="/etc/osm/helm" OSM_DOCKER_TAG="13" +OSM_HELM_WORK_DIR="/etc/osm/helm" -while getopts ":D:d:t:-: " o; do +while getopts ":D:d:t:r:U:-: " o; do case "${o}" in D) OSM_DEVOPS="${OPTARG}" @@ -95,6 +99,12 @@ while getopts ":D:d:t:-: " o; do t) OSM_DOCKER_TAG="${OPTARG}" ;; + r) + DOCKER_REGISTRY_URL="${OPTARG}" + ;; + U) + DOCKER_USER="${OPTARG}" + ;; -) [ "${OPTARG}" == "debug" ] && DEBUG_INSTALL="y" && continue echo -e "Invalid option: '--$OPTARG'\n" >&2 -- 2.25.1