From ae2d70f55587ca3677df1e155cf4770af0e92156 Mon Sep 17 00:00:00 2001 From: Cristina Pauna Date: Mon, 18 Mar 2019 19:14:03 +0200 Subject: [PATCH] [iec] Add deploy jobs Change-Id: I8ea94a17c06e75ce222535685ca6b132817414ac Signed-off-by: Cristina Pauna --- jjb/iec/iec-fuel-deploy.sh | 77 +++++++++++++++++++++ jjb/iec/iec.yaml | 162 ++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 237 insertions(+), 2 deletions(-) create mode 100644 jjb/iec/iec-fuel-deploy.sh diff --git a/jjb/iec/iec-fuel-deploy.sh b/jjb/iec/iec-fuel-deploy.sh new file mode 100644 index 0000000..069c685 --- /dev/null +++ b/jjb/iec/iec-fuel-deploy.sh @@ -0,0 +1,77 @@ +#!/bin/bash +# SPDX-license-identifier: Apache-2.0 +############################################################################## +# Copyright (c) 2019 Enea Software AB and others. +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## +set -o nounset + +export TERM="vt220" + +# set deployment parameters +export TMPDIR=${HOME}/tmpdir +if [ "$(uname -m)" = 'aarch64' ]; then + LAB_NAME='arm' + # shellcheck disable=SC2153 + POD_NAME=${NODE_NAME/*ubuntu1604-dev-48c-256g-/virtual} +else + echo "Unavailable hardware. Cannot continue!" + exit 1 +fi + +echo "Using configuration for ${LAB_NAME}" + +# create TMPDIR if it doesn't exist, change permissions +mkdir -p "${TMPDIR}" +sudo chmod a+x "${HOME}" "${TMPDIR}" + +cd "${WORKSPACE}" || exit 1 + +# log file name +# shellcheck disable=SC2153 +FUEL_LOG_FILENAME="${JOB_NAME}_${BUILD_NUMBER}.log.tar.gz" + +# turn on DEBUG mode +[ "${CI_DEBUG,,}" == 'true' ] && EXTRA_ARGS="-D ${EXTRA_ARGS:-}" + +# construct the command +git clone https://github.com/opnfv/fuel.git + +DEPLOY_COMMAND="fuel/ci/deploy.sh \ + -l ${LAB_NAME} -p ${POD_NAME} -s ${DEPLOY_SCENARIO} \ + -S ${TMPDIR} ${EXTRA_ARGS:-} \ + -b file://${WORKSPACE}/ci + -L ${WORKSPACE}/${FUEL_LOG_FILENAME}" + +# log info to console +echo "Deployment parameters" +echo "--------------------------------------------------------" +echo "Scenario: ${DEPLOY_SCENARIO}" +echo "Lab: ${LAB_NAME}" +echo "POD: ${POD_NAME}" +echo +echo "Starting the deployment using Fuel. This could take some time..." +echo "--------------------------------------------------------" +echo + +# start the deployment +echo "Issuing command" +echo "${DEPLOY_COMMAND}" + +${DEPLOY_COMMAND} +exit_code=$? + +echo +echo "--------------------------------------------------------" +echo "Deployment is done!" + +if [ "${exit_code}" -ne 0 ]; then + echo "Deployment failed!" + exit "${exit_code}" +fi + +echo "Deployment is successful!" +exit 0 diff --git a/jjb/iec/iec.yaml b/jjb/iec/iec.yaml index b1d7d59..6594ec5 100644 --- a/jjb/iec/iec.yaml +++ b/jjb/iec/iec.yaml @@ -1,6 +1,164 @@ --- - project: - name: iec-project-view - project-name: iec + name: 'iec' + project-name: 'iec' + project: '{project-name}' views: - project-view + # ------------------------------- + # BRANCH DEFINITIONS + # ------------------------------- + stream: + - master: + branch: '{stream}' + gs-pathname: '' + disabled: false + + # ------------------------------- + # DEPLOY TYPE DEFINITIONS + # ------------------------------- + deploy-type: + - fuel-baremetal: + slave-label: 'aarch64_dev' + scenario: 'k8-calico-iec-noha' + - fuel-virtual: + slave-label: 'aarch64_dev' + scenario: 'k8-calico-iec-noha' + + jobs: + - 'iec-{deploy-type}-daily-{stream}' + - 'iec-deploy-{deploy-type}-daily-{stream}' + +############## +# PARAMETERS # +############## +- parameter: + name: 'iec-defaults' + parameters: + - string: + name: INSTALLER_IP + default: '10.20.0.2' + description: 'IP of the installer' + - string: + name: SSH_KEY + default: "/var/lib/opnfv/mcp.rsa" + description: 'Path to private SSH key to access environment nodes' + - string: + name: EXTERNAL_NETWORK + default: 'floating_net' + description: 'external network for test' + - string: + name: CI_DEBUG + default: 'false' + description: "Show debug output information" + +######################## +# job templates +######################## +- job-template: + name: 'iec-{deploy-type}-daily-{stream}' + disabled: '{obj:disabled}' + concurrent: false + node: '{slave-label}' + properties: + - throttle: + enabled: true + max-total: 4 + max-per-node: 1 + option: 'project' + - build-blocker: + use-build-blocker: true + blocking-jobs: + - '.*-{deploy-type}-daily-.*' + blocking-level: 'NODE' + + wrappers: + - build-name: + name: '$BUILD_NUMBER - Scenario: $DEPLOY_SCENARIO' + + triggers: + - 'iec-{deploy-type}-daily-{stream}-trigger' + + parameters: + - lf-infra-parameters: + project: '{project}' + stream: '{stream}' + branch: '{branch}' + - '{project}-defaults' + - string: + name: DEPLOY_SCENARIO + default: 'k8-calico-iec-noha' + + builders: + - trigger-builds: + - project: 'iec-deploy-{deploy-type}-daily-{stream}' + current-parameters: false + predefined-parameters: | + DEPLOY_SCENARIO={scenario} + INSTALLER_VERSION={stream} + same-node: true + block: true + +- job-template: + name: 'iec-deploy-{deploy-type}-daily-{stream}' + concurrent: true + node: '{slave-label}' + properties: + - throttle: + enabled: true + max-total: 4 + max-per-node: 1 + option: 'project' + - build-blocker: + use-build-blocker: true + blocking-jobs: + - '.*-deploy-{deploy-type}-daily-*' + blocking-level: 'NODE' + + parameters: + - lf-infra-parameters: + project: '{project}' + stream: '{stream}' + branch: '{branch}' + - '{project}-defaults' + - string: + name: DEPLOY_SCENARIO + default: 'k8-calico-iec-noha' + + wrappers: + - build-name: + name: '$BUILD_NUMBER - Scenario: $DEPLOY_SCENARIO' + + scm: + - lf-infra-gerrit-scm: + jenkins-ssh-credential: '{jenkins-ssh-credential}' + git-url: '{git-url}/{project}.git' + refspec: '' + branch: '{branch}' + submodule-recursive: false + submodule-timeout: '{submodule-timeout}' + choosing-strategy: default + + builders: + - shell: + !include-raw-escape: ./iec-fuel-deploy.sh + + publishers: + - email: + recipients: armband@enea.com + +######################## +# trigger macros +######################## +# CI PODs +# ---------------------------------------------------------------- +# Akraino IEC CI Baremetal Triggers running against master branch +# ---------------------------------------------------------------- +- trigger: + name: 'iec-fuel-virtual-daily-master-trigger' + triggers: + - timed: '0 1 * * *' +- trigger: + name: 'iec-fuel-baremetal-daily-master-trigger' + triggers: + - timed: '' -- 2.16.6