Initial job for deploying SEBA on ARM 83/583/6
authorCiprian Barbu <ciprian.barbu@enea.com>
Tue, 23 Apr 2019 15:26:02 +0000 (18:26 +0300)
committerCiprian Barbu <ciprian.barbu@enea.com>
Wed, 15 May 2019 10:21:28 +0000 (10:21 +0000)
Change-Id: Ic84813596cdc3343d4dc414e480610e46d25526e
Signed-off-by: Ciprian Barbu <ciprian.barbu@enea.com>
jjb/iec/iec-seba_on_arm.sh [new file with mode: 0644]
jjb/iec/iec.yaml

diff --git a/jjb/iec/iec-seba_on_arm.sh b/jjb/iec/iec-seba_on_arm.sh
new file mode 100644 (file)
index 0000000..2db62c7
--- /dev/null
@@ -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
index b0cc699..4cb9440 100644 (file)
           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
       - 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
       - '{project}-defaults'
       - string:
           name: DEPLOY_SCENARIO
-          default: 'k8-calico-iec-noha'
+          default: '{scenario}'
 
     builders:
       - trigger-builds:
             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
 
       - '{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'
       - 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
 ########################