From 8317775c9001dbd32fc696598c4e274c270dc515 Mon Sep 17 00:00:00 2001 From: Jeremy Poulin Date: Sun, 26 Aug 2018 21:11:15 -0400 Subject: [PATCH] Making Cinch call external to linchpin since this was causing issues --- .../ci/provisioner/Provisioner.groovy | 50 +++++-------------- .../ci/provisioner/ProvisioningConfig.groovy | 2 +- 2 files changed, 13 insertions(+), 39 deletions(-) diff --git a/src/com/redhat/multiarch/ci/provisioner/Provisioner.groovy b/src/com/redhat/multiarch/ci/provisioner/Provisioner.groovy index b257fce..a43a0b0 100644 --- a/src/com/redhat/multiarch/ci/provisioner/Provisioner.groovy +++ b/src/com/redhat/multiarch/ci/provisioner/Provisioner.groovy @@ -58,17 +58,13 @@ class Provisioner { awk '/\\[master_node\\]/{getline; print}' ${host.inventory} """).trim() - // Let's examine this inventory file - script.sh("cat ${host.inventory}") - script.echo(getExtraVars(host)) - script.sh(""" - . /home/jenkins/envs/provisioner/bin/activate - cinch ${host.inventory} --extra-vars='${getExtraVars(host)}' - """) - host.provisioned = true if (config.runOnSlave) { + script.sh(""" + . /home/jenkins/envs/provisioner/bin/activate + cinch ${host.inventory} --extra-vars='${getExtraVars(host)}' + """) host.connectedToMaster = true // We only care if the install ansible flag is set when we are running on the provisioned host @@ -154,36 +150,14 @@ class Provisioner { } String getTemplateData(Host host) { - script.withCredentials([ - script.usernamePassword(credentialsId: config.jenkinsSlaveCredentialId, - usernameVariable: 'JENKINS_SLAVE_USERNAME', - passwordVariable: 'JENKINS_SLAVE_PASSWORD') - ]) { - // Build template data - def templateData = [:] - templateData.arch = host.arch - templateData.job_group = config.jobgroup - templateData.hostrequires = config.hostrequires - templateData.hooks = [postUp: [connectToMaster: config.runOnSlave]] - templateData.extra_vars = [ - "rpm_key_imports":[], - "jenkins_master_repositories":[], - "jenkins_master_download_repositories":[], - "jslave_name":"${host.name}", - "jslave_label":"${host.name}", - "arch":"${host.arch}", - "jenkins_master_url":"${config.jenkinsMasterUrl}", - "jenkins_slave_username":"${script.JENKINS_SLAVE_USERNAME}", - "jenkins_slave_password":"${script.JENKINS_SLAVE_PASSWORD}", - "jswarm_version":"3.9", - "jswarm_filename":"swarm-client-{{ jswarm_version }}.jar", - "jswarm_extra_args":"${config.jswarmExtraArgs}", - "jenkins_slave_repositories":[["name":"epel","mirrorlist":"https://mirrors.fedoraproject.org/metalink?arch=\$basearch&repo=epel-7"]] - ] - - def templateDataJson = JsonOutput.toJson(templateData) - templateDataJson - } + // Build template data + def templateData = [:] + templateData.arch = host.arch + templateData.job_group = config.jobgroup + templateData.hostrequires = config.hostrequires + + def templateDataJson = JsonOutput.toJson(templateData) + templateDataJson } diff --git a/src/com/redhat/multiarch/ci/provisioner/ProvisioningConfig.groovy b/src/com/redhat/multiarch/ci/provisioner/ProvisioningConfig.groovy index cf057c9..f98eab3 100644 --- a/src/com/redhat/multiarch/ci/provisioner/ProvisioningConfig.groovy +++ b/src/com/redhat/multiarch/ci/provisioner/ProvisioningConfig.groovy @@ -18,7 +18,7 @@ class ProvisioningConfig { // Provisioning repo url String provisioningRepoUrl = 'https://github.com/RedHat-MultiArch-QE/multiarch-ci-test-template' // Provisioning repo ref - String provisioningRepoRef = 'master' + String provisioningRepoRef = this.version // Provisioning workspace location (needed for Linchpin) // This can reference a relative path in the above repo // or it can reference a relative path that already exists