From: Yolanda Robla Date: Mon, 3 Jun 2019 09:23:06 +0000 (+0200) Subject: Add new job for deploying libvirt X-Git-Url: https://gerrit.akraino.org/r/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F30%2F930%2F11;p=ci-management.git Add new job for deploying libvirt It includes verify and merge jobs, to execute a deploy on libvirt on a third-party CI. Signed-off-by: Yolanda Robla Change-Id: I0c331f36eb7461cceb6cfdab50bc54ae0a0b96c6 --- diff --git a/jjb/akraino-templates/akraino-jjb-kni.yaml b/jjb/akraino-templates/akraino-jjb-kni.yaml index 31429fb..c5a62ca 100644 --- a/jjb/akraino-templates/akraino-jjb-kni.yaml +++ b/jjb/akraino-templates/akraino-jjb-kni.yaml @@ -266,6 +266,99 @@ publishers: - lf-infra-publish +- job-template: + id: kni-installer-merge-deploy-libvirt + name: '{project-name}-merge-deploy-libvirt' + + ###################### + # Default parameters # + ###################### + + archive-artifacts: > + **/*.log + build-days-to-keep: 30 + build-timeout: 60 + build-node: kni-libvirt + 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}' + - string: + name: ARCHIVE_ARTIFACTS + default: '{archive-artifacts}' + description: Artifacts to archive to the logs server. + + wrappers: + - lf-infra-wrappers: + build-timeout: '{build-timeout}' + jenkins-ssh-credential: '{jenkins-ssh-credential}' + - credentials-binding: + - ssh-user-private-key: + credential-id: kni-secrets + key-file-variable: KNI_KEY_PATH + + gerrit_trigger_file_paths: + - compare-type: REG_EXP + pattern: '.*' + + gerrit_merge_triggers: + - change-merged-event + - comment-added-contains-event: + comment-contains-value: remerge$ + + 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_merge_triggers}' + projects: + - project-compare-type: ANT + project-pattern: '{project}' + branches: + - branch-compare-type: ANT + branch-pattern: '**/{branch}' + file-paths: '{obj:gerrit_trigger_file_paths}' + + builders: + - lf-infra-pre-build + - config-file-provider: + files: + - file-id: kni-coreos-pull-secret + target: akraino-secrets/coreos-pull-secret + - file-id: kni-ssh-pub-key + target: akraino-secrets/ssh-pub-key + - shell: !include-raw-escape: + - ../shell/install_go.sh + - shell: !include-raw-escape: + - ../shell/kni_deploy_libvirt.sh + + publishers: + - lf-infra-publish + - job-template: id: kni-templates-verify-deploy-aws name: '{project-name}-verify-deploy-aws' @@ -357,3 +450,98 @@ - ../shell/install_go.sh - shell: !include-raw-escape: - ../shell/kni_deploy_aws.sh + + publishers: + - lf-infra-publish + +- job-template: + id: kni-templates-verify-deploy-libvirt + name: '{project-name}-verify-deploy-libvirt' + + ###################### + # Default parameters # + ###################### + + build-days-to-keep: 30 + build-timeout: 60 + build-node: kni-libvirt + 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}' + - credentials-binding: + - ssh-user-private-key: + credential-id: kni-secrets + key-file-variable: KNI_KEY_PATH + + gerrit_trigger_file_paths: + - compare-type: REG_EXP + pattern: 'aws/*' + + scm: + - lf-infra-gerrit-scm: + jenkins-ssh-credential: '{jenkins-ssh-credential}' + git-url: '{git-url}/kni/installer.git' + refspec: '$GERRIT_REFSPEC' + branch: '$GERRIT_BRANCH' + submodule-recursive: '{submodule-recursive}' + submodule-timeout: '{submodule-timeout}' + choosing-strategy: default + + gerrit_verify_triggers: + - patchset-created-event: + exclude-drafts: true + exclude-trivial-rebase: false + exclude-no-code-change: false + - draft-published-event + - comment-added-contains-event: + comment-contains-value: '^Patch Set[ ]+[0-9]+:([ ]+|[\n]+)(recheck|reverify)$' + + 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}' + file-paths: '{obj:gerrit_trigger_file_paths}' + + builders: + - lf-infra-pre-build + - config-file-provider: + files: + - file-id: kni-coreos-pull-secret + target: akraino-secrets/coreos-pull-secret + - file-id: kni-ssh-pub-key + target: akraino-secrets/ssh-pub-key + - shell: !include-raw-escape: + - ../shell/install_go.sh + - shell: !include-raw-escape: + - ../shell/kni_deploy_libvirt.sh + + publishers: + - lf-infra-publish + diff --git a/jjb/kni/kni_installer.yaml b/jjb/kni/kni_installer.yaml index 90dfca1..861cbe3 100644 --- a/jjb/kni/kni_installer.yaml +++ b/jjb/kni/kni_installer.yaml @@ -9,6 +9,7 @@ - kni-installer-build-installer - kni-installer-build-binary - kni-installer-merge-deploy-aws + - kni-installer-merge-deploy-libvirt - project: name: kni-templates project: 'kni/templates' @@ -17,3 +18,4 @@ branch: master jobs: - kni-templates-verify-deploy-aws + - kni-templates-verify-deploy-libvirt diff --git a/jjb/shell/kni_deploy_libvirt.sh b/jjb/shell/kni_deploy_libvirt.sh new file mode 100755 index 0000000..22396e5 --- /dev/null +++ b/jjb/shell/kni_deploy_libvirt.sh @@ -0,0 +1,59 @@ +#!/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='go/src/gerrit.akraino.org/kni' + +echo '---> Starting kni installer generation' + +mkdir -p $HOME/${KNI_PATH}/installer +export GOPATH=${WORKSPACE} + +# do a host preparation and cleanup +bash utils/prep_host.sh +wget https://raw.githubusercontent.com/openshift/installer/master/scripts/maintenance/virsh-cleanup.sh +chmod a+x ./virsh-cleanup.sh +sudo bash -c "yes Y | ./virsh-cleanup.sh" + +# 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 + +# then start aws deploy +export MASTER_MEMORY_MB=24000 +export CREDENTIALS=file://$(pwd)/akraino-secrets +export BASE_REPO="git::https://gerrit.akraino.org/r/kni/templates" +export BASE_PATH="libvirt/3-node" +export SITE_REPO="git::https://gerrit.akraino.org/r/kni/templates" +export SETTINGS_PATH="libvirt/sample_settings.yaml" +export INSTALLER_PATH="file://${HOME}/${KNI_PATH}/installer/bin/openshift-install" +make deploy 2>&1 | tee ${WORKSPACE}/libvirt_deploy.log +STATUS=$? + +# output tfstate +echo "metadata.json for removing cluster" +cat $(pwd)/build/metadata.json + +if [ $STATUS -ne 0 ]; then + echo "Error deploying in libvirt" + exit 1 +fi + +exit $STATUS