From: Ricardo Noriega Date: Mon, 10 Jun 2019 14:18:08 +0000 (+0200) Subject: Job to publish binary for libvirt deploys X-Git-Url: https://gerrit.akraino.org/r/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F67%2F967%2F6;p=ci-management.git Job to publish binary for libvirt deploys 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 Change-Id: Iaf06365b44e3853ebbe524afb8b7ef39dc902cb7 --- diff --git a/jjb/akraino-templates/akraino-jjb-kni.yaml b/jjb/akraino-templates/akraino-jjb-kni.yaml index ae16f98..207e2cf 100644 --- a/jjb/akraino-templates/akraino-jjb-kni.yaml +++ b/jjb/akraino-templates/akraino-jjb-kni.yaml @@ -554,3 +554,78 @@ 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 diff --git a/jjb/kni/kni_installer.yaml b/jjb/kni/kni_installer.yaml index ac0e58f..262236f 100644 --- a/jjb/kni/kni_installer.yaml +++ b/jjb/kni/kni_installer.yaml @@ -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 index 0000000..d6b81c3 --- /dev/null +++ b/jjb/shell/build_openshift_install_libvirt_binary.sh @@ -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