[HELM] Clean up and fix oom helm jobs

Change-Id: I44c198e86f09f06d4ccd6e8b89c111ee49ebee2c
Signed-off-by: efiacor <fiachra.corcoran@est.tech>
Issue-ID: OOM-3065
diff --git a/jjb/global-templates-helm.yaml b/jjb/global-templates-helm.yaml
index 3ce9285..7b74b0e 100644
--- a/jjb/global-templates-helm.yaml
+++ b/jjb/global-templates-helm.yaml
@@ -8,7 +8,14 @@
     builders:
       - inject:
           properties-content: "SERVER_ID={server-id}"
-      - shell: !include-raw-escape: ../shell/oom-create-netrc.sh
+      - shell: !include-raw-escape: ../shell/helm/oom-create-netrc.sh
+
+- builder:
+    name: helm-install
+    builders:
+      - inject:
+          properties-content: "HELM_VER={helm_ver}"
+      - shell: !include-raw-escape: ../shell/helm/helm-install.sh
 
 ###########
 # ANCHORS #
@@ -19,17 +26,12 @@
     ######################
     # Default parameters #
     ######################
-
     branch: master
-    submodule-recursive: true
-
     # default params for helm jobs
     build_script: ''
     git-url: '$GIT_URL/$PROJECT'
     post_build_script: ''
     pre_build_script: ''
-    submodule-disable: false
-    submodule-timeout: 10
     build-timeout: 240
 
     #####################
@@ -49,12 +51,30 @@
           project: '{project}'
           stream: '{stream}'
           lftools-version: '{lftools-version}'
+      - string:
+          name: HELM_BIN
+          default: '{helm_bin|helm3.8}'
+      - string:
+          name: BUILD_TYPE
+          default: '{build_type|snapshot}'
 
     wrappers:
       - lf-infra-wrappers:
           build-timeout: '{build-timeout}'
           jenkins-ssh-credential: '{jenkins-ssh-credential}'
 
+    builders:
+      - lf-infra-pre-build
+      - lf-provide-maven-settings:
+          global-settings-file: '{mvn-global-settings}'
+          settings-file: '{mvn-settings}'
+      - shell: '{obj:pre_build_script}'
+      - shell: '{obj:build_script}'
+      - oom-create-netrc:
+          server-id: oom-helm
+      - shell: '{obj:post_build_script}'
+      - lf-provide-maven-settings-cleanup
+
     publishers:
       - lf-infra-publish
 
@@ -76,20 +96,11 @@
 
     triggers:
       - gerrit-trigger-helm-patch-submitted:
-          status-context: '{project}-Helm-Verify'
           server: '{server-name}'
           project: '{project}'
           branch: '{branch}'
-          helm_bin: '{helm_bin}'
           files: '{files}'
 
-    builders:
-      - lf-infra-pre-build
-      - shell: |
-          echo "export HELM_BIN={helm_bin}" > helm.prop
-      - shell: '{obj:pre_build_script}'
-      - shell: '{obj:build_script}'
-
 - job-template:
     name: '{project-name}-{stream}-merge-helm'
     # Job template for Helm merge jobs
@@ -107,26 +118,8 @@
           server: '{server-name}'
           project: '{project}'
           branch: '{branch}'
-          helm_bin: '{helm_bin}'
           files: '{files}'
 
-    builders:
-      - lf-infra-pre-build
-      - lf-provide-maven-settings:
-          global-settings-file: '{mvn-global-settings}'
-          settings-file: '{mvn-settings}'
-      - shell: |
-          echo "export HELM_BIN={helm_bin}" > helm.prop
-      - shell: '{obj:pre_build_script}'
-      - shell: '{obj:build_script}'
-      - oom-create-netrc:
-          server-id: oom-helm
-      - inject:
-          properties-content: |
-            BUILD_TYPE=snapshot
-      - shell: '{obj:post_build_script}'
-      - lf-provide-maven-settings-cleanup
-
 - job-template:
     name: '{project-name}-{stream}-release-helm'
     # Job template for Helm stage jobs
@@ -141,7 +134,6 @@
 
     triggers:
       - gerrit:
-          helm_bin: '{helm_bin}'
           server-name: '{gerrit-server-name}'
           trigger-on:
             - comment-added-contains-event:
@@ -156,19 +148,36 @@
                 - compare-type: 'ANT'
                   pattern: '**'
 
