From: Eric Ball Date: Fri, 7 Jun 2019 14:46:50 +0000 (+0000) Subject: Merge "[iec] Add Fuel uninstall script & build step" X-Git-Url: https://gerrit.akraino.org/r/gitweb?p=ci-management.git;a=commitdiff_plain;h=99396e26f0af0a9cf553c56dd09e2f5786a310a4;hp=49a96628c9b08241556802791fb3a90973a780a1 Merge "[iec] Add Fuel uninstall script & build step" --- diff --git a/jjb/akraino-templates/akraino-jjb-kni.yaml b/jjb/akraino-templates/akraino-jjb-kni.yaml index 31429fb..ae16f98 100644 --- a/jjb/akraino-templates/akraino-jjb-kni.yaml +++ b/jjb/akraino-templates/akraino-jjb-kni.yaml @@ -15,8 +15,8 @@ # limitations under the License. # - job-template: - id: kni-installer-build-installer - name: '{project-name}-build-installer' + id: kni-installer-verify-installer + name: '{project-name}-verify-installer' ###################### # Default parameters # @@ -50,11 +50,6 @@ build-timeout: '{build-timeout}' jenkins-ssh-credential: '{jenkins-ssh-credential}' - gerrit_merge_triggers: - - change-merged-event - - comment-added-contains-event: - comment-contains-value: remerge$ - gerrit_trigger_file_paths: - compare-type: ANT pattern: '**' @@ -69,10 +64,19 @@ 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_merge_triggers}' + trigger-on: '{obj:gerrit_verify_triggers}' projects: - project-compare-type: ANT project-pattern: '{project}' @@ -92,8 +96,8 @@ - lf-infra-publish - job-template: - id: kni-installer-build-binary - name: '{project-name}-build-binary' + id: kni-installer-verify-binary + name: '{project-name}-verify-binary' ###################### # Default parameters # @@ -127,17 +131,21 @@ build-timeout: '{build-timeout}' jenkins-ssh-credential: '{jenkins-ssh-credential}' - gerrit_merge_triggers: - - change-merged-event - - comment-added-contains-event: - comment-contains-value: remerge$ - gerrit_trigger_file_paths: - compare-type: REG_EXP pattern: 'Makefile' - compare-type: REG_EXP pattern: 'cmd/binary.go' + gerrit_verify_triggers: + - patchset-created-event: + execlude-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)$' + scm: - lf-infra-gerrit-scm: jenkins-ssh-credential: '{jenkins-ssh-credential}' @@ -151,16 +159,14 @@ triggers: - gerrit: server-name: '{gerrit-server-name}' - trigger-on: - - patchset-created-event: - exclude-drafts: 'false' - exclude-trivial-rebase: 'false' - exclude-no-code-change: 'false' - - change-merged-event - - comment-added-contains-event: - comment-contains-value: 'recheck' - - comment-added-contains-event: - comment-contains-value: 'reverify' + 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 @@ -169,6 +175,9 @@ - shell: !include-raw-escape: - ../shell/build_kni_binary.sh + publishers: + - lf-infra-publish + - job-template: id: kni-installer-merge-deploy-aws name: '{project-name}-merge-deploy-aws' @@ -266,6 +275,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 +459,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/iec/iec-compass-build.sh b/jjb/iec/iec-compass-build.sh index 2014b80..3a5e2d8 100755 --- a/jjb/iec/iec-compass-build.sh +++ b/jjb/iec/iec-compass-build.sh @@ -1,6 +1,29 @@ #!/bin/bash set -e +check_env(){ + #Checking python-pip software status. If failed, reinstall it. + set +e + sudo pip --version + CHECK_PIP_SUDO=$? + + pip --version + CHECK_PIP_USER=$? + set -e + + #Check command result, if failed, reinstall the pip + if [ ${CHECK_PIP_SUDO} -ne 0 ] || [ ${CHECK_PIP_USER} -ne 0 ]; then + echo "Reinstall pip" + sudo python -m pip uninstall -y pip + curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py + sudo python get-pip.py pip + rm get-pip.py + hash -r + fi +} + +check_env + echo "begin build compass" git clone https://github.com/opnfv/compass4nfv.git @@ -15,8 +38,6 @@ sudo docker rm -f `docker ps | grep compass | cut -f1 -d' '` || true curl -s http://people.linaro.org/~yibo.cai/compass/compass4nfv-arm64-fixup.sh | bash || true -sed -i "s/sudo pip install pyyaml/python -m pip install pyyaml --user/g" build.sh - ./build.sh exit 0 diff --git a/jjb/kni/kni_installer.yaml b/jjb/kni/kni_installer.yaml index 90dfca1..ac0e58f 100644 --- a/jjb/kni/kni_installer.yaml +++ b/jjb/kni/kni_installer.yaml @@ -6,9 +6,10 @@ stream: master branch: master jobs: - - kni-installer-build-installer - - kni-installer-build-binary + - kni-installer-verify-installer + - kni-installer-verify-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