Merge "parameterise upgrade job with upgrade_from_release"
diff --git a/jjb/geode-native-win/apache-geode-native-win-slave/apache-geode-native-win-slave-setup.yaml b/jjb/geode-native-win/apache-geode-native-win-slave/apache-geode-native-win-slave-setup.yaml
index 3f624b6..38b835a 100644
--- a/jjb/geode-native-win/apache-geode-native-win-slave/apache-geode-native-win-slave-setup.yaml
+++ b/jjb/geode-native-win/apache-geode-native-win-slave/apache-geode-native-win-slave-setup.yaml
@@ -21,7 +21,7 @@
     name: 'win-geode-native-SlaveSetup'
 
     node: geode-windows2019
-    disabled: false
+    disabled: true
     concurrent: true
 
     properties:
diff --git a/jjb/geode-native-win/apache-geode-native-win-verify.yaml b/jjb/geode-native-win/apache-geode-native-win-verify.yaml
index e072dce..51c3725 100644
--- a/jjb/geode-native-win/apache-geode-native-win-verify.yaml
+++ b/jjb/geode-native-win/apache-geode-native-win-verify.yaml
@@ -30,7 +30,7 @@
 - job-template:
     name: 'win-geode-native-{stream}-verify'
     project-type: multijob
-    disabled: false
+    disabled: true
     concurrent: true
     node: geode-windows2019
 
diff --git a/jjb/geode-native-win/global-template-apache-geode-native-win-tests.yaml b/jjb/geode-native-win/global-template-apache-geode-native-win-tests.yaml
index cd63d2b..c7b3f84 100644
--- a/jjb/geode-native-win/global-template-apache-geode-native-win-tests.yaml
+++ b/jjb/geode-native-win/global-template-apache-geode-native-win-tests.yaml
@@ -21,7 +21,7 @@
     name: 'win-geode-native-{test-type}'
 
     node: geode-windows2019
-    disabled: false
+    disabled: true
     concurrent: true
 
     properties:
diff --git a/jjb/geode-native/apache-geode-native-release/apache-geode-native-SrcRelease.yaml b/jjb/geode-native/apache-geode-native-release/apache-geode-native-SrcRelease.yaml
index 9103ee6..a0bca22 100644
--- a/jjb/geode-native/apache-geode-native-release/apache-geode-native-SrcRelease.yaml
+++ b/jjb/geode-native/apache-geode-native-release/apache-geode-native-SrcRelease.yaml
@@ -21,7 +21,7 @@
     name: 'apache-geode-native-SrcRelease'
 
     node: geode-ubuntu1804
-    disabled: false
+    disabled: true
     concurrent: true
 
     properties:
diff --git a/jjb/geode-native/apache-geode-native-slave/apache-geode-native-slave-setup.yaml b/jjb/geode-native/apache-geode-native-slave/apache-geode-native-slave-setup.yaml
index 183f4dc..5451a13 100644
--- a/jjb/geode-native/apache-geode-native-slave/apache-geode-native-slave-setup.yaml
+++ b/jjb/geode-native/apache-geode-native-slave/apache-geode-native-slave-setup.yaml
@@ -21,7 +21,7 @@
     name: 'apache-geode-native-SlaveSetup'
 
     node: geode-ubuntu1804
-    disabled: false
+    disabled: true
     concurrent: true
 
     properties:
diff --git a/jjb/geode-native/apache-geode-native-verify.yaml b/jjb/geode-native/apache-geode-native-verify.yaml
index 1abd311..650c328 100644
--- a/jjb/geode-native/apache-geode-native-verify.yaml
+++ b/jjb/geode-native/apache-geode-native-verify.yaml
@@ -30,7 +30,7 @@
 - job-template:
     name: 'apache-geode-native-{stream}-verify'
     project-type: multijob
-    disabled: false
+    disabled: true
     concurrent: true
     node: geode-ubuntu1804
 
diff --git a/jjb/geode-native/global-template-apache-geode-native-test.yaml b/jjb/geode-native/global-template-apache-geode-native-test.yaml
index 1058b89..7f234bc 100644
--- a/jjb/geode-native/global-template-apache-geode-native-test.yaml
+++ b/jjb/geode-native/global-template-apache-geode-native-test.yaml
@@ -21,7 +21,7 @@
     name: 'apache-geode-native-{test-type}'
 
     node: geode-ubuntu1804