+- job-template:
+    name: '{project-name}-{stream}-verify-make-{helm_bin}'
+
+    <<: *helm_job_boiler_plate
+
+    scm:
+      - gerrit-trigger-scm:
+          refspec: ''
+          choosing-strategy: 'default'
+          submodule-recursive: '{submodule-recursive}'
+
+    triggers:
+      - gerrit:
+          server-name: '{gerrit-server-name}'
+          trigger-on:
+            - comment-added-contains-event:
+                comment-contains-value: '^Patch Set\s+\d+:\s+helm-latest\s*$'
+          projects:
+            - project-compare-type: 'ANT'
+              project-pattern: '{project}'
+              branches:
+                - branch-compare-type: 'ANT'
+                  branch-pattern: '**/{branch}'
+              file-paths:
+                - compare-type: 'ANT'
+                  pattern: '**'
+
     builders:
       - lf-infra-pre-build
-      - lf-provide-maven-settings:
-          global-settings-file: '{mvn-global-settings}'
-          settings-file: '{mvn-settings}'
-      - shell: |
-          echo "export HELM_BIN={helm_bin}" > helm.prop
+      - helm-install:
+          helm_ver: 3.10.2
       - shell: '{obj:pre_build_script}'
       - shell: '{obj:build_script}'
-      - oom-create-netrc:
-          server-id: oom-helm
-      - inject:
-          properties-content: |
-            BUILD_TYPE=release
-      - shell: '{obj:post_build_script}'
-      - lf-provide-maven-settings-cleanup
diff --git a/jjb/oom/oom-helm.yaml b/jjb/oom/oom-helm.yaml
index 40eca91..6a38faa 100644
--- a/jjb/oom/oom-helm.yaml
+++ b/jjb/oom/oom-helm.yaml
@@ -3,23 +3,12 @@
     name: oom
     project-name: oom
     project: oom
+    archive-artifacts: ""
     mvn-settings: oom-settings
     mvn-global-settings: global-settings
-    archive-artifacts: ""
     build-node: ubuntu1804-helm-2c-1g
-    pre_build_script: !include-raw-escape: shell/helm-repo-init.sh
-    oom_build_script: |
-      #!/bin/bash
-      source helm.prop
-      set -e -o pipefail
-      cd kubernetes/
-      make HELM_BIN=$HELM_BIN all
-    oom_build_script_skip_lint: |
-      #!/bin/bash
-      source helm.prop
-      set -e -o pipefail
-      cd kubernetes/
-      make HELM_BIN=$HELM_BIN SKIP_LINT=TRUE all
+    helm_bin: helm3.8
+    pre_build_script: !include-raw-escape: shell/helm/helm-repo-init.sh
 
     stream:
       - "master":
@@ -29,23 +18,43 @@
       - "jakarta":
           branch: "jakarta"
 
-    helm_bin:
-      - helm3.8
-
     jobs:
       - "{project-name}-{stream}-image-verify":
           files: "**"
       - "{project-name}-{stream}-verify-{helm_bin}":
-          build_script: "{oom_build_script}"
-          files: "kubernetes/**"
+          build_script: !include-raw-escape: shell/helm/make-helm-all.sh
+          files: "**/kubernetes/**"
           build-timeout: 900
       - "{project-name}-{stream}-merge-helm":
-          build_script: "{oom_build_script}"
-          post_build_script: !include-raw-escape: shell/publish_helm_charts.sh
-          files: "kubernetes/**"
+          build_type: snapshot
+          build_script: !include-raw-escape: shell/helm/make-helm-all.sh
+          post_build_script: !include-raw-escape: shell/helm/publish_helm_charts.sh
+          files: "**/kubernetes/**"
           build-timeout: 900
       - "{project-name}-{stream}-release-helm":
-          build_script: "{oom_build_script_skip_lint}"
-          post_build_script: !include-raw-escape: shell/publish_helm_charts.sh
-          files: "kubernetes/**"
+          build_type: release
+          build_script: !include-raw-escape: shell/helm/make-helm-skip-lint.sh
+          post_build_script: !include-raw-escape: shell/helm/publish_helm_charts.sh
+          files: "**/kubernetes/**"
+          build-timeout: 900
+
+- project:
+    name: oom-helm-verify-make-latest
+    project-name: oom
+    project: oom
+    archive-artifacts: ""
+    build-node: ubuntu1804-helm-2c-1g
+    helm_bin: helm3.10.2
+    pre_build_script: !include-raw-escape: shell/helm/helm-repo-init.sh
+
+    stream:
+      - "master":
+          branch: "master"
+      - "kohn":
+          branch: "kohn"
+
+    jobs:
+      - "{project-name}-{stream}-verify-make-{helm_bin}":
+          build_script: !include-raw-escape: shell/helm/make-helm-skip-lint.sh
+          files: "**/kubernetes/**"
           build-timeout: 900
diff --git a/jjb/oom/oom-main-linter.yaml b/jjb/oom/oom-main-linter.yaml
index 0f49ead..21e6706 100644
--- a/jjb/oom/oom-main-linter.yaml
+++ b/jjb/oom/oom-main-linter.yaml
@@ -1,3 +1,4 @@
+---
 - project:
     name: oom-main-linters
     project: oom