Job to publish binary for libvirt deploys 67/967/6
authorRicardo Noriega <rnoriega@redhat.com>
Mon, 10 Jun 2019 14:18:08 +0000 (16:18 +0200)
committerRicardo Noriega <rnoriega@redhat.com>
Mon, 1 Jul 2019 10:45:23 +0000 (12:45 +0200)
  This job will be only triggered with the keyword
  `build-binary` located in any comment. This job will be
  usually triggered when there is a version bump.

Signed-off-by: Ricardo Noriega <rnoriega@redhat.com>
Change-Id: Iaf06365b44e3853ebbe524afb8b7ef39dc902cb7

jjb/akraino-templates/akraino-jjb-kni.yaml
jjb/kni/kni_installer.yaml
jjb/shell/build_openshift_install_libvirt_binary.sh [new file with mode: 0644]

index ae16f98..207e2cf 100644 (file)
     publishers:
       - lf-infra-publish
 
+- job-template:
+    id: kni-installer-publish-openshift-install-libvirt-binary
+    name: '{project-name}-publish-openshift-install-libvirt-binary'
+
+    ######################
+    # Default parameters #
+    ######################
+
+    build-days-to-keep: 200
+    build-timeout: 60
+    build-node: centos7-builder-8c-8g
+    submodule-recursive: true
+
+    #####################
+    # Job Configuration #
+    #####################
+
+    project-type: freestyle
+    node: '{build-node}'
+
+    properties:
+      - lf-infra-properties:
+          build-days-to-keep: '{build-days-to-keep}'
+
+    parameters:
+      - lf-infra-parameters:
+          project: '{project}'
+          branch: '{branch}'
+          stream: '{stream}'
+          lftools-version: '{lftools-version}'
+
+    wrappers:
+      - lf-infra-wrappers:
+          build-timeout: '{build-timeout}'
+          jenkins-ssh-credential: '{jenkins-ssh-credential}'
+
+    gerrit_verify_triggers:
+      - patchset-created-event:
+          exclude-drafts: false
+          exclude-trivial-rebase: false
+          exclude-no-code-change: false
+      - draft-published-event
+      - comment-added-contains-event:
+          comment-contains-value: '^build-binary'
+
+    scm:
+      - lf-infra-gerrit-scm:
+          jenkins-ssh-credential: '{jenkins-ssh-credential}'
+          git-url: '{git-url}/{project}.git'
+          refspec: '$GERRIT_REFSPEC'
+          branch: '$GERRIT_BRANCH'
+          submodule-recursive: '{submodule-recursive}'
+          submodule-timeout: '{submodule-timeout}'
+          choosing-strategy: default
+
+    triggers:
+      - gerrit:
+          server-name: '{gerrit-server-name}'
+          trigger-on: '{obj:gerrit_verify_triggers}'
+          projects:
+            - project-compare-type: ANT
+              project-pattern: '{project}'
+              branches:
+                - branch-compare-type: ANT
+                  branch-pattern: '**/{branch}'
+
+    builders:
+      - lf-infra-pre-build
+      - shell: !include-raw-escape:
+          - ../shell/install_go.sh
+      - shell: !include-raw-escape:
+          - ../shell/build_openshift_install_libvirt_binary.sh
+
+    publishers:
+      - lf-infra-publish
index ac0e58f..262236f 100644 (file)
@@ -8,6 +8,7 @@
     jobs:
       - kni-installer-verify-installer
       - kni-installer-verify-binary
+      - kni-installer-publish-openshift-install-libvirt-binary
       - kni-installer-merge-deploy-aws
       - kni-installer-merge-deploy-libvirt
 - project:
diff --git a/jjb/shell/build_openshift_install_libvirt_binary.sh b/jjb/shell/build_openshift_install_libvirt_binary.sh
new file mode 100644 (file)
index 0000000..d6b81c3
--- /dev/null
@@ -0,0 +1,44 @@
+#!/bin/bash
+#
+# Copyright (c) 2019 Red Hat
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#        http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+set -e -u -x -o pipefail
+
+export PATH=$PATH:/usr/local/go/bin:/usr/local/bin
+KNI_PATH='src/gerrit.akraino.org/kni/installer'
+
+echo '---> Building Openshift Installer binary with libvirt support'
+
+
+# move to right directory in GOPATH
+mkdir -p ${WORKSPACE}/${KNI_PATH}
+export GOPATH=${WORKSPACE}
+mv cmd pkg vendor ${WORKSPACE}/${KNI_PATH}/
+
+# first build kni installer
+make build 2>&1 | tee ${WORKSPACE}/build.log
+
+# now build the openshift-install binary and copy to gopath
+make binary 2>&1 | tee ${WORKSPACE}/binary.log
+
+# publish openshift-install binary in a versioned way
+source /tmp/ocp_installer_version
+export NEXUS_URL=https://nexus.akraino.org
+export GROUP_ID=org.akraino.kni
+export NEXUS_REPO_ID=snapshots
+export ARTIFACT_ID=openshift-install
+export VERSION=$(echo $INSTALLER_GIT_TAG | sed 's/^v//')
+export PACKAGING=bin
+export FILE=bin/openshift-install
+lftools deploy file $NEXUS_URL $NEXUS_REPO_ID $GROUP_ID $ARTIFACT_ID $VERSION $PACKAGING $FILE