diff --git a/.gitignore b/.gitignore index 7323a01..9ed152d 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,5 @@ bin/rebuild.sh bin/rerun.sh bin/run.sh bin/test.sh +root/** +shibboleth-identity-provider.tar.gz diff --git a/Jenkinsfile b/Jenkinsfile index aead388..eb5b63a 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,5 +1,5 @@ node { - + stage 'Checkout' checkout scm @@ -13,8 +13,19 @@ node { sh 'ls' sh 'mv bin/* .' } - - stage 'Base' + + stage 'Build' + + def maintainer = maintainer() + def imagename = imagename() + def tag = env.BRANCH_NAME + if(!imagename){ + echo "You must define an imagename in common.bash" + currentBuild.result = 'FAILURE' + } + if(maintainer){ + echo "Building ${maintainer}:${tag} for ${maintainer}" + } sh 'bin/build.sh' @@ -22,5 +33,27 @@ node { sh 'bin/test.sh' + stage 'Push' + + docker.withRegistry('https://registry.hub.docker.com/', "dockerhub-$maintainer") { + def baseImg = docker.build("$maintainer/$imagename") + baseImg.push("$tag") + } + + +} + +def maintainer() { + def matcher = readFile('common.bash') =~ 'maintainer="(.+)"' + matcher ? matcher[0][1] : 'tier' +} + +def imagename() { + def matcher = readFile('common.bash') =~ 'imagename="(.+)"' + matcher ? matcher[0][1] : null +} +def version() { + def matcher = readFile('common.bash') =~ 'version="(.+)"' + matcher ? matcher[0][1] : null } \ No newline at end of file diff --git a/bin/download.sh b/bin/download.sh new file mode 100755 index 0000000..b977d31 --- /dev/null +++ b/bin/download.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +source common.bash . + +rm -rf root +if [ ! -f shibboleth-identity-provider.tar.gz ]; then + curl -o shibboleth-identity-provider.tar.gz "https://shibboleth.net/downloads/identity-provider/latest/shibboleth-identity-provider-$version.tar.gz" + tar xvf shibboleth-identity-provider.tar.gz + mv shibboleth-identity-provider-$version root +fi +#curl -o shibboleth-identity-provider-3.2.1.tar.gz https://shibboleth.net/downloads/identity-provider/latest/shibboleth-identity-provider-3.2.1.tar.gz \ No newline at end of file diff --git a/common.bash b/common.bash index 96e0143..cd630af 100644 --- a/common.bash +++ b/common.bash @@ -1,2 +1,3 @@ -maintainer="tier" -imagename="imagename-replaceme-in-common-bash" \ No newline at end of file +maintainer="bigfleet" +imagename="shibboleth_idp_runtime" +version="3.2.1" \ No newline at end of file