Last active
May 5, 2017 13:38
-
-
Save cdenneen/58757cd9ece3042d8cf4a9e81e5ebfe8 to your computer and use it in GitHub Desktop.
Pipeline testing
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 { | |
deleteDir() | |
stage 'Checkout' | |
git branch: 'production', url: 'https://github.com/cdenneen/control-repo.git' | |
// def stashName = "${env.JOB_NAME}_${env.BUILD_NUMBER}" | |
// stash stashName | |
// stage 'Test' | |
gitCommit = sh(returnStdout: true, script: 'git rev-parse HEAD').trim() | |
// short SHA, possibly better for chat notifications, etc. | |
shortCommit = gitCommit.take(6) | |
sh "echo $shortCommit" | |
def puppetVersion = ['4.7.1', '4.8.1', '4.9.4'] | |
for (int i = 0; i < puppetVersion.size(); i++) { | |
def index = i //if we tried to use i below, it would equal last array count in each job execution | |
// puppetVersion["puppet-${puppetVersion[i]}"] = { | |
PUPPET_GEM_VERSION = puppetVersion[index] | |
ansiColor('xterm'){ | |
withEnv(["PUPPET_GEM_VERSION=${PUPPET_GEM_VERSION}","LANG=en_US.UTF-8"]) { | |
stage("Puppet Testing") { | |
puppetTesting{ | |
sh "gem install bundler --no-ri --no-rdoc" | |
sh "bundle install --without system_tests" | |
sh "bundle exec rake validate" | |
} | |
} | |
} | |
} | |
// } | |
} | |
// parallel puppetVersion | |
} | |
def puppetTesting(Closure body) { | |
podTemplate(label: 'puppet', containers:[ | |
containerTemplate(name: 'ruby21', image: 'ruby:2.1-alpine', ttyEnabled: true, command: 'cat'), | |
containerTemplate(name: 'ruby22', image: 'ruby:2.2-alpine', ttyEnabled: true, command: 'cat'), | |
containerTemplate(name: 'ruby23', image: 'ruby:2.3-alpine', ttyEnabled: true, command: 'cat') | |
]){ | |
node('puppet') { | |
container('ruby21'){ | |
body() | |
} | |
container('ruby22'){ | |
body() | |
} | |
container('ruby23'){ | |
body() | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Rev3 errors as