Skip to content

Commit

Permalink
Tests and scripts to support building IDP image
Browse files Browse the repository at this point in the history
  • Loading branch information
Jim Van Fleet committed Jul 18, 2016
0 parents commit a27b112
Show file tree
Hide file tree
Showing 11 changed files with 107 additions and 0 deletions.
20 changes: 20 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
FROM bigfleet/centos7base

# Establish a default value for critical variables
# These values are not used by bin scripts or the pipeline.
# Those values are set in common.bash
ARG registry=docker.io
ARG maintainer=tier
ARG imagename=shibboleth_idp
ARG version=3.2.1

ENV VERSION=$version

MAINTAINER $maintainer
LABEL Vendor="Internet2"
LABEL ImageType="Shibboleth IDP Release"
LABEL ImageName=$imagename
LABEL ImageOS=centos7
LABEL Version=$VERSION

CMD echo $VERSION
26 changes: 26 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
node {

env.DOCKERHUB_ACCOUNT = "bigfleet"
env.VERSION_TAG = "3.2.1" // latest version of the release
env.BUILD_TAG = "testing" // default tag to push for to the registry

stage 'Checkout'

checkout scm

stage 'Base'

sh './build_image.sh'

stage 'Tests'

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('bigfleet/centos7base')
baseImg.push('latest')
}

}
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Shibboleth IDP Container Images

This repository creates and distributes Shibboleth IDP images to Dockerhub.

## Supported Images

### Release image

These images track official releases of the software. The `master` branch produces these images, and the build pipeline distributes the results to Dockerhub.

## Development

### Configuration

To alter project configuration details (e.g. which version of the Shibboleth IDP software is the latest), refer to common.bash-- a file referenced by many places.
6 changes: 6 additions & 0 deletions bin/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash

source common.bash .

echo "Building new Docker image($maintainer/$imagename)"
docker build --rm -t $maintainer/$imagename --build-arg maintainer=$maintainer --build-arg imagename=$imagename --build-arg version=$version .
6 changes: 6 additions & 0 deletions bin/destroy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash

source common.bash .

docker rm $(docker ps -a | grep $maintainer/$imagename | awk '{print $1}')
docker rmi $maintainer/$imagename
3 changes: 3 additions & 0 deletions bin/rerun.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash

source bin/destroy.sh && source bin/build.sh && source bin/run.sh
5 changes: 5 additions & 0 deletions bin/retry.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash

source common.bash .

docker rm $(docker ps -a | grep $maintainer/$imagename | awk '{print $1}')
5 changes: 5 additions & 0 deletions bin/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash

source common.bash .

docker run $maintainer/$imagename
3 changes: 3 additions & 0 deletions bin/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash

bats tests
5 changes: 5 additions & 0 deletions common.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
registry="docker.io"
maintainer="bigfleet"
basename="shibboleth_idp"
imagename="shibboleth_idp"
version="3.2.1"
13 changes: 13 additions & 0 deletions tests/shibboleth-idp.bats
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/usr/bin/env bats

load ../common

@test "file reading" {
result="$(echo $maintainer)"
[ "$result" = 'bigfleet' ]
}

@test "container output" {
result="$(docker run bigfleet/shibboleth_idp)"
[ "$result" = '3.2.1' ]
}

0 comments on commit a27b112

Please sign in to comment.