Created
July 13, 2018 15:00
-
-
Save bauidch/013eb1a1d7107b96ac29d6a45f126240 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pipeline { | |
agent any | |
options { | |
disableConcurrentBuilds() | |
timestamps() | |
ansiColor('xterm') | |
} | |
parameters { | |
choice(choices: 'cat@vcenter.local', description: 'The vcenter User ', name: 'VCENTER_USER') | |
password(description: 'Password for vCenter', name: 'VCENTER_PASSWORD') | |
} | |
stages { | |
stage('Plan') { | |
steps { | |
wrap([$class: 'MaskPasswordsBuildWrapper', varPasswordPairs: [[password: env.VCENTER_PASSWORD, var: 'VCENTER_PASS']]]) { | |
sh ''' | |
cd /data/jenkins/workspace/Terraform/terraform-repo-stage/eng | |
terraform plan \ | |
-var-file=eng.tfvars \ | |
-var "vsphere_user=${VCENTER_USER}" \ | |
-var "vsphere_pass=${VCENTER_PASSWORD}" | |
'''} | |
} | |
} | |
stage ('Promotion') { | |
steps { | |
input message: 'Apply to ENG?', ok: 'Apply' | |
} | |
} | |
stage('Apply') { | |
steps { | |
wrap([$class: 'MaskPasswordsBuildWrapper', varPasswordPairs: [[password: env.VCENTER_PASSWORD, var: 'VCENTER_PASS']]]) { | |
sh ''' | |
cd /data/jenkins/workspace/Terraform/terraform-repo-stage/eng | |
terraform apply \ | |
-var-file=eng.tfvars \ | |
-var "vsphere_user=${VCENTER_USER}" \ | |
-var "vsphere_pass=${VCENTER_PASSWORD}" \ | |
-auto-approve | |
'''} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment