Skip to content

Commit

Permalink
Merge pull request #63 from docker/181001
Browse files Browse the repository at this point in the history
add CI/CD tests and test-compose example
  • Loading branch information
pcaskey authored Oct 10, 2018
2 parents 6f484c4 + 118b2a6 commit 9f0a3d6
Show file tree
Hide file tree
Showing 111 changed files with 542,733 additions and 6 deletions.
5 changes: 2 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ FROM centos:centos7
#
##tomcat \
ENV TOMCAT_MAJOR=9 \
TOMCAT_VERSION=9.0.11 \
TOMCAT_VERSION=9.0.12 \
##shib-idp \
VERSION=3.3.3 \
##TIER \
TIERVERSION=180802 \
TIERVERSION=181001 \
################## \
### OTHER VARS ### \
################## \
Expand Down Expand Up @@ -231,5 +231,4 @@ EXPOSE 443
HEALTHCHECK --interval=2m --timeout=30s \
CMD curl -k -f https://127.0.0.1/idp/status || exit 1


CMD ["/usr/bin/startup.sh"]
18 changes: 15 additions & 3 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ node('docker') {

checkout scm

stage 'Acquire util'
stage 'Acquire util files'

sh 'mkdir -p tmp && mkdir -p bin'
dir('tmp'){
git([ url: "https://github.internet2.edu/docker/util.git",
Expand Down Expand Up @@ -51,6 +51,7 @@ node('docker') {
}

stage 'Build'

try{
sh 'bin/rebuild.sh &> debug'
} catch(error) {
Expand All @@ -59,6 +60,17 @@ node('docker') {
sh "rm -f ./debug"
handleError(message)
}

stage 'Test'

try {
sh 'bin/test.sh 2>&1 | tee debug ; test ${PIPESTATUS[0]} -eq 0'
} catch (error) {
def error_details = readFile('./debug')
def message = "BUILD ERROR: There was a problem testing ${imagename}:${tag}. \n\n ${error_details}"
sh "rm -f ./debug"
handleError(message)
}

stage 'Push'

Expand All @@ -68,7 +80,7 @@ node('docker') {
}

stage 'Notify'

slackSend color: 'good', message: "$maintainer/$imagename:$tag pushed to DockerHub"

}
Expand Down
9 changes: 9 additions & 0 deletions test-compose/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
The test-compose directory contains an example Shibboleth IdP environment that starts up the IdP, along with an LDAP directory. This example demonstrates how one might go about customizing and deploying their own local IdP containers, using the TIER Shibboleth IdP image as a base image.

In this example, the following cases are covered by this example:

ldap - The IdP uses an LDAP example directory as both the authentication source and attribute source.

It should be noted that while this example uses Docker Compose as a build and deployment vehicle, ideally one should use a CI server to build and publish institution specific images to an image repository as changes to the institution's customizations are committed to the source repository. These images would then be deployed to Docker Swarm, assuming that the appropriate Docker Secrets and Configs have been published to the swarm.


14 changes: 14 additions & 0 deletions test-compose/compose.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/sh
docker-compose up --build -d

echo ""
echo "If everything above was successful, your IdP metadata can be retreived with this command (after a minute or two):"
echo " curl -k https://127.0.0.1/idp/shibboleth"
echo ""
echo "By default, this test IdP is pre-integrated with the samltest.id testing service."
echo ""
echo "If you are testing the default test config and have port 443 open,"
echo " map your IP to idp.example.edu in your hosts file,"
echo " then proceed to https://samltest.id/start-idp-test to test this IdP test instance."
echo ""

35 changes: 35 additions & 0 deletions test-compose/data/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
FROM tier/shib-idp:latest

LABEL author="tier-packaging@internet2.edu <tier-packaging@internet2.edu>"

COPY container_files/seed-data/ /seed-data/

RUN yum install -y epel-release \
&& yum update -y \
&& yum install -y 389-ds-base 389-admin 389-adminutil \
&& yum clean all \
&& rm -rf /var/cache/yum

RUN useradd ldapadmin \
&& rm -fr /var/lock /usr/lib/systemd/system \
# The 389-ds setup will fail because the hostname can't reliable be determined, so we'll bypass it and then install. \
&& sed -i 's/checkHostname {/checkHostname {\nreturn();/g' /usr/lib64/dirsrv/perl/DSUtil.pm \
# Not doing SELinux \
&& sed -i 's/updateSelinuxPolicy($inf);//g' /usr/lib64/dirsrv/perl/* \
# Do not restart at the end \
&& sed -i '/if (@errs = startServer($inf))/,/}/d' /usr/lib64/dirsrv/perl/* \
&& setup-ds.pl --silent --file /seed-data/ds-setup.inf \
&& /usr/sbin/ns-slapd -D /etc/dirsrv/slapd-dir \
&& while ! curl -s ldap://localhost:389 > /dev/null; do echo waiting for ldap to start; sleep 1; done; \
ldapadd -H ldap:/// -f /seed-data/users.ldif -x -D "cn=Directory Manager" -w password

RUN (/usr/sbin/ns-slapd -D /etc/dirsrv/slapd-dir &) \
&& while ! curl -s ldap://localhost:389 > /dev/null; do echo waiting for ldap to start; sleep 1; done;

EXPOSE 389

HEALTHCHECK --interval=1m --timeout=10s \
CMD cat < /dev/null > /dev/tcp/127.0.0.1/389 || exit 1

CMD /usr/sbin/ns-slapd -D /etc/dirsrv/slapd-dir && tail -F /var/log/dirsrv/slapd-dir/errors

29 changes: 29 additions & 0 deletions test-compose/data/container_files/seed-data/ds-setup.inf
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
[General]
AdminDomain = internet2.edu
ConfigDirectoryAdminID = admin
ConfigDirectoryAdminPwd = admin
ConfigDirectoryLdapURL = ldap://localhost:389/o=NetscapeRoot
FullMachineName = localhost
ServerRoot = /usr/lib64/dirsrv
SuiteSpotGroup = nobody
SuiteSpotUserID = nobody

[admin]
Port = 9830
ServerAdminID = admin
ServerAdminPwd = admin
ServerIpAddress = 0.0.0.0
SysUser = nobody

[slapd]
AddOrgEntries = Yes
AddSampleEntries = No
InstallLdifFile = suggest
RootDN = cn=Directory Manager
RootDNPwd = password
ServerIdentifier = dir
ServerPort = 389
SlapdConfigForMC = yes
Suffix = dc=internet2,dc=edu
UseExistingMC = No

Loading

0 comments on commit 9f0a3d6

Please sign in to comment.