Updates in CI pipeline and installer for the new pipeline: registry and proxy url...
[osm/devops.git] / jenkins / ci-pipelines / ci_stage_3.groovy
index 6b57f15..f851fc0 100644 (file)
@@ -47,7 +47,7 @@ properties([
         string(defaultValue: '/home/jenkins/hive/robot-systest.cfg', description: '', name: 'ROBOT_VIM'),
         string(defaultValue: '/home/jenkins/hive/kubeconfig.yaml', description: '', name: 'KUBECONFIG'),
         string(defaultValue: '/home/jenkins/hive/clouds.yaml', description: '', name: 'CLOUDS'),
-        string(defaultValue: 'Charmed', description: '', name: 'INSTALLER'),
+        string(defaultValue: 'Default', description: '', name: 'INSTALLER'),
     ])
 ])
 
@@ -124,7 +124,18 @@ def archive_logs(remote) {
             done
         '''
     } else {
-        // collect logs from k8s based installer...
+        sshCommand remote: remote, command: '''
+            for deployment in `kubectl -n osm get deployments | grep -v operator | grep -v NAME| awk '{print $1}'`; do
+                echo "Extracting log for $deployment"
+                kubectl -n osm logs deployments/$deployment --all-containers 2>&1 > logs/$deployment.log
+            done
+        '''
+        sshCommand remote: remote, command: '''
+            for statefulset in `kubectl -n osm get statefulsets | grep -v operator | grep -v NAME| awk '{print $1}'`; do
+                echo "Extracting log for $statefulset"
+                kubectl -n osm logs statefulsets/$statefulset --all-containers 2>&1 > logs/$statefulset.log
+            done
+        '''
     }
 
     sh "rm -rf logs"
@@ -148,6 +159,7 @@ def get_value(key, output) {
 node("${params.NODE}") {
 
     INTERNAL_DOCKER_REGISTRY = 'osm.etsi.org:5050/devops/cicd/'
+    INTERNAL_DOCKER_PROXY = 'http://172.21.1.1:5000'
     SSH_KEY = '~/hive/cicd_rsa'
     sh 'env'
 
@@ -407,10 +419,22 @@ node("${params.NODE}") {
                         prometheusPort = 80
                         osmHostname = "nbi."+IP_ADDRESS+".xip.io:443"
                     } else {
-                        // Run -k8s installer here
-                        // Update to use 172.21.1.1 as the dockerhub proxy
-                        // Specify registry to use for installer
-                        // set osmHostname, prometheusHostname, prometheusPort as needed
+                        // Run -k8s installer here specifying internal docker registry and docker proxy
+                        withCredentials([[$class: 'UsernamePasswordMultiBinding', credentialsId: 'gitlab-registry',
+                                        usernameVariable: 'USERNAME', passwordVariable: 'PASSWORD']]) {
+                            sshCommand remote: remote, command: """
+                                ./install_osm.sh -y \
+                                    ${repo_base_url} \
+                                    ${repo_key_name} \
+                                    ${release} -r unstable \
+                                    -d ${USERNAME}:${PASSWORD}@${INTERNAL_DOCKER_REGISTRY} \
+                                    -p ${INTERNAL_DOCKER_PROXY} \
+                                    -t ${container_name}
+                            """
+                        }
+                        prometheusHostname = IP_ADDRESS
+                        prometheusPort = 9091
+                        osmHostname = IP_ADDRESS
                     }
                 }
             }