-    disabled: false
+    disabled: true
     concurrent: true
 
     properties:
diff --git a/jjb/geode/apache-geode-slave/apache-geode-slave-setup.yaml b/jjb/geode/apache-geode-slave/apache-geode-slave-setup.yaml
index f4deac3..da406ac 100644
--- a/jjb/geode/apache-geode-slave/apache-geode-slave-setup.yaml
+++ b/jjb/geode/apache-geode-slave/apache-geode-slave-setup.yaml
@@ -21,7 +21,7 @@
     name: 'apache-geode-SlaveSetup'
 
     node: geode-ubuntu1804
-    disabled: false
+    disabled: true
     concurrent: true
 
     properties:
diff --git a/jjb/geode/apache-geode-test-coordinator.yaml b/jjb/geode/apache-geode-test-coordinator.yaml
index f172196..f93ab00 100644
--- a/jjb/geode/apache-geode-test-coordinator.yaml
+++ b/jjb/geode/apache-geode-test-coordinator.yaml
@@ -34,7 +34,7 @@
 - job-template:
     name: 'apache-geode-verify-{stream}-coordinator'
     project-type: multijob
-    disabled: false
+    disabled: true
     concurrent: true
     node: geode-ubuntu1804
 
diff --git a/jjb/geode/global-template-apache-geode-build.yaml b/jjb/geode/global-template-apache-geode-build.yaml
index 65217c4..4a7d873 100644
--- a/jjb/geode/global-template-apache-geode-build.yaml
+++ b/jjb/geode/global-template-apache-geode-build.yaml
@@ -21,7 +21,7 @@
     name: 'apache-geode-build-release-jdk{java-build-version}'
 
     node: geode-ubuntu1804
-    disabled: false
+    disabled: true
     concurrent: true
 
     properties:
diff --git a/jjb/geode/global-template-apache-geode-test.yaml b/jjb/geode/global-template-apache-geode-test.yaml
index 7209fb6..6fdfec8 100644
--- a/jjb/geode/global-template-apache-geode-test.yaml
+++ b/jjb/geode/global-template-apache-geode-test.yaml
@@ -21,7 +21,7 @@
     name: 'apache-geode-{test-type}Test-jdk{java-test-version}'
 
     node: geode-ubuntu1804
-    disabled: false
+    disabled: true
     concurrent: true
 
     properties:
diff --git a/jjb/metal3/defaults.yml b/jjb/metal3/defaults.yml
index ca76832..ca138c7 100644
--- a/jjb/metal3/defaults.yml
+++ b/jjb/metal3/defaults.yml
@@ -39,5 +39,7 @@
     name: integration-default-values
     <<: *global_defaults
     ironic_install_type: 'rpm'
+    build_mariadb_image_locally: 'false'
+    ironic_use_mariadb: 'false'
     name_postfix: ''
     trigger_postfix: ''
diff --git a/jjb/metal3/job_bml_integration_tests.yml b/jjb/metal3/job_bml_integration_tests.yml
index 8ca4dd5..dfe9b60 100644
--- a/jjb/metal3/job_bml_integration_tests.yml
+++ b/jjb/metal3/job_bml_integration_tests.yml
@@ -74,6 +74,10 @@
         name: TARGET_NODE_MEMORY
         default: 4096
         description: 'RAM size of the target host.'
+    - string:
+        name: NUM_NODES
+        default: 2
+        description: 'Number of baremetal servers.'
 
     properties:
     - build-discarder:
diff --git a/jjb/metal3/job_bml_main_integration_tests.yml b/jjb/metal3/job_bml_main_integration_tests.yml
index 039d93c..0d80a3f 100644
--- a/jjb/metal3/job_bml_main_integration_tests.yml
+++ b/jjb/metal3/job_bml_main_integration_tests.yml
@@ -74,6 +74,10 @@
         name: TARGET_NODE_MEMORY
         default: 4096
         description: 'RAM size of the target host.'
+    - string:
+        name: NUM_NODES
+        default: 2
+        description: 'Number of baremetal servers.'
 
     properties:
     - build-discarder:
