diff --git a/Dockerfile b/Dockerfile index 327f412..a901ed9 100755 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,6 @@ FROM alpine:3.7 as bootstrap -ARG version=1.4.0 +ARG version=1.4.1 COPY bootstrapfiles/shibui-${version}.jar.sha256sum . diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 0000000..c4b3931 --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,88 @@ +node { + + stage 'Checkout' + + checkout scm + + stage 'Acquire util' + + sh 'mkdir -p tmp && mkdir -p bin' + dir('tmp'){ + git([ url: "https://github.internet2.edu/docker/util.git", + credentialsId: "jenkins-github-access-token" ]) + sh 'mv ./bin/* ../bin/.' + } + sh 'rm -rf tmp' + + stage 'Setting build context' + + def maintainer = maintainer() + def imagename = imagename() + def tag + + // Tag images created on master branch with 'latest' + if(env.BRANCH_NAME == "master"){ + tag = "latest" + }else{ + tag = env.BRANCH_NAME + } + + if(!imagename){ + echo "You must define an imagename in common.bash" + currentBuild.result = 'FAILURE' + } + if(maintainer){ + echo "Building ${imagename}:${tag} for ${maintainer}" + } + + stage 'Build' + try{ + sh 'bin/build.sh &> debug' + } catch(error) { + def error_details = readFile('./debug'); + def message = "BUILD ERROR: There was a problem building ${imagename}:${tag}. \n\n ${error_details}" + sh "rm -f ./debug" + handleError(message) + } + + stage 'Tests' + + try{ + sh 'bin/test.sh &> debug' + } catch(error) { + def error_details = readFile('./debug'); + def message = "BUILD ERROR: There was a problem building ${imagename}:${tag}. \n\n ${error_details}" + sh "rm -f ./debug" + handleError(message) + } + + stage 'Push' + + docker.withRegistry('https://registry.hub.docker.com/', "dockerhub-$maintainer") { + def baseImg = docker.build("$maintainer/$imagename") + baseImg.push("$tag") + } + + stage 'Notify' + + slackSend color: 'good', message: "$maintainer/$imagename:$tag pushed to DockerHub" + +} + +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 handleError(String message){ + echo "${message}" + currentBuild.setResult("FAILED") + slackSend color: 'danger', message: "${message}" + //step([$class: 'Mailer', notifyEveryUnstableBuild: true, recipients: 'chris.bynum@levvel.io', sendToIndividuals: true]) + sh 'exit 1' +} \ No newline at end of file diff --git a/README.md b/README.md index 82893a7..2fafa45 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,43 @@ # shib-ui Code and files for the TIER Shibboleth UI Project + +This repository contains both: +* the needed artifacts to build (including auto-builds through Jenkins) a Docker image of the Shibboleth UI, +* and a "testbed" that provides the full environment one needs to explore and gain experience with the Shibboleth UI. + +The Docker image of the Shibboleth UI follows the TIER Docker packaging standards, utilizing CentOS7, the Zulu JDK, supervisord, and the TIER Beacon configuration. + +## How To + +* Install Docker. These instructions require version 17.03.1 or higher. + +* TIER can build an image for Shib UI with something like the following: +``` +docker build --rm -t tier/shib-idp-ui +``` + +* And then that image could be run with something like the following: +``` +docker run -p 8080:8080 tier/shib-idp-ui +``` + +### Testbed environment + +* There is a "testbed" environment that you can build and run that is embedded into this repository. That testbed includes the: +* Shibboleth UI, +* a Shibboleth IdP + * with a shared filesystem between the Shibboleth UI and Shibboleth IdP, +* an LDAP server as the base credential/attribute store for the IdP, +* and the TIER Maria DB image for the UI's persistent database. + +To setup that testbed, you need to: + +* Clone this repository: +``` +git clone https://github.com/Internet2/shib-ui.git +``` +* __cd__ into _test-compose/_ +* Run the following command: +``` +docker-compose kill; docker-compose rm; docker-compose build && docker-compose up +``` \ No newline at end of file diff --git a/bash.common b/bash.common new file mode 100644 index 0000000..569067b --- /dev/null +++ b/bash.common @@ -0,0 +1,2 @@ +maintainer=tier +imagename=shib-idp-ui \ No newline at end of file diff --git a/bootstrapfiles/shibui-1.4.1.jar.sha256sum b/bootstrapfiles/shibui-1.4.1.jar.sha256sum new file mode 100644 index 0000000..1daad12 --- /dev/null +++ b/bootstrapfiles/shibui-1.4.1.jar.sha256sum @@ -0,0 +1 @@ +2efc58019fa423b78768adf319d7fe3edcf21de724e269600e7796a27f55ce06 shibui-1.4.1.jar \ No newline at end of file diff --git a/containerfiles/supervisord.conf b/containerfiles/supervisord.conf index 86ef06d..9d2ef01 100755 --- a/containerfiles/supervisord.conf +++ b/containerfiles/supervisord.conf @@ -16,7 +16,7 @@ stderr_logfile_maxbytes=0 directory=/usr/bin [program:shibui] -command=/usr/bin/java -jar /opt/shibui/shibui.jar +command=/usr/bin/java -Didp.home=/idp-home -jar /opt/shibui/shibui.jar directory=/opt/shibui autostart=true autorestart=true