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

35
Jenkinsfile vendored
View File

@ -1,5 +1,6 @@
#!/usr/bin/env groovy
def rubies = ['2.3.0', '2.3.1', '2.2.5', 'jruby', 'jruby-9.1.2.0', 'rubinius']
node('docker') {
checkout scm
@ -7,17 +8,29 @@ node('docker') {
stage 'Prepare base RVM container'
sh './build-base.sh'
stage 'Build Containers for Rubies'
sh './build-rubies.sh'
stage 'Push base RVM container'
sh './push-base.sh'
stage 'Publish Containers'
/* Using credentials with the ID 'dockerhub' from the Jenkins installation */
withCredentials([[$class: 'UsernamePasswordMultiBinding',
credentialsId: 'dockerhub',
passwordVariable: 'DOCKERHUB_TOKEN',
usernameVariable: 'DOCKERHUB_USERNAME']]) {
/* 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 './push-rubies.sh'
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 */
withCredentials([[$class: 'UsernamePasswordMultiBinding',
credentialsId: 'dockerhub',
passwordVariable: 'DOCKERHUB_TOKEN',
usernameVariable: 'DOCKERHUB_USERNAME']]) {
/* 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 "./push-rubies.sh ${ruby}"
}
}
}
}
/* Fan everything out like crazy */
parallel(stepsForParallel)
}

View File

@ -6,6 +6,10 @@ source ./rubies
mkdir -p work
if [ -n $1 ]; then
RUBIES=( "${1}" )
fi;
for RUBY in "${RUBIES[@]}"; do
DOCKERFILE="work/dockerfile-${RUBY}"
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
docker push ${IMAGE_TAG}:latest
if [ -n $1 ]; then
RUBIES=( "${1}" )
fi;
for RUBY in "${RUBIES[@]}"; do
echo "> Pushing ${IMAGE_TAG}:${RUBY}"

2
rubies
View File

@ -1,5 +1,5 @@
#!/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"