Add external verify job for HELM 74/84574/3
authorJessica Wagantall <jwagantall@linuxfoundation.org>
Mon, 8 Apr 2019 23:35:10 +0000 (16:35 -0700)
committerJessica Wagantall <jwagantall@linuxfoundation.org>
Wed, 17 Apr 2019 19:27:08 +0000 (19:27 +0000)
This new verify job will:
- Apply to code transfered outside OOM repo into the
  tech team's repos.
- Get triggered by any submitted changes in
  <component>/oom repos.
- Apply the change in oom/kubernetes/<component>
- Run a helm verify

Change-Id: I4bd60f946351623583589d7689343fbfc826237a
Issue-ID: CIMAN-250
Signed-off-by: Jessica Wagantall <jwagantall@linuxfoundation.org>
jjb/aai/aai-oom.yaml [new file with mode: 0644]
jjb/global-templates-helm.yaml
shell/apply-submodule-patch-oom.sh [new file with mode: 0644]

diff --git a/jjb/aai/aai-oom.yaml b/jjb/aai/aai-oom.yaml
new file mode 100644 (file)
index 0000000..7581e77
--- /dev/null
@@ -0,0 +1,36 @@
+---
+- project:
+    name: aai-oom-project-view
+    project-name: aai-oom
+    views:
+      - project-view
+
+- project:
+    name: aai-oom
+    helm-module: 'aai'
+    project-name: 'aai-oom'
+    project: 'aai/oom'
+    jobs:
+      - '{project-name}-{stream}-verify-external-helm'
+    stream:
+      - 'master':
+          branch: 'master'
+    mvn-settings: 'aai-oom-settings'
+    files: '**'
+    archive-artifacts: ''
+    build-node: ubuntu1604-helm-2c-1g
+    pre_build_script: !include-raw-escape: shell/helm-repo-init.sh
+    oom_build_script: |
+        #!/bin/bash
+        set -e -o pipefail
+        cd kubernetes/
+        make all
+    subproject_build_script: |
+        #!/bin/bash
+        cd kubernetes/
+        make common
+        make {subproject}
+    oom_post_build_script: !include-raw-escape: shell/publish_helm_charts.sh
+    subproject:
+      - 'aai':
+          files: 'kubernetes/aai/**'
index 6c139dd..1cff01a 100644 (file)
     submodule-recursive: true
 
     # default params for helm jobs
-    pre_build_script: ''
     build_script: ''
+    git-url: '$GIT_URL/$PROJECT'
     post_build_script: ''
+    pre_build_script: ''
+    submodule-recursive: true
     submodule-timeout: 10
 
     #####################
       - shell: '{obj:post_build_script}'
       - lf-provide-maven-settings-cleanup
 
+- job-template:
+    name: '{project-name}-{stream}-verify-external-helm'
+    # Job template for helm verify jobs
+
+    <<: *helm_job_boiler_plate
+
+    parameters:
+      - lf-infra-parameters:
+          branch: '{branch}'
+          project: 'oom'
+          stream: '{stream}'
+          lftools-version: '{lftools-version}'
+
+    scm:
+      - lf-infra-gerrit-scm:
+          jenkins-ssh-credential: '{jenkins-ssh-credential}'
+          git-url: '{git-url}'
+          refspec: '$GERRIT_BRANCH'
+          branch: '$GERRIT_BRANCH'
+          submodule-recursive: '{submodule-recursive}'
+          submodule-timeout: '{submodule-timeout}'
+          choosing-strategy: default
+
+    triggers:
+      - gerrit-trigger-helm-patch-submitted:
+          status-context: '{project}-Helm-Verify'
+          server: '{server-name}'
+          project: '{project}'
+          branch: '{branch}'
+          files: '{files}'
+
+    builders:
+      - lf-infra-pre-build
+      - inject:
+          properties-content: 'HELM_MODULE={helm-module}'
+      - shell: !include-raw-escape: shell/apply-submodule-patch-oom.sh
+      - shell: '{obj:pre_build_script}'
+      - shell: '{obj:build_script}'
+
 - job-template:
     name: '{project-name}-{stream}-stage-helm'
     # Job template for Helm stage jobs
diff --git a/shell/apply-submodule-patch-oom.sh b/shell/apply-submodule-patch-oom.sh
new file mode 100644 (file)
index 0000000..ad818fb
--- /dev/null
@@ -0,0 +1,18 @@
+#!/bin/bash
+# SPDX-License-Identifier: EPL-1.0
+##############################################################################
+# Copyright (c) 2019 The Linux Foundation and others.
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+##############################################################################
+
+# Update kubernetes submodule under oom with patch to be verified
+
+echo '--> apply-submodule-patch-oom.sh'
+cd kubernetes/${HELM_MODULE}
+remote_path=`git remote -v | grep fetch | awk '{print $2}'`
+git fetch ${remote_path} $GERRIT_REFSPEC && git cherry-pick FETCH_HEAD
+cd ../..