From: Andrew Fenner Date: Tue, 4 Aug 2020 08:06:40 +0000 (+0000) Subject: Merge "Modify ONAP verify job to include k8s deployment" X-Git-Url: https://gerrit.nordix.org/gitweb?a=commitdiff_plain;h=d1f624a27b65afbabbcb482e91ea833b2e140193;hp=174b317cf7dae72ff5437ba98597634a662a0742;p=infra%2Fcicd.git Merge "Modify ONAP verify job to include k8s deployment" --- diff --git a/jjb/cloud-infra/engine-macros.yaml b/jjb/cloud-infra/engine-macros.yaml index 9fe9404f..27381e03 100644 --- a/jjb/cloud-infra/engine-macros.yaml +++ b/jjb/cloud-infra/engine-macros.yaml @@ -116,10 +116,14 @@ builders: - shell: !include-raw: ./scripts/generate-release-metadata.sh +- builder: + name: 'generate-k8sdeployment-environment-macro' + builders: + - shell: + !include-raw: ./scripts/generate-k8sdeployment-environment.sh - builder: name: 'promote-macro' builders: - shell: !include-raw: ./scripts/promote.sh - diff --git a/jjb/cloud-infra/onap-jobs/onap-verify-deploy-test.yaml b/jjb/cloud-infra/onap-jobs/onap-verify-deploy-test.yaml index 167bc765..4ac3caf3 100644 --- a/jjb/cloud-infra/onap-jobs/onap-verify-deploy-test.yaml +++ b/jjb/cloud-infra/onap-jobs/onap-verify-deploy-test.yaml @@ -25,13 +25,16 @@ stream: - 'master': branch: '{stream}' - deploy-scenario: 'onap-sdc-full' + k8s-version: '1.15' + deploy-scenario: 'onap-sdc-nofeature' - 'frankfurt': branch: '{stream}' - deploy-scenario: 'onap-sdc-full' + k8s-version: '1.15' + deploy-scenario: 'onap-sdc-nofeature' - 'elalto': branch: '{stream}' - deploy-scenario: 'onap-sdc-full' + k8s-version: '1.15' + deploy-scenario: 'onap-sdc-nofeature' environment-type: - online: @@ -48,17 +51,17 @@ failed: false unstable: false notbuilt: false - + # just deploy phase for now and ONAP testing isn't defined yet phase: - deploy - - functest + type: - cloud: provisioner-type: 'heat' slave-type: 'jumphost' gated-projects: 'infra/stack/onap|infra/installer/oom' - pdf: "https://gerrit.nordix.org/gitweb?p=infra/provisioner/heat.git;a=blob_plain;f=playbooks/roles/create-stack/files/heat-environment-ci-city-ubuntu1804.yaml" + pdf: "https://gerrit.nordix.org/gitweb?p=infra/provisioner/heat.git;a=blob_plain;f=playbooks/roles/create-stack/files/heat-environment-ci-city-ubuntu1804-onap.yaml" idf: "https://gerrit.nordix.org/gitweb?p=infra/provisioner/heat.git;a=blob_plain;f=playbooks/roles/create-stack/files/heat-idf.yaml" distro: @@ -68,12 +71,12 @@ - city: openrc-credentials-file: 'est-jenkins-openrcfile-city-frankfurt-cicd' + # This should be dependency-jobs: 'onap-verify-package-{distro}-{stream}' dependency-job-var: 'TRIGGER_onap_verify_package_{distro}_{stream}_BUILD_RESULT' jobs: - 'onap-verify-{environment-type}-deploy-test-{distro}-{cloud}-{type}-{stream}' - - 'onap-verify-{environment-type}-{phase}-{distro}-{cloud}-{type}-{stream}' - job-template: name: 'onap-verify-{environment-type}-deploy-test-{distro}-{cloud}-{type}-{stream}' @@ -89,6 +92,14 @@ name: DEPLOY_SCENARIO default: '{deploy-scenario}' description: 'Scenario to test change with.' + - string: + name: K8S_VERSION + default: '{k8s-version}' + description: 'K8S version to use for this deployment' + - string: + name: INVENTORY_INI + default: /tmp/inventory.ini + description: 'Location of the inventory file. Copied from k8s install' - string: name: DISTRO default: '{distro}' @@ -255,31 +266,26 @@ builders: - 'generate-change-metadata-macro' + - 'generate-k8sdeployment-environment-macro' - multijob: name: "{environment-type} deployment on {type} instances" condition: SUCCESSFUL - execution-type: PARALLEL + execution-type: SEQUENTIAL projects: - - name: 'onap-verify-{environment-type}-deploy-{distro}-city-{type}-{stream}' + - name: 'onap-verify-{environment-type}-deployk8s-{distro}-city-{type}-{stream}' current-parameters: true git-revision: true node-parameters: true kill-phase-on: FAILURE abort-all-job: false - property-file: $WORKSPACE/change.properties - - multijob: - name: "{environment-type} testing on {type} instances" - condition: SUCCESSFUL - execution-type: PARALLEL - projects: - - name: 'onap-verify-{environment-type}-functest-{distro}-city-{type}-{stream}' + property-file: $WORKSPACE/k8s.properties + - name: 'onap-verify-{environment-type}-deploy-{distro}-city-{type}-{stream}' current-parameters: true - git-revision: false + git-revision: true node-parameters: true kill-phase-on: FAILURE abort-all-job: false property-file: $WORKSPACE/change.properties - publishers: - postbuildscript: builders: @@ -295,7 +301,49 @@ - 'delete-stack-macro' - job-template: - name: 'onap-verify-{environment-type}-{phase}-{distro}-{cloud}-{type}-{stream}' + name: 'onap-verify-{environment-type}-deploy-{distro}-{cloud}-{type}-{stream}' + + disabled: '{obj:disabled}' + + concurrent: true + + properties: + - logrotate + - throttle: + max-per-node: 1 + max-total: 3 + option: project + + scm: + - git-scm-gerrit: + ssh-credentials-id: nordixinfra-nordix-gerrit-ssh + branch: $GERRIT_BRANCH + refspec: $GERRIT_REFSPEC + wipe_workspace: true + clean_before: false + + wrappers: + - build-timeout: + timeout: 180 + - credentials-binding: + - file: + credential-id: '{openrc-credentials-file}' + variable: OPENRC_FILE + - username-password-separated: + credential-id: 'nordix-cicd-arm-credentials' + username: NORDIX_ARM_USERNAME + password: NORDIX_ARM_TOKEN + - mask-passwords + - fix-workspace-permissions + + builders: + - 'generate-ssh-keypair-macro' + - 'wait-pkg-mgr-macro' + - 'download-deploy-artifact-macro' + - 'deploy-macro' + +- job-template: + name: 'onap-verify-{environment-type}-deployk8s-{distro}-{cloud}-{type}-{stream}' disabled: '{obj:disabled}' @@ -333,5 +381,5 @@ builders: - 'generate-ssh-keypair-macro' - 'wait-pkg-mgr-macro' - - 'download-{phase}-artifact-macro' - - '{phase}-macro' + - 'download-deploy-artifact-macro' + - 'deploy-macro' diff --git a/jjb/cloud-infra/scripts/generate-k8sdeployment-environment.sh b/jjb/cloud-infra/scripts/generate-k8sdeployment-environment.sh new file mode 100644 index 00000000..0098c9d2 --- /dev/null +++ b/jjb/cloud-infra/scripts/generate-k8sdeployment-environment.sh @@ -0,0 +1,74 @@ +#!/bin/bash + +# ============LICENSE_START======================================================= +# Copyright (C) 2019 The Nordix Foundation. All rights reserved. +# ================================================================================ +# 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. +# +# SPDX-License-Identifier: Apache-2.0 +# ============LICENSE_END========================================================= + + +set -o nounset +set -o errexit +set -o pipefail + +# file to record k8s properties +export K8S_DEPLOYMENT_FILE="$WORKSPACE/k8s.properties" +/bin/rm -f "$K8S_DEPLOYMENT_FILE" + +echo "Info : Generating k8s properties" + +# determine the project +# this scripts is used by all engine repos so we need to determine what this change is for +export ENGINE_COMPONENT="${GERRIT_PROJECT//*\//}" + +echo "Info : Setting STACK_TYPE and STACK_VERSION" + +export STACK_TYPE="kubernetes" +export STACK_VERSION="$K8S_VERSION" + +# record vars to properties file +echo "STACK_TYPE=$STACK_TYPE" >> "$K8S_DEPLOYMENT_FILE" +echo "DEPLOY_SCENARIO=k8-calico-nofeature" >> "$K8S_DEPLOYMENT_FILE" +echo "STACK_VERSION=$STACK_VERSION" >> "$K8S_DEPLOYMENT_FILE" +echo "NORDIX_STACK_VERSION=$K8S_VERSION" >> "$K8S_DEPLOYMENT_FILE" + +# global vars +export NORDIX_ARM_HTTPS_URL="https://artifactory.nordix.org/artifactory" +export ARTIFACT_ARM_FOLDER="release" +export BUILD_IDENTIFIER="latest" +export OFFLINE_INSTALLER_FILE="/tmp/${STACK_TYPE}-${K8S_VERSION}-${DISTRO}.bsx" +export BUILD_ARTIFACTS="/tmp/${STACK_TYPE}-${K8S_VERSION}-${DISTRO}.bsx" +export NORDIX_ARM_REPO="nordix-${STACK_TYPE}" +export NORDIX_ARTIFACT_URL="$NORDIX_ARM_HTTPS_URL/$NORDIX_ARM_REPO/oss/$ARTIFACT_ARM_FOLDER/$BUILD_IDENTIFIER" + +cat << EOF >> "$K8S_DEPLOYMENT_FILE" +BUILD_IDENTIFIER=$BUILD_IDENTIFIER +BUILD_DATE=$(date '+%Y%m%d%H%M') +BUILT_BY=$BUILD_URL +DISTRO=$DISTRO +CI_LOOP=$CI_LOOP +ENGINE_SHA=$(git rev-parse HEAD) +OFFLINE_INSTALLER_FILE=$OFFLINE_INSTALLER_FILE +BUILD_ARTIFACTS=$BUILD_ARTIFACTS +NORDIX_ARM_REPO=nordix-${STACK_TYPE} +NORDIX_ARTIFACT_URL=$NORDIX_ARTIFACT_URL +EOF + +echo "Info : K8S properties" +echo "-------------------------------------------------------------------------" +cat "$K8S_DEPLOYMENT_FILE" +echo "-------------------------------------------------------------------------" + +# vim: set ts=2 sw=2 expandtab: