Add option in Jenkins stage3 to test old SA
[osm/devops.git] / jenkins / ci-pipelines / ci_stage_3.groovy
index bdbc175..bc08891 100644 (file)
@@ -31,7 +31,8 @@ properties([
         string(defaultValue: 'artifactory-osm', description: '', name: 'ARTIFACTORY_SERVER'),
         string(defaultValue: 'osm-stage_4', description: '', name: 'DOWNSTREAM_STAGE_NAME'),
         string(defaultValue: 'testing-daily', description: '', name: 'DOCKER_TAG'),
-        string(defaultValue: 'ubuntu20.04', description: '', name: 'OPENSTACK_BASE_IMAGE'),
+        string(defaultValue: 'ubuntu22.04', description: '', name: 'OPENSTACK_BASE_IMAGE'),
+        booleanParam(defaultValue: false, description: '', name: 'TRY_OLD_SERVICE_ASSURANCE'),
         booleanParam(defaultValue: false, description: '', name: 'SAVE_CONTAINER_ON_FAIL'),
         booleanParam(defaultValue: false, description: '', name: 'SAVE_CONTAINER_ON_PASS'),
         booleanParam(defaultValue: true, description: '', name: 'SAVE_ARTIFACTS_ON_SMOKE_SUCCESS'),
@@ -158,8 +159,7 @@ void archive_logs(Map remote) {
     sh 'rm -rf logs'
     sshCommand remote: remote, command: '''ls -al logs'''
     sshGet remote: remote, from: 'logs', into: '.', override: true
-    sh 'cp logs/* .'
-    sh 'cp logs/dags/* .'
+    sh 'cp logs/*.log logs/dags/*.log .'
     archiveArtifacts artifacts: '*.log'
 }
 
@@ -443,6 +443,30 @@ node("${params.NODE}") {
                         }
                     }
                     println('VM is ready and accepting ssh connections')
+
+                    //////////////////////////////////////////////////////////////////////////////////////////////
+                    println('Applying sshd config workaround for Ubuntu 22.04 and old jsch client in Jenkins...')
+
+                    sh( returnStatus: true,
+                        script: "ssh -T -i ${SSH_KEY} " +
+                            "-o StrictHostKeyChecking=no " +
+                            "-o UserKnownHostsFile=/dev/null " +
+                            "ubuntu@${IP_ADDRESS} " +
+                            "'echo HostKeyAlgorithms +ssh-rsa | sudo tee -a /etc/ssh/sshd_config'")
+                    sh( returnStatus: true,
+                        script: "ssh -T -i ${SSH_KEY} " +
+                            "-o StrictHostKeyChecking=no " +
+                            "-o UserKnownHostsFile=/dev/null " +
+                            "ubuntu@${IP_ADDRESS} " +
+                            "'echo PubkeyAcceptedKeyTypes +ssh-rsa | sudo tee -a /etc/ssh/sshd_config'")
+                    sh( returnStatus: true,
+                        script: "ssh -T -i ${SSH_KEY} " +
+                            "-o StrictHostKeyChecking=no " +
+                            "-o UserKnownHostsFile=/dev/null " +
+                            "ubuntu@${IP_ADDRESS} " +
+                            "'sudo systemctl restart sshd'")
+                    //////////////////////////////////////////////////////////////////////////////////////////////
+
                 } // stage("Spawn Remote VM")
 
 ///////////////////////////////////////////////////////////////////////////////////////
@@ -542,6 +566,10 @@ node("${params.NODE}") {
                         osmHostname = "nbi.${IP_ADDRESS}.nip.io:443"
                     } else {
                         // Run -k8s installer here specifying internal docker registry and docker proxy
+                        osm_installation_options = ""
+                        if (params.TRY_OLD_SERVICE_ASSURANCE) {
+                            osm_installation_options = "--old-sa"
+                        }
                         withCredentials([gitlabCredentialsMap]) {
                             sshCommand remote: remote, command: """
                                 ./install_osm.sh -y \
@@ -550,7 +578,8 @@ node("${params.NODE}") {
                                     ${release} -r unstable \
                                     -d ${USERNAME}:${PASSWORD}@${INTERNAL_DOCKER_REGISTRY} \
                                     -p ${INTERNAL_DOCKER_PROXY} \
-                                    -t ${containerName}
+                                    -t ${containerName} \
+                                    ${osm_installation_options}
                             """
                         }
                         prometheusHostname = IP_ADDRESS