Skip to content

Commit

Permalink
Adding tests and revising Jenkinsfile to begin with a passing build
Browse files Browse the repository at this point in the history
  • Loading branch information
Jim Van Fleet committed Jul 27, 2016
1 parent b9d405b commit 71426e7
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 24 deletions.
23 changes: 0 additions & 23 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,32 +14,9 @@ node {
sh 'mv bin/* .'
}

stage 'Build'

def maintainer = maintainer()
def imagename = imagename()
def tag = env.BRANCH_NAME
if(!imagename){
echo "You must define an imagename in common.bash"
currentBuild.result = 'FAILURE'
}
if(maintainer){
echo "Building ${maintainer}:${tag} for ${maintainer}"
}

sh 'bin/build.sh'

stage 'Tests'

sh 'bin/test.sh'

stage 'Push'

docker.withRegistry('https://registry.hub.docker.com/', "dockerhub-$maintainer") {
def baseImg = docker.build("$maintainer/$imagename")
baseImg.push("$tag")
}


}

Expand Down
3 changes: 2 additions & 1 deletion bin/download.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@ 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 xvf shibboleth-identity-provider.tar.gz
tar xf shibboleth-identity-provider.tar.gz
mv shibboleth-identity-provider-$version root
rm -rf root/bin root/logs
17 changes: 17 additions & 0 deletions tests/download.bats
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/usr/bin/env bats

load ../common

setup() {
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 ls root/bin
[ "$status" -eq 1 ]
}

0 comments on commit 71426e7

Please sign in to comment.