Helm upgrade --install used and yq installed using binary rather than snap. 42/14442/6
authorymarselino <m11202819@gapps.ntust.edu.tw>
Mon, 9 Jun 2025 15:13:52 +0000 (23:13 +0800)
committerAravindhan Ayyanathan <aravindhan.a@est.tech>
Fri, 13 Jun 2025 10:05:14 +0000 (10:05 +0000)
UPDATES:
- Replace `helm install` to `helm upgrade --install` (proceed when ns
  exist)
- Install `yq` by download the binary instead of snap (no snap in
  container)
- Jenkins pipeline env.REPO

Change-Id: I346617ee9f593d16a9afcd5bbce397005899ee30
Signed-off-by: ymarselino <m11202819@gapps.ntust.edu.tw>
13 files changed:
bin/deploy-nonrtric
smo-install/jenkins/gerrit/manual-start-pipeline
smo-install/jenkins/gerrit/manual-stop-pipeline
smo-install/scripts/sub-scripts/install-cicd.sh
smo-install/scripts/sub-scripts/install-nonrtric.sh
smo-install/scripts/sub-scripts/install-onap.sh
smo-install/scripts/sub-scripts/install-simulators.sh
smo-install/scripts/sub-scripts/install-smo.sh
smo-install/scripts/sub-scripts/postconfigure-smo.sh
smo-install/scripts/sub-scripts/preconfigure-smo.sh
smo-install/test/pythonsdk/src/orantests/network_slicing/preparation/ns_simulators.py
smo-install/test/pythonsdk/src/orantests/oran_tests/smo/network_simulators.py
smo-install/test/pythonsdk/src/orantests/oran_tests/test_cl_k8s.py

index 5a11778..5bc9002 100755 (executable)
@@ -52,7 +52,10 @@ fi
 
 if ! command -v yq > /dev/null 2>&1; then
     echo "yq is not installed. Installing yq..."
-    sudo snap install yq --channel=v4/stable
+    ARCH=$(case $(uname -m) in x86_64) echo "amd64";; aarch64) echo "arm64";; *) uname -m;; esac)
+    VERSION="v4.45.4"
+    wget https://github.com/mikefarah/yq/releases/download/${VERSION}/yq_linux_${ARCH} -O /usr/local/bin/yq
+    chmod +x /usr/local/bin/yq
 fi
 
 INSTALL_KONG=$(cat $OVERRIDEYAML | yq e '.nonrtric.installKong' -)
index b0ca315..9c62031 100644 (file)
@@ -16,7 +16,7 @@ podTemplate(yaml: '''
     def proxies=''
     stage('Checkout') {
       echo 'printenv'
-      checkout scm: [$class: 'GitSCM', userRemoteConfigs: [[url: 'https://gerrit.o-ran-sc.org/r/it/dep']], branches: [[name: env.BRANCH]], extensions: [[$class: 'SubmoduleOption', recursiveSubmodules: true]]], poll: false
+      checkout scm: [$class: 'GitSCM', userRemoteConfigs: [[url: env.REPO]], branches: [[name: env.BRANCH]], extensions: [[$class: 'SubmoduleOption', recursiveSubmodules: true]]], poll: false
     }
       container('jenkins-ubuntu') {
         stage ('Proxy settings') {
index 9e3fbc2..cd0c228 100644 (file)
@@ -1,57 +1,63 @@
-podTemplate(yaml: '''
-              apiVersion: v1
-              kind: Pod
-              spec:
-                containers:
-                - name: jenkins-ubuntu
-                  image: ubuntu:20.04
-                  command:
-                  - sleep
-                  args: 
-                  - 99d
-''') {
-
-  node(POD_LABEL) {
-    def proxies=''
-    stage('Checkout') {
-      checkout scm: [$class: 'GitSCM', userRemoteConfigs: [[url: 'https://gerrit.o-ran-sc.org/r/it/dep']], branches: [[name: env.BRANCH]], extensions: [[$class: 'SubmoduleOption', recursiveSubmodules: true]]], poll: false
-    }
-      container('jenkins-ubuntu') {
-        stage ('Proxy settings') {
-          echo 'Proxy check'
-          script {
-            if (env.http_proxy) {
-              sh 'echo \'Acquire::http::Proxy "' + env.http_proxy + '";\' > /etc/apt/apt.conf.d/proxy.conf'
-              sh 'cat /etc/apt/apt.conf.d/proxy.conf'
-              sh 'echo "http_proxy = "'+env.http_proxy+' > ~/.wgetrc'
-              sh 'cat ~/.wgetrc'
-
-              sh 'echo \'Acquire::https::Proxy "' + env.http_proxy + '";\' >> /etc/apt/apt.conf.d/proxy.conf'
-              sh 'cat /etc/apt/apt.conf.d/proxy.conf'
-              sh 'echo "https_proxy = "'+env.http_proxy+' >> ~/.wgetrc'
-              sh 'cat ~/.wgetrc'
-
-              proxies='HTTPS_PROXY='+env.http_proxy+' '
+lock('smo') {
+    podTemplate(yaml: '''
+                  apiVersion: v1
+                  kind: Pod
+                  spec:
+                    containers:
+                    - name: jenkins-ubuntu
+                      image: ubuntu:20.04
+                      command:
+                      - sleep
+                      args: 
+                      - 99d
+    ''') {
+    
+      node(POD_LABEL) {
+        def proxies=''
+        stage('Checkout') {
+          checkout scm: [$class: 'GitSCM', userRemoteConfigs: [[url: env.REPO]], branches: [[name: env.BRANCH]], extensions: [[$class: 'SubmoduleOption', recursiveSubmodules: true]]], poll: false
+        }
+          container('jenkins-ubuntu') {
+            stage ('Proxy settings') {
+              echo 'Proxy check'
+              script {
+                if (env.http_proxy) {
+                  sh 'echo \'Acquire::http::Proxy "' + env.http_proxy + '";\' > /etc/apt/apt.conf.d/proxy.conf'
+                  sh 'cat /etc/apt/apt.conf.d/proxy.conf'
+                  sh 'echo "http_proxy = "'+env.http_proxy+' > ~/.wgetrc'
+                  sh 'cat ~/.wgetrc'
+    
+                  sh 'echo \'Acquire::https::Proxy "' + env.http_proxy + '";\' >> /etc/apt/apt.conf.d/proxy.conf'
+                  sh 'cat /etc/apt/apt.conf.d/proxy.conf'
+                  sh 'echo "https_proxy = "'+env.http_proxy+' >> ~/.wgetrc'
+                  sh 'cat ~/.wgetrc'
+    
+                  proxies='HTTPS_PROXY='+env.http_proxy+' '
+                }
+              }
+              sh 'printenv'
+            }
+    
+            stage('Setup tools') {
+                sh 'apt-get update -y'
+                sh 'DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt-get -y install tzdata'
+                sh 'apt-get install git wget sudo -y'
+                sh 'wget https://dl.k8s.io/release/v1.22.0/bin/linux/amd64/kubectl'
+                sh 'mv kubectl /usr/bin'
+                sh 'chmod a+x /usr/bin/kubectl'
+                sh 'kubectl version'
+                sh  'cd /tmp && wget https://get.helm.sh/helm-v3.12.3-linux-amd64.tar.gz && pwd'
+                sh  'tar xvfz /tmp/helm-v3.12.3-linux-amd64.tar.gz'
+                sh  'mv linux-amd64/helm /usr/local/bin/helm'
             }
+            stage('Stop SMO') {
+              sh './smo-install/scripts/sub-scripts/uninstall-nonrtric.sh'
+              sh './smo-install/scripts/sub-scripts/uninstall-onap.sh'
+              sh './smo-install/scripts/sub-scripts/uninstall-smo.sh'
+            }
+    
           }
-          sh 'printenv'
-        }
-
-        stage('Setup tools') {
-            sh 'apt-get update -y'
-            sh 'DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt-get -y install tzdata'
-            sh 'apt-get install git wget sudo -y'
-            sh 'wget https://dl.k8s.io/release/v1.22.0/bin/linux/amd64/kubectl'
-            sh 'mv kubectl /usr/bin'
-            sh 'chmod a+x /usr/bin/kubectl'
-            sh 'kubectl version'
-        }
-        stage('Stop SMO') {
-          sh './smo-install/scripts/sub-scripts/uninstall-nonrtric.sh'
-          sh './smo-install/scripts/sub-scripts/uninstall-onap.sh'
-        }
-
+        
       }
-    
-  }
+    }
 }
index a585966..d04e48d 100755 (executable)
@@ -25,4 +25,4 @@
 
 kubectl create namespace tests
 echo  '### Installing ORAN Tests part ###'
-helm install --debug oran-tests-suite local/oran-tests-suite --namespace tests -f $1
+helm upgrade --install --debug oran-tests-suite local/oran-tests-suite --namespace tests -f $1
index 7526b30..7ff3137 100755 (executable)
@@ -29,8 +29,11 @@ echo  '### Installing ORAN NONRTRIC part ###'
 OVERRIDEYAML=$1
 
 if ! command -v yq > /dev/null 2>&1; then
+    ARCH=$(case $(uname -m) in x86_64) echo "amd64";; aarch64) echo "arm64";; *) uname -m;; esac)
+    VERSION="v4.45.4"
     echo "yq is not installed. Installing yq..."
-    sudo snap install yq --channel=v4/stable
+    wget https://github.com/mikefarah/yq/releases/download/${VERSION}/yq_linux_${ARCH} -O /usr/local/bin/yq
+    chmod +x /usr/local/bin/yq
 fi
 
 MODE=$2
@@ -45,7 +48,7 @@ fi
 
 if [ "$MODE" == "dev" ]; then
     echo "Installing NONRTRIC in dev mode"
-    helm install --debug oran-nonrtric local/nonrtric --namespace nonrtric -f $OVERRIDEYAML --set nonrtric.persistence.mountPath="/dockerdata-nfs/deployment-$3" --set kong.kongpv.enabled=$kongPvEnabled
+    helm upgrade --install --debug oran-nonrtric local/nonrtric --namespace nonrtric -f $OVERRIDEYAML --set nonrtric.persistence.mountPath="/dockerdata-nfs/deployment-$3" --set kong.kongpv.enabled=$kongPvEnabled
 else
     echo "Installing NONRTRIC in release mode"
     # This following should be modified once the charts are uploaded and available in the nexus repository
@@ -53,7 +56,7 @@ else
         # helm repo add nonrtric https://nexus3.o-ran-sc.org/repository/smo-helm-snapshots/
         # helm repo update
         # helm install oran-nonrtric nonrtric/nonrtric --namespace nonrtric -f $OVERRIDEYAML --create-namespace
-    helm install oran-nonrtric local/nonrtric --namespace nonrtric -f $OVERRIDEYAML --set nonrtric.persistence.mountPath="/dockerdata-nfs/deployment-$3" --set kong.kongpv.enabled=$kongPvEnabled
+    helm upgrade --install oran-nonrtric local/nonrtric --namespace nonrtric -f $OVERRIDEYAML --set nonrtric.persistence.mountPath="/dockerdata-nfs/deployment-$3" --set kong.kongpv.enabled=$kongPvEnabled
 fi
 
 
index 357b600..5c80490 100755 (executable)
@@ -34,7 +34,7 @@ if [ "$MODE" == "dev" ]; then
     echo "### Installing Strimzi Kafka Operator (Dev Mode) ###"
     helm cm-push ../packages/strimzi-kafka-operator-helm-3-chart-0.45.0.tgz local
     helm repo update
-    helm install strimzi-kafka-operator local/strimzi-kafka-operator --namespace strimzi-system --version 0.45.0 --set watchAnyNamespace=true --create-namespace
+    helm upgrade --install strimzi-kafka-operator local/strimzi-kafka-operator --namespace strimzi-system --version 0.45.0 --set watchAnyNamespace=true --create-namespace
     echo "Waiting for Strimzi Kafka Operator to be ready..."
     kubectl wait --for=condition=available --timeout=600s deployment/strimzi-cluster-operator -n strimzi-system
 
@@ -46,7 +46,7 @@ else
     helm repo add strimzi https://strimzi.io/charts/
     helm repo update
 
-    helm install strimzi-kafka-operator strimzi/strimzi-kafka-operator --namespace strimzi-system --version 0.45.0 --set watchAnyNamespace=true --create-namespace
+    helm upgrade --install strimzi-kafka-operator strimzi/strimzi-kafka-operator --namespace strimzi-system --version 0.45.0 --set watchAnyNamespace=true --create-namespace
     echo "Waiting for Strimzi Kafka Operator to be ready..."
     kubectl wait --for=condition=available --timeout=600s deployment/strimzi-cluster-operator -n strimzi-system
 
index a8a1fce..ac395c0 100755 (executable)
@@ -25,4 +25,4 @@
 
 kubectl create namespace network
 echo '### Installing ORAN SIMULATORS part ###'
-helm install --debug oran-simulator local/ru-du-simulators --namespace network -f $1 -f $2
+helm upgrade --install --debug oran-simulator local/ru-du-simulators --namespace network -f $1 -f $2
index 6ddfe23..131d009 100755 (executable)
@@ -20,8 +20,11 @@ echo  '### Installing ORAN SMO part ###'
 kubectl create namespace smo
 
 if ! command -v yq > /dev/null 2>&1; then
+    ARCH=$(case $(uname -m) in x86_64) echo "amd64";; aarch64) echo "arm64";; *) uname -m;; esac)
+    VERSION="v4.45.4"
     echo "yq is not installed. Installing yq..."
-    sudo snap install yq --channel=v4/stable
+    wget https://github.com/mikefarah/yq/releases/download/${VERSION}/yq_linux_${ARCH} -O /usr/local/bin/yq
+    chmod +x /usr/local/bin/yq
 fi
 
 OVERRIDEYAML=$1
@@ -29,15 +32,15 @@ MODE=$2
 
 if [ "$MODE" == "dev" ]; then
     echo "Installing SMO in dev mode"
-    helm install --debug oran-smo local/smo --namespace smo -f $OVERRIDEYAML --timeout 15m
+    helm upgrade --install --debug oran-smo local/smo --namespace smo -f $OVERRIDEYAML --timeout 15m
 else
     echo "Installing SMO in release mode"
     # This following should be modified once the charts are uploaded and available in the nexus repository
     # Till then, we are using the local chart
         # helm repo add smo https://nexus3.o-ran-sc.org/repository/smo-helm-snapshots/
         # helm repo update
-        # helm install oran-smo smo/smo --namespace nonrtric -f $OVERRIDEYAML --create-namespace
-    helm install oran-smo local/smo --namespace smo -f $OVERRIDEYAML  --timeout 15m
+        # helm upgrade --install oran-smo smo/smo --namespace nonrtric -f $OVERRIDEYAML --create-namespace
+    helm upgrade --install oran-smo local/smo --namespace smo -f $OVERRIDEYAML  --timeout 15m
 fi
 
 check_for_secrets() {
index 0ba3c40..2d0a289 100755 (executable)
 
 # Configure service manager with the installed services
 if ! command -v yq > /dev/null 2>&1; then
+    ARCH=$(case $(uname -m) in x86_64) echo "amd64";; aarch64) echo "arm64";; *) uname -m;; esac)
+    VERSION="v4.45.4"
     echo "yq is not installed. Installing yq..."
-    sudo snap install yq --channel=v4/stable
+    wget https://github.com/mikefarah/yq/releases/download/${VERSION}/yq_linux_${ARCH} -O /usr/local/bin/yq
+    chmod +x /usr/local/bin/yq
 fi
 
 OVERRIDEYAML=$1
index 290df43..40c0bc6 100755 (executable)
@@ -67,8 +67,8 @@ sudo chmod -R 777 /dockerdata-nfs
 kubectl create ns mariadb-operator
 helm repo add mariadb-operator https://helm.mariadb.com/mariadb-operator
 helm repo update
-helm install mariadb-operator-crds mariadb-operator/mariadb-operator-crds -n mariadb-operator
-helm install mariadb-operator mariadb-operator/mariadb-operator -n mariadb-operator
+helm upgrade --install mariadb-operator-crds mariadb-operator/mariadb-operator-crds -n mariadb-operator
+helm upgrade --install mariadb-operator mariadb-operator/mariadb-operator -n mariadb-operator
 kubectl wait deployment mariadb-operator -n mariadb-operator --for=condition=available --timeout=120s
 
 # K8s Volume creation as required
index 61e9742..292e3a5 100644 (file)
@@ -41,7 +41,7 @@ class NsSimulators():
         logger.info("Start the network slicing simulators")
         cmd = "kubectl create namespace nssimulators"
         check_output(cmd, shell=True).decode('utf-8')
-        cmd = f"helm install --debug ns-simulators local/ns-simulators --namespace nssimulators"
+        cmd = f"helm upgrade --install --debug ns-simulators local/ns-simulators --namespace nssimulators"
         check_output(cmd, shell=True).decode('utf-8')
 
     def start_and_wait_ns_simulators(self):
index 56d9b7f..fc16398 100644 (file)
@@ -49,7 +49,7 @@ class NetworkSimulators():
         logger.info("Start the network simulators")
         cmd = "kubectl create namespace network"
         check_output(cmd, shell=True).decode('utf-8')
-        cmd = f"helm install --debug oran-simulator local/ru-du-simulators --namespace network -f {self.resources_path}/network-simulators-topology/network-simulators-override.yaml -f {self.resources_path}/network-simulators-topology/network-simulators-topology-override.yaml"
+        cmd = f"helm upgrade --install --debug oran-simulator local/ru-du-simulators --namespace network -f {self.resources_path}/network-simulators-topology/network-simulators-override.yaml -f {self.resources_path}/network-simulators-topology/network-simulators-topology-override.yaml"
         check_output(cmd, shell=True).decode('utf-8')
 
     def start_and_wait_network_simulators(self):
index 503338f..a9bd638 100644 (file)
@@ -94,7 +94,7 @@ def deploy_chartmuseum():
     cmd = "kubectl create namespace test"
     check_output(cmd, shell=True).decode('utf-8')
 
-    cmd = "helm install test test/chartmuseum --version 3.1.0 --namespace test --set env.open.DISABLE_API=false"
+    cmd = "helm upgrade --install test test/chartmuseum --version 3.1.0 --namespace test --set env.open.DISABLE_API=false"
     check_output(cmd, shell=True).decode('utf-8')
     wait(lambda: is_chartmuseum_up(), sleep_seconds=10, timeout_seconds=60, waiting_for="chartmuseum to be ready")