Update the Jenkinsfile to blow everything out into parallel agents

This is likely going to crater, but let's try!
This commit is contained in:
R. Tyler Croy 2016-08-03 21:39:20 -07:00
parent e964180833
commit 38df410a37
No known key found for this signature in database
GPG Key ID: 1426C7DC3F51E16F
5 changed files with 38 additions and 13 deletions

21
Jenkinsfile vendored
View File

@ -1,5 +1,6 @@
#!/usr/bin/env groovy #!/usr/bin/env groovy
def rubies = ['2.3.0', '2.3.1', '2.2.5', 'jruby', 'jruby-9.1.2.0', 'rubinius']
node('docker') { node('docker') {
checkout scm checkout scm
@ -7,10 +8,17 @@ node('docker') {
stage 'Prepare base RVM container' stage 'Prepare base RVM container'
sh './build-base.sh' sh './build-base.sh'
stage 'Build Containers for Rubies' stage 'Push base RVM container'
sh './build-rubies.sh' sh './push-base.sh'
stage 'Publish Containers' stage 'Build Containers for Rubies'
def stepsForParallel = [:]
for (int i = 0; i < rubies.size(); i++) {
def ruby = rubies.get(i)
stepsForParallel[ruby] = {
node {
sh "./build-rubies.sh ${ruby}"
sh './pu
/* Using credentials with the ID 'dockerhub' from the Jenkins installation */ /* Using credentials with the ID 'dockerhub' from the Jenkins installation */
withCredentials([[$class: 'UsernamePasswordMultiBinding', withCredentials([[$class: 'UsernamePasswordMultiBinding',
credentialsId: 'dockerhub', credentialsId: 'dockerhub',
@ -18,6 +26,11 @@ node('docker') {
usernameVariable: 'DOCKERHUB_USERNAME']]) { usernameVariable: 'DOCKERHUB_USERNAME']]) {
/* Our variables be exposed in the environment and we must log in before trying to publish to Dockerhub */ /* Our variables be exposed in the environment and we must log in before trying to publish to Dockerhub */
sh 'docker login --username=${DOCKERHUB_USERNAME} --email=tyler@monkeypox.org --password=${DOCKERHUB_TOKEN}' sh 'docker login --username=${DOCKERHUB_USERNAME} --email=tyler@monkeypox.org --password=${DOCKERHUB_TOKEN}'
sh './push-rubies.sh' sh "./push-rubies.sh ${ruby}"
} }
} }
}
}
/* Fan everything out like crazy */
parallel(stepsForParallel)
}

View File

@ -6,6 +6,10 @@ source ./rubies
mkdir -p work mkdir -p work
if [ -n $1 ]; then
RUBIES=( "${1}" )
fi;
for RUBY in "${RUBIES[@]}"; do for RUBY in "${RUBIES[@]}"; do
DOCKERFILE="work/dockerfile-${RUBY}" DOCKERFILE="work/dockerfile-${RUBY}"
cat > $DOCKERFILE <<EOF cat > $DOCKERFILE <<EOF

6
push-base.sh Executable file
View File

@ -0,0 +1,6 @@
#!/usr/bin/env bash
set -x
source ./rubies
exec docker push ${IMAGE_TAG}:latest

View File

@ -4,7 +4,9 @@ set -x
source ./rubies source ./rubies
docker push ${IMAGE_TAG}:latest if [ -n $1 ]; then
RUBIES=( "${1}" )
fi;
for RUBY in "${RUBIES[@]}"; do for RUBY in "${RUBIES[@]}"; do
echo "> Pushing ${IMAGE_TAG}:${RUBY}" echo "> Pushing ${IMAGE_TAG}:${RUBY}"

2
rubies
View File

@ -1,5 +1,5 @@
#!/usr/bin/env bash #!/usr/bin/env bash
export RUBIES=( 2.3.0 jruby jruby-9.1.2.0 ruby-head) export RUBIES=( 2.3.0 2.3.1 2.2.5 jruby jruby-9.1.2.0 ruby-head)
export IMAGE_TAG="rtyler/rvm" export IMAGE_TAG="rtyler/rvm"