diff --git a/jjb/metal3/job_integration_tests.yml b/jjb/metal3/job_integration_tests.yml
index 20a6ca2..c72d810 100644
--- a/jjb/metal3/job_integration_tests.yml
+++ b/jjb/metal3/job_integration_tests.yml
@@ -77,6 +77,13 @@
         name: IRONIC_INSTALL_TYPE
         default: '{ironic_install_type}'
         description: 'Sets the installation type of ironic during ironic-image build of the BMO deployment'
+    - string:
+        name: IRONIC_USE_MARIADB
+        default: '{ironic_use_mariadb}'
+        description: 'If Ironic should use MariaDB or not.'
+    - string:
+        name: BUILD_MARIADB_IMAGE_LOCALLY
+        default: '{build_mariadb_image_locally}'
     properties:
     - build-discarder:
         days-to-keep: 30
@@ -89,7 +96,7 @@
     triggers:
     - github-pull-request:
         admin-list:
-          - '{ci_github_admin_user}'
+        - '{ci_github_admin_user}'
         org-list: "{ci_github_whitelist_org}"
         cron: 'H/5 * * * *'
         auth-id: "{ci_ghprb_auth_id}"
@@ -112,7 +119,7 @@
           url: "{ci_github_repo}"
           credentials-id: "{ci_github_jenkins_credentials_id}"
           branches:
-            - '{branch|main}'
+          - '{branch|main}'
           name: 'origin'
           refspec: '+refs/heads/*:refs/remotes/origin/*'
           wipe-workspace: True
diff --git a/jjb/metal3/job_openstack_image_building.yml b/jjb/metal3/job_openstack_image_building.yml
index d8973d5..e9e90b5 100644
--- a/jjb/metal3/job_openstack_image_building.yml
+++ b/jjb/metal3/job_openstack_image_building.yml
@@ -35,11 +35,11 @@
     parameters:
     - string:
         name: KUBERNETES_VERSION
-        default: "v1.26.0"
+        default: "v1.26.4"
         description: 'Kubernetes version'
     - string:
         name: KIND_NODE_IMAGE_VERSION
-        default: "v1.26.0"
+        default: "v1.26.3"
         description: 'Kind node container image version'
 
     properties:
diff --git a/jjb/metal3/job_openstack_node_image_building.yml b/jjb/metal3/job_openstack_node_image_building.yml
index aadf587..57576d3 100644
--- a/jjb/metal3/job_openstack_node_image_building.yml
+++ b/jjb/metal3/job_openstack_node_image_building.yml
@@ -35,15 +35,15 @@
     parameters:
     - string:
         name: KUBERNETES_VERSION
-        default: "v1.26.0"
+        default: "v1.26.4"
         description: 'Kubernetes version'
     - string:
         name: CRICTL_VERSION
-        default: "v1.26.0"
+        default: "v1.26.1"
         description: 'CRICTL VERSION'
     - string:
         name: CRIO_VERSION
-        default: "v1.26.1"
+        default: "v1.26.3"
         description: 'CRI-O VERSION'
 
     properties:
diff --git a/jjb/metal3/projects.yml b/jjb/metal3/projects.yml
index cdf877f..a75d60c 100644
--- a/jjb/metal3/projects.yml
+++ b/jjb/metal3/projects.yml
@@ -78,6 +78,8 @@
           repo: ironic-ipa-downloader
       - mariadb_image:
           repo: mariadb-image
+          build_mariadb_image_locally: 'true'
+          ironic_use_mariadb: 'true'
     image_os:
       - ubuntu
       - centos
diff --git a/jjb/nsm/Jenkinsfile b/jjb/nsm/Jenkinsfile
index e30b92e..914dbbb 100644
--- a/jjb/nsm/Jenkinsfile
+++ b/jjb/nsm/Jenkinsfile
@@ -34,6 +34,8 @@
         def image_names = params.IMAGE_NAMES.split(' ')
         def version = params.IMAGE_VERSION
         def e2e_enabled = params.E2E_ENABLED
+        def helm_chart_upload = params.HELM_CHART_UPLOAD
+        def security_scan_enabled = params.SECURITY_SCAN_ENABLED
         def git_project = params.GIT_PROJECT
         def current_branch = params.CURRENT_BRANCH
         def default_branch = params.DEFAULT_BRANCH
