From 6277a5e1f4552da09f0b62ee223e0ace32364eb8 Mon Sep 17 00:00:00 2001 From: Ciprian Barbu Date: Tue, 23 Apr 2019 18:26:02 +0300 Subject: [PATCH] Initial job for deploying SEBA on ARM Change-Id: Ic84813596cdc3343d4dc414e480610e46d25526e Signed-off-by: Ciprian Barbu --- jjb/iec/iec-seba_on_arm.sh | 50 +++++++++++++++++++++++++++++ jjb/iec/iec.yaml | 78 ++++++++++++++++++++++++++++++++++++++++++---- 2 files changed, 122 insertions(+), 6 deletions(-) create mode 100644 jjb/iec/iec-seba_on_arm.sh diff --git a/jjb/iec/iec-seba_on_arm.sh b/jjb/iec/iec-seba_on_arm.sh new file mode 100644 index 0000000..2db62c7 --- /dev/null +++ b/jjb/iec/iec-seba_on_arm.sh @@ -0,0 +1,50 @@ +#!/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 +############################################################################## + +export TERM="vt220" + +echo "JOB_NAME=${JOB_NAME}" + +case "${JOB_NAME}" in + *fuel*) + K8S_MASTER_IP=$(docker exec fuel cat /etc/hosts | grep iec01 \ + | awk '{print $1}') + # On Fuel deployements the K8s ssh key is the one used by the deploy job + K8S_SSH_KEY=${SSH_KEY} + IEC_DIR="/home/${K8S_SSH_USER}/iec" + ;; + *) + echo "Cannot determine installer from ${JOB_NAME}" + exit 1 + ;; +esac + +if [ -z "$K8S_SSH_USER" ] +then + echo "K8S_SSH_USER not set, cannot ssh to install SEBA" + exit 1 +fi + +INSTALL_CMD="cd ${IEC_DIR}/src/use_cases/seba_on_arm/install; ./install.sh" + +if [ -n "${K8S_SSH_PASSWORD}" ] +then + sshpass -o StrictHostKeyChecking=no -p "${K8S_SSH_PASSWORD}" \ + "${K8S_SSH_USER}"@"${K8S_MASTER_IP}" "${INSTALL_CMD}" +elif [ -n "${K8S_SSH_KEY}" ] +then + ssh -o StrictHostKeyChecking=no -i "${K8S_SSH_KEY}" \ + "${K8S_SSH_USER}"@"${K8S_MASTER_IP}" "${INSTALL_CMD}" +else + echo "Neither K8S_SSH_USER or K8S_SSH_KEY set. Cannot ssh to K8S Master" + exit 1 +fi + +exit 0 diff --git a/jjb/iec/iec.yaml b/jjb/iec/iec.yaml index b0cc699..4cb9440 100644 --- a/jjb/iec/iec.yaml +++ b/jjb/iec/iec.yaml @@ -28,9 +28,18 @@ slave-label: 'aarch64_dev' scenario: 'k8-calico-iec-noha' + # ------------------------------- + # USECASE DEFINITIONS + # ------------------------------- + usecase: + - seba_on_arm: + slave-label: 'aarch64_dev' + scenario: 'k8-calico-iec-noha' + jobs: - 'iec-{deploy-type}-daily-{stream}' - 'iec-deploy-{deploy-type}-daily-{stream}' + - 'iec-install-{usecase}-{deploy-type}-daily-{stream}' ############## # PARAMETERS # @@ -44,7 +53,7 @@ description: 'IP of the installer' - string: name: SSH_KEY - default: "/var/lib/opnfv/mcp.rsa" + default: '/var/lib/opnfv/mcp.rsa' description: 'Path to private SSH key to access environment nodes' - string: name: EXTERNAL_NETWORK @@ -53,7 +62,22 @@ - string: name: CI_DEBUG default: 'false' - description: "Show debug output information" + description: 'Show debug output information' +- parameter: + name: 'seba_on_arm-defaults' + parameters: + - string: + name: K8S_SSH_USER + default: 'ubuntu' + description: 'SSH username to connect to the K8s master ' + - string: + name: K8S_SSH_PASSWORD + default: '' + description: 'SSH password to connect to the K8s master' + - string: + name: K8S_SSH_KEY + default: '' + description: 'SSH key to connect to the K8s master' ######################## # job templates @@ -90,7 +114,7 @@ - '{project}-defaults' - string: name: DEPLOY_SCENARIO - default: 'k8-calico-iec-noha' + default: '{scenario}' builders: - trigger-builds: @@ -98,7 +122,10 @@ current-parameters: false predefined-parameters: | DEPLOY_SCENARIO={scenario} - INSTALLER_VERSION={stream} + same-node: true + block: true + - project: 'iec-install-{usecase}-daily-{stream}' + current-parameters: false same-node: true block: true @@ -126,13 +153,13 @@ - '{project}-defaults' - string: name: DEPLOY_SCENARIO - default: 'k8-calico-iec-noha' + default: '{scenario}' wrappers: - build-name: name: '$BUILD_NUMBER - Scenario: $DEPLOY_SCENARIO' - scm: + scm: &scm - git: credentials-id: '{jenkins-ssh-credential}' url: '{git-url}/{project}.git' @@ -173,6 +200,45 @@ - email: recipients: armband@enea.com +- job-template: + name: 'iec-install-{usecase}-{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-*' + - '.*-install-{usecase}-{deploy-type}-daily-*' + blocking-level: 'NODE' + + parameters: + - lf-infra-parameters: + project: '{project}' + stream: '{stream}' + branch: '{branch}' + - '{project}-defaults' + - '{usecase}-defaults' + + wrappers: + - build-name: + name: '$BUILD_NUMBER - Usecase: ${usecase} DeployType: ${deploy-type}' + + scm: *scm + + builders: + - shell: + !include-raw-escape: ./iec-{usecase}.sh + + publishers: + - email: + recipients: armband@enea.com + ######################## # trigger macros ######################## -- 2.16.6