From 07ffe6eebccae628732be1ec769d13ce7302ab81 Mon Sep 17 00:00:00 2001 From: Jim Van Fleet Date: Tue, 2 Aug 2016 15:22:03 -0400 Subject: [PATCH 1/6] Repoints download, closes #3 --- bin/download.sh | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/bin/download.sh b/bin/download.sh index 4045d91..b726b7a 100755 --- a/bin/download.sh +++ b/bin/download.sh @@ -4,8 +4,5 @@ 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" -fi -tar xf shibboleth-identity-provider.tar.gz -mv shibboleth-identity-provider-$version root -rm -rf root/bin root/logs + git clone git@github.internet2.edu:docker/shib-idp-conftree.git --depth 1 --branch test root +fi \ No newline at end of file From 3b59a8bd4470c512977af4da2de1ae96bed5e2e8 Mon Sep 17 00:00:00 2001 From: Jim Van Fleet Date: Tue, 2 Aug 2016 15:31:28 -0400 Subject: [PATCH 2/6] Adding image tests --- tests/image.bats | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 tests/image.bats diff --git a/tests/image.bats b/tests/image.bats new file mode 100644 index 0000000..08b1215 --- /dev/null +++ b/tests/image.bats @@ -0,0 +1,22 @@ +#!/usr/bin/env bats + +load ../common + +setup() { + ./bin/rebuild.sh +} + +@test "Creates non-root Shib IDP home" { + result="$(docker run -i $maintainer/$imagename ls /opt/shibboleth/current/bin/)" + [ "$result" != '' ] +} + +@test "Retains first-run experience" { + result="$(docker run -i $maintainer/$imagename ls /tmp/firsttimerunning)" + [ "$result" != '' ] +} + +@test "Contains java" { + run docker run -i $maintainer/$imagename which java + [ "$status" -eq 0 ] +} \ No newline at end of file From 54e9730b2f41a627000110e06d264db856d753b8 Mon Sep 17 00:00:00 2001 From: Jim Van Fleet Date: Tue, 2 Aug 2016 16:08:57 -0400 Subject: [PATCH 3/6] Failing test on logs directory and ownership --- Dockerfile | 6 ++++++ tests/image.bats | 8 +++++++- 2 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..91ebc94 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,6 @@ +FROM bigfleet/shibboleth_idp + +ARG maintainer=tier +ARG imagename=shibboleth_idp +ARG version=3.2.1 +ENV VERSION=$version \ No newline at end of file diff --git a/tests/image.bats b/tests/image.bats index 08b1215..4f0ce20 100644 --- a/tests/image.bats +++ b/tests/image.bats @@ -19,4 +19,10 @@ setup() { @test "Contains java" { run docker run -i $maintainer/$imagename which java [ "$status" -eq 0 ] -} \ No newline at end of file +} + +@test "Logs directory exists, owned by root" { + result="$(docker run -i $maintainer/$imagename stat -c '%U' /opt/shibboleth/current/logs)" + [ "$result" != 'UNKNOWN' ] + [ "$status" -eq 0 ] +} From 19164b1335c36f7b3ef6f3af0cb2862260bdade6 Mon Sep 17 00:00:00 2001 From: Jim Van Fleet Date: Tue, 2 Aug 2016 16:11:30 -0400 Subject: [PATCH 4/6] Download tests are less important --- tests/download.bats | 23 ----------------------- 1 file changed, 23 deletions(-) delete mode 100644 tests/download.bats diff --git a/tests/download.bats b/tests/download.bats deleted file mode 100644 index 7077da4..0000000 --- a/tests/download.bats +++ /dev/null @@ -1,23 +0,0 @@ -#!/usr/bin/env bats - -load ../common - -setup() { - echo $PWD > test.log - ./bin/download.sh -} - -@test "Downloads a Shibboleth IDP tree" { - result="$(ls root/conf/idp.properties)" - [ "$result" = 'root/conf/idp.properties' ] -} - -@test "Prunes Shibboleth IDP binaries" { - run find root/bin - [ "$status" -eq 1 ] -} - -@test "Prunes Shibboleth IDP logs" { - run find root/logs - [ "$status" -eq 1 ] -} From cff00a7c7dcb453caa2e2f39f910b4f873c12a21 Mon Sep 17 00:00:00 2001 From: Jim Van Fleet Date: Tue, 2 Aug 2016 16:27:02 -0400 Subject: [PATCH 5/6] Checking logs directory --- Dockerfile | 4 +++- tests/image.bats | 1 - 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 91ebc94..a8c98cb 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,4 +3,6 @@ FROM bigfleet/shibboleth_idp ARG maintainer=tier ARG imagename=shibboleth_idp ARG version=3.2.1 -ENV VERSION=$version \ No newline at end of file +ENV VERSION=$version + +RUN chown -R root:root /opt/shibboleth/shibboleth-identity-provider-$version \ No newline at end of file diff --git a/tests/image.bats b/tests/image.bats index 4f0ce20..5cd7405 100644 --- a/tests/image.bats +++ b/tests/image.bats @@ -24,5 +24,4 @@ setup() { @test "Logs directory exists, owned by root" { result="$(docker run -i $maintainer/$imagename stat -c '%U' /opt/shibboleth/current/logs)" [ "$result" != 'UNKNOWN' ] - [ "$status" -eq 0 ] } From 399fb2c4681fce69c109f6a42dded48e06956599 Mon Sep 17 00:00:00 2001 From: Jim Van Fleet Date: Tue, 2 Aug 2016 16:31:10 -0400 Subject: [PATCH 6/6] Replicating download inside Jenkinsfile --- Jenkinsfile | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Jenkinsfile b/Jenkinsfile index f283330..195076b 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -14,6 +14,14 @@ node { sh 'mv bin/* .' } + stage 'Acquire conftree' + + sh 'mkdir -p root' + dir('root'){ + git([ url: "https://github.internet2.edu/docker/shib-idp-conftree.git", + branch: "test", credentialsId: "jenkins-github-access-token" ]) + } + stage 'Tests' sh 'bin/test.sh'