[validation] Improve relationship between jobs 42/2242/2
authorCristina Pauna <cristina.pauna@enea.com>
Tue, 18 Feb 2020 14:21:31 +0000 (16:21 +0200)
committerCristina Pauna <cristina.pauna@enea.com>
Wed, 19 Feb 2020 12:00:47 +0000 (14:00 +0200)
- Added a fix so that when bluval-run-daily-tests job fails, the upstream
akraino-validation-lab-daily job also fails.
- Made the validation parameters more generic (the tests can be ran on
openstack too, not just on k8s clusters)
- Moved the templates from the project folder to the templates folder

JIRA: VAL-98

Signed-off-by: Cristina Pauna <cristina.pauna@enea.com>
Change-Id: I915ff9a0347e20390b297483b39a051f39fdf205

jjb/akraino-templates/akraino-validation-macros.yaml
jjb/akraino-templates/akraino-validation-templates.yaml
jjb/iec/iec.yaml
jjb/shell/run_bluval.sh
jjb/validation/bluval.yaml
jjb/validation/lab.yaml

index 844cfbe..c484efd 100644 (file)
           stream: '{stream}'
           branch: '{branch}'
 
+- parameter:
+    name: bluval-defaults
+    parameters:
+      - string: &cluster_master_ip
+          name: CLUSTER_MASTER_IP
+          default: ''
+          description: 'IP address to connect to the cluster master'
+      - string: &cluster_ssh_user
+          name: CLUSTER_SSH_USER
+          default: ''
+          description: 'SSH username to connect to the cluster master '
+      - string: &cluster_ssh_password
+          name: CLUSTER_SSH_PASSWORD
+          default: ''
+          description: 'SSH password to connect to the cluster master'
+      - string: &cluster_ssh_key
+          name: CLUSTER_SSH_KEY
+          default: ''
+          description: 'SSH key to connect to the cluster master'
+      - string: &blueprint_name
+          name: BLUEPRINT
+          default: ''
+          description: 'Blueprint used'
+      - string: &layer
+          name: LAYER
+          default: ''
+          description: 'Layer'
+      - string: &version
+          name: VERSION
+          default: ''
+          description: 'Version'
+      - string: &optional
+          name: OPTIONAL
+          default: ''
+          description: 'If set to yes run optional tests'
+      - string:
+          name: LAB_SILO
+          default: ''
+          description: 'Folder in nexus where the logs are pushed.'
+      - string:
+          name: SETTINGS_FILE
+          default: '/home/jenkins/settings.xml'
+          description: 'Path to credentials file'
+
+- parameter:
+    name: lab_params
+    parameters:
+      - string:
+          <<: *cluster_master_ip
+      - string:
+          <<: *cluster_ssh_user
+      - string:
+          <<: *cluster_ssh_password
+      - string:
+          <<: *cluster_ssh_key
+      - string:
+          <<: *blueprint_name
+      - string:
+          <<: *layer
+      - string:
+          <<: *version
+      - string:
+          <<: *optional
+
 ############
 # SETTINGS #
 ############
index b34638e..d2a57f1 100644 (file)
 
     publishers:
       - email:
