Make DOCKER_HOST env variable available to all steps
Feature: Issue 13397
Change-Id: I11fa843d4e435db715b375277f3296a6ac3af9b3
diff --git a/jenkins/gatlingTestPipeline.groovy b/jenkins/gatlingTestPipeline.groovy
index a4f15c4..93db305 100644
--- a/jenkins/gatlingTestPipeline.groovy
+++ b/jenkins/gatlingTestPipeline.groovy
@@ -28,11 +28,16 @@
string(name: 'NUM_USERS', defaultValue: '10', description: 'Number of concurrent user sessions')
string(name: 'DURATION', defaultValue: '2 minutes', description: 'Total duration of the test')
}
+
+ environment {
+ DOCKER_HOST = """${sh(
+ returnStdout: true,
+ script: '/sbin/ip route|awk \'/default/ {print "tcp://"\$3":2375"}\''
+ )}"""
+ }
+
stages{
stage("Setup single-master aws stack") {
- environment {
- DOCKER_HOST = sh(script: """/sbin/ip route|awk '/default/ {print "tcp://"\$3":2375"}'""", , returnStdout: true).trim()
- }
steps {
withCredentials([usernamePassword(usernameVariable: "GS_GIT_USER", passwordVariable: "GS_GIT_PASS", credentialsId: "gerrit.googlesource.com")]) {
sh 'echo "machine gerrit.googlesource.com login $GS_GIT_USER password $GS_GIT_PASS">> ~/.netrc'