From: Cristina Pauna Date: Tue, 18 Feb 2020 14:21:31 +0000 (+0200) Subject: [validation] Improve relationship between jobs X-Git-Url: https://gerrit.akraino.org/r/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F42%2F2242%2F2;p=ci-management.git [validation] Improve relationship between jobs - 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 Change-Id: I915ff9a0347e20390b297483b39a051f39fdf205 --- diff --git a/jjb/akraino-templates/akraino-validation-macros.yaml b/jjb/akraino-templates/akraino-validation-macros.yaml index 844cfbe..c484efd 100644 --- a/jjb/akraino-templates/akraino-validation-macros.yaml +++ b/jjb/akraino-templates/akraino-validation-macros.yaml @@ -30,6 +30,70 @@ 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 # ############ diff --git a/jjb/akraino-templates/akraino-validation-templates.yaml b/jjb/akraino-templates/akraino-validation-templates.yaml index b34638e..d2a57f1 100644 --- a/jjb/akraino-templates/akraino-validation-templates.yaml +++ b/jjb/akraino-templates/akraino-validation-templates.yaml @@ -57,7 +57,10 @@ publishers: - email: - recipients: 'cristina.pauna@enea.com' + recipients: > + cristina.pauna@enea.com + juha.kosonen@nokia.com + - job-template: id: akraino-validation-docker-specific-arch @@ -155,3 +158,61 @@ 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 diff --git a/jjb/iec/iec.yaml b/jjb/iec/iec.yaml index 5b8db9f..573faf1 100644 --- a/jjb/iec/iec.yaml +++ b/jjb/iec/iec.yaml @@ -231,6 +231,10 @@ 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 diff --git a/jjb/shell/run_bluval.sh b/jjb/shell/run_bluval.sh index de42ca0..3bb4a6f 100755 --- a/jjb/shell/run_bluval.sh +++ b/jjb/shell/run_bluval.sh @@ -37,7 +37,7 @@ usage() { echo "[-n ">&2 echo "[-b blueprint definition">&2 echo "[-k k8s config dir">&2 - echo "[-j k8s master">&2 + echo "[-j cluster master IP">&2 echo "[-u ssh user">&2 echo "[-s ] path to ssh key">&2 echo "[-c ] 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 diff --git a/jjb/validation/bluval.yaml b/jjb/validation/bluval.yaml index b052789..df9897f 100644 --- a/jjb/validation/bluval.yaml +++ b/jjb/validation/bluval.yaml @@ -34,85 +34,4 @@ 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 diff --git a/jjb/validation/lab.yaml b/jjb/validation/lab.yaml index c163199..e29f46a 100644 --- a/jjb/validation/lab.yaml +++ b/jjb/validation/lab.yaml @@ -28,39 +28,4 @@ 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