Last active
March 18, 2018 18:21
-
-
Save kenych/8337d70f1cefd5a769a4fd75921a97b1 to your computer and use it in GitHub Desktop.
Jenkins config as code job
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
node { | |
stage('checkout') { | |
sh ''' | |
git clone ssh://git@your_scm_here/jenkins_config_as_code.git ${JENKINS_HOME}/jenkins_config | |
mv ${JENKINS_HOME}/jenkins_config/*.groovy ${JENKINS_HOME}/init.groovy.d/ | |
''' | |
} | |
stage('run consul template'){ | |
sh ''' | |
consul-template \ | |
-consul-addr "$CONSUL_ADDR" \ | |
-vault-addr "$VAULT_ADDR" \ | |
-config "jenkins_config.hcl" \ | |
-once | |
''' | |
} | |
stage('update credentials') { | |
load("/var/jenkins_home/init.groovy.d/credentials.groovy") | |
} | |
stage('update k8s') { | |
load("/var/jenkins_home/init.groovy.d/kubernetes.groovy") | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment