Add jenkins charts
[it/dep.git] / smo-install / jenkins / gerrit / manual-tests-pipeline
diff --git a/smo-install/jenkins/gerrit/manual-tests-pipeline b/smo-install/jenkins/gerrit/manual-tests-pipeline
new file mode 100644 (file)
index 0000000..ce74246
--- /dev/null
@@ -0,0 +1,77 @@
+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') {
+       sh 'printenv' 
+       git branch: env.BRANCH, url:'https://gerrit.o-ran-sc.org/r/it/dep'
+      }
+      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 proxies+' ./smo-install/scripts/layer-0/0-setup-tests-env.sh'
+            sh proxies+' ./smo-install/scripts/layer-0/0-setup-charts-museum.sh'
+            sh proxies+' ./smo-install/scripts/layer-0/0-setup-helm3.sh'
+
+        }
+        stage('Build TESTS charts') {
+            sh proxies+' ./smo-install/scripts/sub-scripts/build-tests.sh'
+        }
+        stage('Test ORAN') {
+            dir("smo-install/test/pythonsdk") {
+              try {
+                if (env.http_proxy) {
+                  sh proxies+' NO_PROXY='+env.no_proxy+' tox'
+                } else {
+                  sh 'tox'
+                }
+              }
+              catch(exec) {
+                echo 'TOX tests crashed'
+              }
+            }
+        }
+        stage('Get Results') {
+          archiveArtifacts artifacts: 'smo-install/test/pythonsdk/src/orantests/pythonsdk.debug.log, **/reports/junit/*.xml', fingerprint: true
+          junit '**/reports/junit/*.xml'
+        }
+      }
+   
+  }
+}