From fc1fc384e07e2c87eb7177e5cc527eef59dc0d5a Mon Sep 17 00:00:00 2001 From: Jim Van Fleet Date: Mon, 18 Jul 2016 13:24:54 -0400 Subject: [PATCH 1/9] Good failing test --- tests/shibboleth-idp.bats | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/tests/shibboleth-idp.bats b/tests/shibboleth-idp.bats index 8274927..4413f25 100644 --- a/tests/shibboleth-idp.bats +++ b/tests/shibboleth-idp.bats @@ -2,12 +2,7 @@ load ../common -@test "file reading" { - result="$(echo $maintainer)" - [ "$result" = 'bigfleet' ] -} - -@test "container output" { - result="$(docker run bigfleet/shibboleth_idp)" - [ "$result" = '3.2.1' ] +@test "Creates non-root host directory" { + result="$(docker run -it bigfleet/shibboleth_idp ls /opt)" + [ "$result" != '' ] } \ No newline at end of file From de881659e7cc2303814176f71a23e0ccc9343130 Mon Sep 17 00:00:00 2001 From: Jim Van Fleet Date: Mon, 18 Jul 2016 14:44:51 -0400 Subject: [PATCH 2/9] Test passing --- Dockerfile | 29 +++++++++++++++++++++++++++-- tests/shibboleth-idp.bats | 4 ++-- 2 files changed, 29 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index 88cd1aa..7cef8e8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,7 +7,6 @@ ARG registry=docker.io ARG maintainer=tier ARG imagename=shibboleth_idp ARG version=3.2.1 - ENV VERSION=$version MAINTAINER $maintainer @@ -17,4 +16,30 @@ LABEL ImageName=$imagename LABEL ImageOS=centos7 LABEL Version=$VERSION -CMD echo $VERSION \ No newline at end of file +RUN yum -y install \ + apr-devel \ + httpd \ + java-1.8.0-openjdk-headless \ + krb5-workstation \ + mod_ssl \ + openssl-devel \ + tomcat \ + tomcat-native.x86_64 \ + wget \ + && yum -y clean all + +ENV SHIB_RELDIR=http://shibboleth.net/downloads/identity-provider/$VERSION +ENV SHIB_PREFIX=shibboleth-identity-provider-$VERSION + +RUN mkdir -p /tmp/shibboleth && cd /tmp/shibboleth && \ + wget https://shibboleth.net/downloads/PGP_KEYS \ + $SHIB_RELDIR/$SHIB_PREFIX.tar.gz \ + $SHIB_RELDIR/$SHIB_PREFIX.tar.gz.asc \ + $SHIB_RELDIR/$SHIB_PREFIX.tar.gz.sha256 && \ + gpg --import PGP_KEYS && \ + gpg $SHIB_PREFIX.tar.gz.asc && \ + sha256sum --check $SHIB_PREFIX.tar.gz.sha256 && \ + tar xf $SHIB_PREFIX.tar.gz && \ + mkdir -p /opt/shibboleth && \ + mv $SHIB_PREFIX /opt/shibboleth/. && \ + ln -s /opt/shibboleth/$SHIB_PREFIX /opt/shibboleth/current \ No newline at end of file diff --git a/tests/shibboleth-idp.bats b/tests/shibboleth-idp.bats index 4413f25..e2ae756 100644 --- a/tests/shibboleth-idp.bats +++ b/tests/shibboleth-idp.bats @@ -2,7 +2,7 @@ load ../common -@test "Creates non-root host directory" { - result="$(docker run -it bigfleet/shibboleth_idp ls /opt)" +@test "Creates non-root Shib IDP home" { + result="$(docker run -it bigfleet/shibboleth_idp ls /opt/shibboleth/current/bin/)" [ "$result" != '' ] } \ No newline at end of file From d7506f0360c53e86c3c0f0397490e3e6f4c2b17e Mon Sep 17 00:00:00 2001 From: Jim Van Fleet Date: Mon, 18 Jul 2016 15:02:01 -0400 Subject: [PATCH 3/9] Better release Dockerfile --- Dockerfile | 5 +++-- bin/run.sh | 2 +- tests/shibboleth-idp.bats | 5 +++++ 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 7cef8e8..56a5de7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -32,7 +32,7 @@ ENV SHIB_RELDIR=http://shibboleth.net/downloads/identity-provider/$VERSION ENV SHIB_PREFIX=shibboleth-identity-provider-$VERSION RUN mkdir -p /tmp/shibboleth && cd /tmp/shibboleth && \ - wget https://shibboleth.net/downloads/PGP_KEYS \ + wget -q https://shibboleth.net/downloads/PGP_KEYS \ $SHIB_RELDIR/$SHIB_PREFIX.tar.gz \ $SHIB_RELDIR/$SHIB_PREFIX.tar.gz.asc \ $SHIB_RELDIR/$SHIB_PREFIX.tar.gz.sha256 && \ @@ -42,4 +42,5 @@ RUN mkdir -p /tmp/shibboleth && cd /tmp/shibboleth && \ tar xf $SHIB_PREFIX.tar.gz && \ mkdir -p /opt/shibboleth && \ mv $SHIB_PREFIX /opt/shibboleth/. && \ - ln -s /opt/shibboleth/$SHIB_PREFIX /opt/shibboleth/current \ No newline at end of file + ln -s /opt/shibboleth/$SHIB_PREFIX /opt/shibboleth/current && \ + rm -rf /tmp/shibboleth \ No newline at end of file diff --git a/bin/run.sh b/bin/run.sh index 3509fb8..8af1b06 100755 --- a/bin/run.sh +++ b/bin/run.sh @@ -2,4 +2,4 @@ source common.bash . -docker run $maintainer/$imagename \ No newline at end of file +docker run -it $maintainer/$imagename $1 \ No newline at end of file diff --git a/tests/shibboleth-idp.bats b/tests/shibboleth-idp.bats index e2ae756..b448b40 100644 --- a/tests/shibboleth-idp.bats +++ b/tests/shibboleth-idp.bats @@ -5,4 +5,9 @@ load ../common @test "Creates non-root Shib IDP home" { result="$(docker run -it bigfleet/shibboleth_idp ls /opt/shibboleth/current/bin/)" [ "$result" != '' ] +} + +@test "Retains first-run experience" { + result="$(docker run -it bigfleet/shibboleth_idp ls /tmp/firsttimerunning)" + [ "$result" != '' ] } \ No newline at end of file From 7f3ed2c3a9290e8b3be5c38815060760cb7e5ab4 Mon Sep 17 00:00:00 2001 From: Jim Van Fleet Date: Mon, 18 Jul 2016 15:22:17 -0400 Subject: [PATCH 4/9] Rebuild and rerun are separate activities --- bin/rebuild.sh | 3 +++ bin/rerun.sh | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) create mode 100755 bin/rebuild.sh diff --git a/bin/rebuild.sh b/bin/rebuild.sh new file mode 100755 index 0000000..3904e58 --- /dev/null +++ b/bin/rebuild.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +source bin/destroy.sh && source bin/build.sh \ No newline at end of file diff --git a/bin/rerun.sh b/bin/rerun.sh index da1dff6..e279386 100755 --- a/bin/rerun.sh +++ b/bin/rerun.sh @@ -1,3 +1,3 @@ #!/bin/bash -source bin/destroy.sh && source bin/build.sh && source bin/run.sh \ No newline at end of file +source bin/rebuild.sh && source bin/run.sh $1 \ No newline at end of file From 1012cb9775c2c0a45af238ae7d0b9a0b2fca4f87 Mon Sep 17 00:00:00 2001 From: Jim Van Fleet Date: Mon, 18 Jul 2016 15:41:00 -0400 Subject: [PATCH 5/9] Added checking for presence of java --- Dockerfile | 5 ++++- tests/shibboleth-idp.bats | 5 +++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 56a5de7..55b5a73 100644 --- a/Dockerfile +++ b/Dockerfile @@ -33,14 +33,17 @@ ENV SHIB_PREFIX=shibboleth-identity-provider-$VERSION RUN mkdir -p /tmp/shibboleth && cd /tmp/shibboleth && \ wget -q https://shibboleth.net/downloads/PGP_KEYS \ - $SHIB_RELDIR/$SHIB_PREFIX.tar.gz \ + $SHIB_RELDIR/$SHIB_PREFIX.tar.gz \ $SHIB_RELDIR/$SHIB_PREFIX.tar.gz.asc \ $SHIB_RELDIR/$SHIB_PREFIX.tar.gz.sha256 && \ +# Perform verifications gpg --import PGP_KEYS && \ gpg $SHIB_PREFIX.tar.gz.asc && \ sha256sum --check $SHIB_PREFIX.tar.gz.sha256 && \ +# Prepare filesystem tar xf $SHIB_PREFIX.tar.gz && \ mkdir -p /opt/shibboleth && \ mv $SHIB_PREFIX /opt/shibboleth/. && \ ln -s /opt/shibboleth/$SHIB_PREFIX /opt/shibboleth/current && \ +# Cleanup rm -rf /tmp/shibboleth \ No newline at end of file diff --git a/tests/shibboleth-idp.bats b/tests/shibboleth-idp.bats index b448b40..d50fc1b 100644 --- a/tests/shibboleth-idp.bats +++ b/tests/shibboleth-idp.bats @@ -10,4 +10,9 @@ load ../common @test "Retains first-run experience" { result="$(docker run -it bigfleet/shibboleth_idp ls /tmp/firsttimerunning)" [ "$result" != '' ] +} + +@test "Contains java" { + run docker run -it bigfleet/shibboleth_idp which java + [ "$status" -eq 0 ] } \ No newline at end of file From 3abd1cbad31218d39d7bf8e9b13d7aed4756f9b0 Mon Sep 17 00:00:00 2001 From: Jim Van Fleet Date: Thu, 21 Jul 2016 14:35:16 -0400 Subject: [PATCH 6/9] Removing push stage from build for now --- Jenkinsfile | 6 ------ 1 file changed, 6 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 5e32a7b..eb659c4 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -16,11 +16,5 @@ node { sh '/usr/local/bin/bats tests/shibboleth-idp.bats' - # stage 'Push' - # if(env.BRANCH_NAME == "master") - # docker.withRegistry('https://registry.hub.docker.com/', 'dockerhub-bigfleet') { - # def baseImg = docker.build('$env.DOCKERHUB_ACCOUNT/shib_') - # baseImg.push('latest') - # } } \ No newline at end of file From 232ea45fe9f69dc7023c72b26b1f5255f5c696e4 Mon Sep 17 00:00:00 2001 From: Jim Van Fleet Date: Thu, 21 Jul 2016 14:41:21 -0400 Subject: [PATCH 7/9] Adapting pipeline to use new binstubs --- Jenkinsfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index eb659c4..739e0cd 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -10,11 +10,11 @@ node { stage 'Base' - sh './build_image.sh' + sh 'bin/build.sh' stage 'Tests' - sh '/usr/local/bin/bats tests/shibboleth-idp.bats' + sh 'bin/test.sh' } \ No newline at end of file From 62910231027baf0fa7430fbbab0870e4a547bf8c Mon Sep 17 00:00:00 2001 From: Jim Van Fleet Date: Thu, 21 Jul 2016 14:46:51 -0400 Subject: [PATCH 8/9] Changing test invocation signature --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 739e0cd..d0c4a24 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -14,7 +14,7 @@ node { stage 'Tests' - sh 'bin/test.sh' + sh '/usr/local/bin/bats tests' } \ No newline at end of file From ed1a661d035c1d774c309948514081bc58444ebb Mon Sep 17 00:00:00 2001 From: Jim Van Fleet Date: Thu, 21 Jul 2016 14:48:54 -0400 Subject: [PATCH 9/9] No ttys on Jenkins --- tests/shibboleth-idp.bats | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/shibboleth-idp.bats b/tests/shibboleth-idp.bats index d50fc1b..a2b2640 100644 --- a/tests/shibboleth-idp.bats +++ b/tests/shibboleth-idp.bats @@ -3,16 +3,16 @@ load ../common @test "Creates non-root Shib IDP home" { - result="$(docker run -it bigfleet/shibboleth_idp ls /opt/shibboleth/current/bin/)" + result="$(docker run -i bigfleet/shibboleth_idp ls /opt/shibboleth/current/bin/)" [ "$result" != '' ] } @test "Retains first-run experience" { - result="$(docker run -it bigfleet/shibboleth_idp ls /tmp/firsttimerunning)" + result="$(docker run -i bigfleet/shibboleth_idp ls /tmp/firsttimerunning)" [ "$result" != '' ] } @test "Contains java" { - run docker run -it bigfleet/shibboleth_idp which java + run docker run -i bigfleet/shibboleth_idp which java [ "$status" -eq 0 ] } \ No newline at end of file