-          recipients: 'cristina.pauna@enea.com'
+          recipients: >
+            cristina.pauna@enea.com
+            juha.kosonen@nokia.com
+
 
 - job-template:
     id: akraino-validation-docker-specific-arch
           if [ -f tag_version.sh ]; then source tag_version.sh; fi
           for sd in docker/*/.; do make -k -C $sd .push_manifest; done
           rm -f tag_version.sh
+
+- job-template:
+    id: akraino-validation-lab-daily
+    name: 'validation-{validation_lab}-daily-{stream}'
+    concurrent: true
+    node: '{build-node}'
+    parameters:
+      - {'lab_params'}
+    builders:
+      - trigger-builds:
+          - project: 'bluval-daily-{stream}'
+            predefined-parameters:
+              LAB_SILO={validation_lab}
+            same-node: true
+            current-parameters: true
+            block: true
+
+- job-template:
+    id: bluval-run-daily-tests
+    name: 'bluval-daily-{stream}'
+    concurrent: true
+    node: '{build-node}'
+    parameters:
+      - string:
+          name: DEPLOY_SCENARIO
+          default: ''
+      - {'bluval-defaults'}
+
+    scm:
+      - git:
+          credentials-id: '{jenkins-ssh-credential}'
+          url: '{git-url}/validation.git'
+          refspec: ''
+          branches:
+            - 'refs/heads/{branch}'
+          skip-tag: true
+          wipe-workspace: true
+          submodule:
+            disable: true
+            recursive: false
+            timeout: '{submodule-timeout}'
+          choosing-strategy: default
+
+    builders:
+      - description-setter:
+          description: "POD: $NODE_NAME"
+      - lf-infra-create-netrc:
+          server-id: logs
+      - shell: !include-raw-escape:
+        - ../shell/run_bluval.sh
+
+    publishers:
+      - logparser:
+          use-project-rules: true
+          parse-rules: "./bluval/rules.txt"
+          unstable-on-warning: true
+          fail-on-error: true
+          show-graphs: false
index 5b8db9f..573faf1 100644 (file)
             same-node: true
             current-parameters: true
             predefined-parameters: |
+              CLUSTER_MASTER_IP=$K8S_MASTER_IP
+              CLUSTER_SSH_USER=$K8S_SSH_USER
+              CLUSTER_SSH_PASSWORD=$K8S_SSH_PASSWORD
+              CLUSTER_SSH_KEY=$K8S_SSH_KEY
               BLUEPRINT={project-name}
               LAYER=k8s
               VERSION=master
index de42ca0..3bb4a6f 100755 (executable)
@@ -37,7 +37,7 @@ usage() {
     echo "[-n <blueprint_name>">&2
     echo "[-b <blueprint_yaml> blueprint definition">&2
     echo "[-k <k8s_config_dir> k8s config dir">&2
-    echo "[-j <k8s_master> k8s master">&2
+    echo "[-j <cluster_master_ip> cluster master IP">&2
     echo "[-u <ssh_user> ssh user">&2
     echo "[-s <ssh_key>] path to ssh key">&2
     echo "[-c <custmom_var_file> ] path to variables yaml file">&2
@@ -67,7 +67,7 @@ error () {
 # Get options from shell
 while getopts "j:k:u:s:b:l:r:n:ov:" optchar; do
     case "${optchar}" in
-        j) k8s_master=${OPTARG} ;;
+        j) cluster_master_ip=${OPTARG} ;;
         k) k8s_config_dir=${OPTARG} ;;
         s) ssh_key=${OPTARG} ;;
         b) blueprint_yaml=${OPTARG} ;;
@@ -95,7 +95,7 @@ fi
 input="$cwd/kube"
 
 # Initialize ssh key used
-ssh_key=${ssh_key:-$K8S_SSH_KEY}
+ssh_key=${ssh_key:-$CLUSTER_SSH_KEY}
 # K8s config directory
 k8s_config_dir=${k8s_config_dir:-$input}
 mkdir -p "$k8s_config_dir"
@@ -103,26 +103,25 @@ mkdir -p "$k8s_config_dir"
 # Testing configuration
 version=${version:-$VERSION}
 results_dir=$cwd/results
-k8s_master=${k8s_master:-$K8S_MASTER_IP}
-ssh_user=${sh_user:-$K8S_SSH_USER}
+cluster_master_ip=${cluster_master_ip:-$CLUSTER_MASTER_IP}
+ssh_user=${sh_user:-$CLUSTER_SSH_USER}
 blueprint_layer=${blueprint_layer:-$LAYER}
 
-# If blueprint layer is not defined use k8s by default
 if [ "$blueprint_layer" == "k8s" ]
 then
-    if [ -z "$k8s_master" ]
+    if [ -z "$cluster_master_ip" ]
     then
         usage
-        error "Please provide valid k8s IP address."
+        error "Please provide valid IP address to access the k8s cluster."
     fi
-    verify_connectivity "${k8s_master}"
-    if [[ -n $K8S_SSH_PASSWORD ]]
+    verify_connectivity "${cluster_master_ip}"
+    if [[ -n $CLUSTER_SSH_PASSWORD ]]
     then
-        sshpass -p "${K8S_SSH_PASSWORD}" scp -oUserKnownHostsFile=/dev/null -oStrictHostKeyChecking=no -r\
-             "${ssh_user}@${k8s_master}:~/.kube/*" "$k8s_config_dir"
+        sshpass -p "${CLUSTER_SSH_PASSWORD}" scp -oUserKnownHostsFile=/dev/null -oStrictHostKeyChecking=no -r\
+             "${ssh_user}@${cluster_master_ip}:~/.kube/*" "$k8s_config_dir"
     else
         scp -oUserKnownHostsFile=/dev/null -oStrictHostKeyChecking=no -i"$ssh_key" -r\
-            "${ssh_user}"@"${k8s_master}":~/.kube/* "$k8s_config_dir"
+            "${ssh_user}"@"${cluster_master_ip}":~/.kube/* "$k8s_config_dir"
     fi
 fi
 
index b052789..df9897f 100644 (file)
           gs-pathname: ''
           disabled: false
     jobs:
-      - bluval-daily-{stream}
-
-##############
-# PARAMETERS #
-##############
-- parameter:
-    name: 'bluval-defaults'
-    parameters:
-      - string:
-          <<: *k8s_master_ip
-      - string:
-          <<: *k8s_ssh_user
-      - string:
-          <<: *k8s_ssh_password
-      - string:
-          <<: *k8s_ssh_key
-      - string: &blueprint_name
-          name: BLUEPRINT
-          default: ''
-          description: 'Blueprint used'
-      - string: &layer
-          name: LAYER
-          default: ''
-          description: 'Layer'
-      - string: &version
-          name: VERSION
-          default: ''
-          description: 'Version'
-      - string: &optional
-          name: OPTIONAL
-          default: ''
-          description: 'If set to yes run optional tests'
-      - string:
-          name: LAB_SILO
-          default: ''
-          description: 'Folder in nexus where the logs are pushed.'
-      - string:
-          name: SETTINGS_FILE
-          default: '/home/jenkins/settings.xml'
-          description: 'Path to credentials file'
-
-- job-template:
-    name: 'bluval-daily-{stream}'
-    concurrent: true
-    node: '{build-node}'
-    parameters:
-      - string:
-          name: DEPLOY_SCENARIO
-          default: ''
-      - {'bluval-defaults'}
-
-    wrappers: *wrappers
-    scm:
-      - git:
-          credentials-id: '{jenkins-ssh-credential}'
-          url: '{git-url}/validation.git'
-          refspec: ''
-          branches:
-            - 'refs/heads/{branch}'
-          skip-tag: true
-          wipe-workspace: true
-          submodule:
-            disable: true
-            recursive: false
-            timeout: '{submodule-timeout}'
-          choosing-strategy: default
-
-    builders:
-      - description-setter:
-          description: "POD: $NODE_NAME"
-      - lf-infra-create-netrc:
-          server-id: logs
-      - shell: !include-raw-escape:
-        - ../shell/run_bluval.sh
-
-    publishers:
-      - logparser:
-          use-project-rules: true
-          parse-rules: "./bluval/rules.txt"
-          unstable-on-warning: true
-          fail-on-error: true
-          show-graphs: false
+      - bluval-run-daily-tests
index c163199..e29f46a 100644 (file)
     validation_lab:
       - enea
     jobs:
-      - validation-{validation_lab}-daily-{stream}
-
-##############
-# PARAMETERS #
-##############
-- parameter:
-    name: 'lab_params'
-    parameters:
-      - string:
-          <<: *k8s_master_ip
-      - string:
-          <<: *k8s_ssh_user
-      - string:
-          <<: *k8s_ssh_password
-      - string:
-          <<: *k8s_ssh_key
-      - string:
-          <<: *blueprint_name
-      - string:
-          <<: *layer
-      - string:
-          <<: *version
-      - string:
-          <<: *optional
-
-- job-template:
-    name: 'validation-{validation_lab}-daily-{stream}'
-    parameters:
-      - {'lab_params'}
-    builders:
-      - trigger-builds:
-          - project: 'bluval-daily-{stream}'
-            predefined-parameters:
-              LAB_SILO={validation_lab}
-            same-node: true
-            current-parameters: true
+      - akraino-validation-lab-daily