@@ -55,12 +57,7 @@
                 ])
                 sh 'git show'
             }
-            stage('Verify') {
-                Verify().call()
-                if (currentBuild.result == 'FAILURE') {
-                    Error('Failed at verification stage').call()
-                }
-            }
+            Verify().call()
             stage('Docker login') {
                 if (env.DRY_RUN != 'true') {
                     withCredentials([usernamePassword(credentialsId: 'nordix-cicd-harbor-credentials', passwordVariable: 'HARBOR_PASSWORD', usernameVariable: 'HARBOR_USERNAME')]) {
@@ -69,7 +66,7 @@
                     '''
                     }
                 } else {
-                    Utils.markStageSkippedForConditional('Docker login')
+                    echo 'Docker login'
                 }
             }
             stage('Base Image') {
@@ -81,9 +78,19 @@
                     Error('Failed to build image(s)').call()
                 }
             }
+            stage('Helm Chart') {
+                HelmChart(helm_chart_upload, version).call()
+            }
+            stage('Security Scan') {
+                if (security_scan_enabled == true) {
+                    SecurityScan(current_branch, version).call()
+                } else {
+                    Utils.markStageSkippedForConditional('Security Scan')
+                }
+            }
             stage('E2E') {
-                if (e2e_enabled == 'true' && env.DRY_RUN != 'true') {
-                    E2e(e2e_enabled).call()
+                if (e2e_enabled == true) {
+                    E2e(current_branch, version).call()
                 } else {
                     Utils.markStageSkippedForConditional('E2E')
                 }
@@ -95,17 +102,12 @@
     }
 }
 
-// Static analysis: Runs the GeneratedCode function and then UnitTests and Linter in parallel
+// Verify the Generated code, UnitTests and Linter
 def Verify() {
     return {
         GeneratedCode().call() // cannot generate code and run the linter and tests at the same time
-        // Linter().call()
-        // UnitTests().call()
-        def stages = [:]
-        stages.put('Unit Tests', UnitTests())
-        stages.put('Linter', Linter())
-        // stages.put('Generated code verification', GeneratedCode())
-        parallel(stages)
+        Linter().call()
+        UnitTests().call()
     }
 }
 
@@ -121,8 +123,7 @@
                 SetBuildStatus(completed, context, success)
             } catch (Exception e) {
                 SetBuildStatus(failed, context, failure)
-                unstable "${exception_message_exec} ${command}"
-                currentBuild.result = 'FAILURE'
+                Error("${exception_message_exec} ${command}").call()
             }
         }
     }
@@ -140,8 +141,7 @@
                 SetBuildStatus(completed, context, success)
             } catch (Exception e) {
                 SetBuildStatus(failed, context, failure)
-                unstable "${exception_message_exec} ${command}"
-                currentBuild.result = 'FAILURE'
+                Error("${exception_message_exec} ${command}").call()
             }
         }
     }
@@ -155,36 +155,20 @@
 def GeneratedCode() {
     return {
         def context = 'Generated code verification'
-        SetBuildStatus(in_progress, context, pending)
-        stage('go mod tidy') {
-            def command = 'go mod tidy'
+        stage('Generated code verification') {
+            def command = 'make go-generate manifests generate-controller'
             try {
+                SetBuildStatus(in_progress, context, pending)
                 ExecSh(command).call()
                 if (GetModifiedFiles() != '') {
                     throw new Exception(exception_message_code_generation)
                 }
+                SetBuildStatus(completed, context, success)
             } catch (Exception e) {
                 SetBuildStatus(failed, context, failure)
                 Error(exception_message_exec + command).call()
             }
         }
-        stage('go generate ./...') {
-            def command = 'make generate'
-            try {
-                ExecSh(command).call()
-                if (GetModifiedFiles() != '') {
-                    throw new Exception(exception_message_code_generation)
-                }
-            } catch (Exception e) {
-                SetBuildStatus(failed, context, failure)
-                Error(exception_message_exec + command).call()
-            }
-        }
-        stage('Proto') {
-            // TODO: protoc version could be different
-            Utils.markStageSkippedForConditional('Proto')
-        }
-        SetBuildStatus(completed, context, success)
     }
 }
 
@@ -227,11 +211,64 @@
     }
 }
 
+// Generate and upload the helm chart
+def HelmChart(helm_chart_upload, version) {
+    return {
+        parallel(
+            'Helm Chart': {
+                stage('Generate Helm Chart') {
+                    def context = 'Generate Helm Chart'
+                    def command = "make generate-helm-chart VERSION=${version}"
+                    try {
+                        SetBuildStatus(in_progress, context, pending)
+                        ExecSh(command).call()
+                        SetBuildStatus(completed, context, success)
+                    } catch (Exception e) {
+                        SetBuildStatus(failed, context, failure)
+                        Error("${exception_message_exec} ${command}").call()
+                    }
+                }
+                stage('Upload Helm Chart') {
+                    if (helm_chart_upload == true) {
+                        withCredentials([string(credentialsId: 'nsm-nordix-artifactory-api-key', variable: 'API_KEY')]) {
+                            ExecSh("""
+                                charts=\$(cd _output/helm/ && ls *.tgz)
+                                for chart in \$charts
+                                do
+                                    curl -H 'X-JFrog-Art-Api:${API_KEY}' -T _output/helm/\$chart \"https://artifactory.nordix.org/artifactory/cloud-native/meridio/\$chart\"
+                                done
+                            """).call()
+                        }
+                    } else {
+                        Utils.markStageSkippedForConditional('Upload Helm Chart')
+                    }
+                }
+            }
+        )
+    }
+}
+
+// Run the security scan job
+def SecurityScan(current_branch, version) {
+    return {
+        build job: 'meridio-periodic-security-scan', parameters: [
+            string(name: 'IMAGE_VERSION', value: "$version"),
+            string(name: 'CURRENT_BRANCH', value: "$current_branch"),
+            string(name: 'DRY_RUN', value: env.DRY_RUN)
+        ], wait: true
+    }
+}
+
 // Run the E2e Tests
 // Currently skipped
-def E2e(e2e_enabled) {
+def E2e(current_branch, version) {
     return {
-        echo 'make e2e' // todo
+        build job: 'meridio-e2e-test-kind', parameters: [
+            string(name: 'MERIDIO_VERSION', value: "$version"),
+            string(name: 'TAPA_VERSION', value: "$version"),
+            string(name: 'CURRENT_BRANCH', value: "$current_branch"),
+            string(name: 'DRY_RUN', value: env.DRY_RUN)
+        ], wait: true
     }
 }
 
diff --git a/jjb/nsm/meridio-e2e-long-run-test-kind.yaml b/jjb/nsm/meridio-e2e-long-run-test-kind.yaml
index 678878a..218463a 100644
--- a/jjb/nsm/meridio-e2e-long-run-test-kind.yaml
+++ b/jjb/nsm/meridio-e2e-long-run-test-kind.yaml
@@ -98,7 +98,7 @@
       - string:
           name: INTERVAL
           default: "7200"
-          description: Interval between each e2e test run (in seconds)
+          description: Interval between each e2e test run (in seconds). This also defines the timeout of the e2e test runs.
       - bool:
           name: DRY_RUN
           default: false
diff --git a/jjb/nsm/meridio-periodic.yaml b/jjb/nsm/meridio-periodic.yaml
index 4acefe3..d4e1f25 100644
--- a/jjb/nsm/meridio-periodic.yaml
+++ b/jjb/nsm/meridio-periodic.yaml
@@ -59,10 +59,18 @@
           name: IMAGE_VERSION
           default: 'latest'
           description: Version of the images
-      - string:
+      - bool:
           name: E2E_ENABLED
-          default: "false"
-          description: Is E2E Tests enabled?
+          default: false
+          description: Run the e2e tests?
+      - bool:
+          name: HELM_CHART_UPLOAD
+          default: true
+          description: Upload Helm Charts?
+      - bool:
+          name: SECURITY_SCAN_ENABLED
+          default: false
+          description: Run the security scan?
       - string:
           name: GIT_PROJECT
           default: "https://github.com/Nordix/Meridio.git"
diff --git a/jjb/nsm/meridio-pull-request.yaml b/jjb/nsm/meridio-pull-request.yaml
index 9dd3301..c322359 100644
--- a/jjb/nsm/meridio-pull-request.yaml
+++ b/jjb/nsm/meridio-pull-request.yaml
@@ -60,10 +60,18 @@
           name: IMAGE_VERSION
           default: 'latest'
           description: Version of the images
-      - string:
+      - bool:
           name: E2E_ENABLED
-          default: "false"
-          description: Is E2E Tests enabled?
+          default: false
+          description: Run the e2e tests?
+      - bool:
+          name: HELM_CHART_UPLOAD
+          default: false
+          description: Upload Helm Charts?
+      - bool:
+          name: SECURITY_SCAN_ENABLED
+          default: false
+          description: Run the security scan?
       - string:
           name: GIT_PROJECT
           default: "https://github.com/Nordix/Meridio.git"
diff --git a/jjb/onap/policy-docker-csit-jobs.sh b/jjb/onap/policy-docker-csit-jobs.sh
index 82fb3e1..7735514 100644
--- a/jjb/onap/policy-docker-csit-jobs.sh
+++ b/jjb/onap/policy-docker-csit-jobs.sh
@@ -24,10 +24,6 @@
 
 unset WORKSPACE
 
-
-sed -i 's#./include-raw-integration-install-robotframework.sh#$SCRIPTS/include-raw-integration-install-robotframework.sh#g' prepare-csit.sh
-sed -i 's#pylibs.txt#$SCRIPTS/pylibs.txt#g' include-raw-integration-install-robotframework.sh
-
 git config --global user.email "infra@nordix.org"
 git config --global user.name "nordix"
 
diff --git a/jjb/oransc/nonrtric-plt-helmmanager/nonrtric-plt-helmmanager-verify-jobs.yaml b/jjb/oransc/nonrtric-plt-helmmanager/nonrtric-plt-helmmanager-verify-jobs.yaml
index daf6f43..82788bc 100644
--- a/jjb/oransc/nonrtric-plt-helmmanager/nonrtric-plt-helmmanager-verify-jobs.yaml
+++ b/jjb/oransc/nonrtric-plt-helmmanager/nonrtric-plt-helmmanager-verify-jobs.yaml
@@ -24,7 +24,7 @@
     name: nonrtric-plt-helmmanager-verify
     project: nonrtric/plt/helmmanager
     project-name: nonrtric-plt-helmmanager
-    jdk-version: java-11
+    jdk-version: java-17
 
     jobs:
       - 'oransc-{project-name}-verify-java'
\ No newline at end of file
diff --git a/jjb/oransc/nonrtric-plt-rappcatalogue/nonrtric-plt-rappcatalogue-verify-jobs.yaml b/jjb/oransc/nonrtric-plt-rappcatalogue/nonrtric-plt-rappcatalogue-verify-jobs.yaml
index 7773629..3ff2503 100644
--- a/jjb/oransc/nonrtric-plt-rappcatalogue/nonrtric-plt-rappcatalogue-verify-jobs.yaml
+++ b/jjb/oransc/nonrtric-plt-rappcatalogue/nonrtric-plt-rappcatalogue-verify-jobs.yaml
@@ -24,7 +24,7 @@
     name: nonrtric-plt-rappcatalogue-verify
     project: nonrtric/plt/rappcatalogue
     project-name: nonrtric-plt-rappcatalogue
-    jdk-version: java-11
+    jdk-version: java-17
 
     jobs:
       - 'oransc-{project-name}-verify-java'
\ No newline at end of file
diff --git a/jjb/oransc/portal-nonrtric-controlpanel/portal-nonrtric-controlpanel-verify-jobs.yml b/jjb/oransc/portal-nonrtric-controlpanel/portal-nonrtric-controlpanel-verify-jobs.yml
index e6a3f94..159c162 100644
--- a/jjb/oransc/portal-nonrtric-controlpanel/portal-nonrtric-controlpanel-verify-jobs.yml
+++ b/jjb/oransc/portal-nonrtric-controlpanel/portal-nonrtric-controlpanel-verify-jobs.yml
@@ -21,7 +21,7 @@
     name: portal-nonrtric-controlpanel-verify
     project: portal/nonrtric-controlpanel
     project-name: portal-nonrtric-controlpanel
-    jdk-version: java-11
+    jdk-version: java-17
 
     jobs:
       - 'oransc-{project-name}-verify-java'