Skip to content

Shibboleth IDP service runs! #11

Merged
6 commits merged into from
Aug 4, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
FROM bigfleet/shibboleth_idp
FROM bigfleet/shibboleth_idp:master

ARG maintainer=tier
ARG imagename=shibboleth_idp
ARG version=3.2.1
ENV VERSION=$version
ENV JAVA_OPTS=-Xmx1500m -XX:MaxPermSize=128m

RUN chown -R root:root /opt/shibboleth/shibboleth-identity-provider-$version
RUN chown -R root:root /opt/shibboleth/shibboleth-identity-provider-$version && \
rm -rf /usr/local/tomcat/webapps/* && \
ANT_OPTS="-Didp.target.dir=/opt/shibboleth/current" /opt/shibboleth/current/bin/build.sh && \
ln -s /opt/shibboleth/current /opt/shibboleth-idp && \
ln -s /opt/shibboleth-idp/war/idp.war $CATALINA_HOME/webapps/ROOT.war

EXPOSE 8080
CMD ["catalina.sh", "run"]
10 changes: 9 additions & 1 deletion Jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
node {
node('docker') {

stage 'Checkout'

Expand Down Expand Up @@ -36,10 +36,18 @@ node {
}

sh 'bin/rebuild.sh'

stage 'Start container'

sh 'bin/ci-run.sh && sleep 60'

stage 'Tests'

sh 'bin/test.sh'
// should build a finally construct here
stage 'Stop container'

sh 'bin/ci-stop.sh'

}

Expand Down
6 changes: 6 additions & 0 deletions bin/ci-run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash

# This file will run a container in the background
source common.bash .

docker run -d --name=$imagename -p 8080:8080 $maintainer/$imagename
9 changes: 9 additions & 0 deletions bin/ci-stop.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash

# This file will run a container in the background
source common.bash .

echo "Cleaning up Docker image($maintainer/$imagename)"
docker stop $imagename >> /dev/null
docker rm $imagename
exit 0
5 changes: 5 additions & 0 deletions tests/image.bats
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,8 @@ load ../common
result="$(docker run -i $maintainer/$imagename stat -c '%U' /opt/shibboleth/current/logs)"
[ "$result" != 'UNKNOWN' ]
}

@test "Other Tomcat webapps removed" {
result="$(docker run -i $maintainer/$imagename find /usr/local/tomcat/webapps -type d -print0)"
[ "$result" == '/usr/local/tomcat/webapps' ]
}
14 changes: 9 additions & 5 deletions tests/running.bats
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,18 @@

load ../common

setup() {
bin/start.sh
}
# These tests assume the pipeline will start and stop the container.

@test "Leaves running process" {
result="$(docker ps | grep $imagename)"
[ "$result" != '' ]
}
teardown() {
bin/stop.sh

@test "Exposes running Tomcat service" {
result="$(docker exec -i $imagename curl http://localhost:8080/)"
[ "$result" != '' ]
}

@test "Service is Shibboleth" {
docker exec -i $imagename curl -silent http://localhost:8080/ | grep 'Shibboleth'
}