From 03b03cedf3b0522cc4c60596e859926faf2aa188 Mon Sep 17 00:00:00 2001 From: piyushgupta1551 Date: Tue, 7 Apr 2020 02:34:15 -0400 Subject: [PATCH] Parameterize SSHKEY Repository and keys for Ansible and pbench server. Fixes issue #72 updated description. Fixes issue #72 --- jjb/dynamic/scale-ci_baseline.yml | 28 ++++++++++++++++++++++------ pipeline-scripts/baseline.groovy | 6 ++++++ properties-files/baseline.properties | 3 +++ 3 files changed, 31 insertions(+), 6 deletions(-) diff --git a/jjb/dynamic/scale-ci_baseline.yml b/jjb/dynamic/scale-ci_baseline.yml index 75cb75d2..d57ad600 100644 --- a/jjb/dynamic/scale-ci_baseline.yml +++ b/jjb/dynamic/scale-ci_baseline.yml @@ -14,12 +14,15 @@ fi # Re-enable logging set -x - git clone https://${SSHKEY_TOKEN}@github.com/redhat-performance/perf-dept.git - export PUBLIC_KEY=${WORKSPACE}/perf-dept/ssh_keys/id_rsa_perf.pub - export PRIVATE_KEY=${WORKSPACE}/perf-dept/ssh_keys/id_rsa_perf - export PBENCH_SSH_PUBLIC_KEY_FILE=${WORKSPACE}/perf-dept/ssh_keys/id_rsa_perf.pub - export PBENCH_SSH_PRIVATE_KEY_FILE=${WORKSPACE}/perf-dept/ssh_keys/id_rsa_perf - chmod 600 ${PRIVATE_KEY} + git clone https://${SSHKEY_TOKEN}@${SSHKEY_REPO} + if [ -f ${WORKSPACE}/${SSHKEY_REPOPATH_PUB} ] && [ -f ${WORKSPACE}/${SSHKEY_REPOPATH_PRIV} ] + then + export PUBLIC_KEY=${WORKSPACE}/${SSHKEY_REPOPATH_PUB} + export PRIVATE_KEY=${WORKSPACE}/${SSHKEY_REPOPATH_PRIV} + export PBENCH_SSH_PUBLIC_KEY_FILE=${WORKSPACE}/${SSHKEY_REPOPATH_PUB} + export PBENCH_SSH_PRIVATE_KEY_FILE=${WORKSPACE}/${SSHKEY_REPOPATH_PRIV} + chmod 600 ${PRIVATE_KEY} + fi # Create inventory File: echo "[orchestration]" > inventory @@ -137,6 +140,19 @@ description: 'Duration to run' name: BASELINE_WORKLOAD_DURATION trim: 'false' + - string: + default: "github.com/redhat-performance/perf-dept.git" + description: 'Repository containing ssh keys for Ansible and pbench server' + name: SSHKEY_REPO + - string: + default: "perf-dept/ssh_keys/id_rsa_perf.pub" + description: 'path to public key file in ssh key repository' + name: SSHKEY_REPOPATH_PUB + - string: + default: "perf-dept/ssh_keys/id_rsa_perf" + description: 'path to private key file in ssh key repository' + name: SSHKEY_REPOPATH_PRIV + project-type: freestyle properties: - raw: diff --git a/pipeline-scripts/baseline.groovy b/pipeline-scripts/baseline.groovy index 32947ffc..b63ad016 100644 --- a/pipeline-scripts/baseline.groovy +++ b/pipeline-scripts/baseline.groovy @@ -26,6 +26,9 @@ stage ('baseline_scale_test') { def cluster_password = baseline_properties['CLUSTER_PASSWORD'] def cluster_api_url = baseline_properties['CLUSTER_API_URL'] def sshkey_token = baseline_properties['SSHKEY_TOKEN'] + def sshkey_repo = baseline_properties['SSHKEY_REPO'] + def sshkey_repopath_pub = baseline_properties['SSHKEY_REPOPATH_PUB'] + def sshkey_repopath_priv = baseline_properties['SSHKEY_REPOPATH_PRIV'] def orchestration_host = baseline_properties['ORCHESTRATION_HOST'] def orchestration_user = baseline_properties['ORCHESTRATION_USER'] def workload_image = baseline_properties['WORKLOAD_IMAGE'] @@ -49,6 +52,9 @@ stage ('baseline_scale_test') { [$class: 'StringParameterValue', name: 'CLUSTER_PASSWORD', value: cluster_password ], [$class: 'StringParameterValue', name: 'CLUSTER_API_URL', value: cluster_api_url ], [$class: 'StringParameterValue', name: 'SSHKEY_TOKEN', value: sshkey_token ], + [$class: 'StringParameterValue', name: 'SSHKEY_REPO', value: sshkey_repo ], + [$class: 'StringParameterValue', name: 'SSHKEY_REPOPATH_PUB', value: sshkey_repopath_pub ], + [$class: 'StringParameterValue', name: 'SSHKEY_REPOPATH_PRIV', value: sshkey_repopath_priv ], [$class: 'StringParameterValue', name: 'ORCHESTRATION_HOST', value: orchestration_host ], [$class: 'StringParameterValue', name: 'ORCHESTRATION_USER', value: orchestration_user ], [$class: 'StringParameterValue', name: 'WORKLOAD_IMAGE', value: workload_image ], diff --git a/properties-files/baseline.properties b/properties-files/baseline.properties index 1ddf74a7..120fcf4c 100644 --- a/properties-files/baseline.properties +++ b/properties-files/baseline.properties @@ -3,6 +3,9 @@ CLUSTER_USER=kubeadmin CLUSTER_PASSWORD= CLUSTER_API_URL= SSHKEY_TOKEN= +SSHKEY_REPO=github.com/redhat-performance/perf-dept.git +SSHKEY_REPOPATH_PUB=perf-dept/ssh_keys/id_rsa_perf.pub +SSHKEY_REPOPATH_PRIV=perf-dept/ssh_keys/id_rsa_perf ORCHESTRATION_HOST=localhost ORCHESTRATION_USER=root WORKLOAD_IMAGE=quay.io/openshift-scale/scale-ci-workload