Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Apply the latest version of build scripts
(copied from master to this branch)
mederly committed Oct 6, 2018
1 parent ecc39ef commit 7de06cc
Showing 7 changed files with 53 additions and 41 deletions.
6 changes: 3 additions & 3 deletions Dockerfile
@@ -1,5 +1,5 @@
#
# Building assumes midpoint-3.9-SNAPSHOT-dist.tar.gz is present in the current directory.
# Building assumes midpoint-dist.tar.gz is present in the current directory.
#

FROM tier/shibboleth_sp
@@ -50,7 +50,7 @@ RUN cp /dev/null /etc/httpd/conf.d/ssl.conf \
# Build arguments

ARG MP_VERSION=3.9-SNAPSHOT
ARG MP_DIST_FILE=midpoint-${MP_VERSION}-dist.tar.gz
ARG MP_DIST_FILE=midpoint-dist.tar.gz

ENV MP_DIR /opt/midpoint

@@ -60,7 +60,7 @@ COPY ${MP_DIST_FILE} ${MP_DIR}
COPY container_files/mp-dir/ ${MP_DIR}/

RUN echo 'Extracting midPoint archive...' \
&& tar xzf ${MP_DIR}/midpoint-${MP_VERSION}-dist.tar.gz -C ${MP_DIR} --strip-components=1
&& tar xzf ${MP_DIR}/${MP_DIST_FILE} -C ${MP_DIR} --strip-components=1

VOLUME ${MP_DIR}/var

13 changes: 8 additions & 5 deletions Jenkinsfile
@@ -27,15 +27,18 @@ pipeline {
sh 'ls'
sh 'mv bin/* ../bin/.'
}
// Build and test scripts expect that 'tag' is present in common.bash. This is necessary for both Jenkins and standalone testing.
// We don't care if there are more 'tag' assignments there. The latest one wins.
sh "echo >> common.bash ; echo \"tag=\\\"${tag}\\\"\" >> common.bash ; echo common.bash ; cat common.bash"
}
}
}
stage ('Build') {
steps {
script {
try {
sh './download-midpoint 2>&1 | tee -a debug ; test ${PIPESTATUS[0]} -eq 0'
sh './jenkins-rebuild.sh 2>&1 | tee -a debug ; test ${PIPESTATUS[0]} -eq 0' // temporary
// using custom ./build.sh instead of bin/rebuild.sh because the bin/ version does not support building specific tag yet
sh './build.sh -r 2>&1 | tee -a debug ; test ${PIPESTATUS[0]} -eq 0'
} catch (error) {
def error_details = readFile('./debug')
def message = "BUILD ERROR: There was a problem building ${imagename}:${tag}. \n\n ${error_details}"
@@ -54,9 +57,9 @@ pipeline {
sh 'echo Docker containers before compositions tests ; docker ps -a' // temporary

sh '(cd demo/simple ; bats tests ) 2>&1 | tee -a debug ; test ${PIPESTATUS[0]} -eq 0'
sh '(cd demo/shibboleth ; bats tests ) 2>&1 | tee -a debug ; test ${PIPESTATUS[0]} -eq 0'
sh '(cd demo/postgresql ; bats tests ) 2>&1 | tee -a debug ; test ${PIPESTATUS[0]} -eq 0'
sh '(cd demo/complex ; bats tests ) 2>&1 | tee -a debug ; test ${PIPESTATUS[0]} -eq 0'
//sh '(cd demo/shibboleth ; bats tests ) 2>&1 | tee -a debug ; test ${PIPESTATUS[0]} -eq 0'
//sh '(cd demo/postgresql ; bats tests ) 2>&1 | tee -a debug ; test ${PIPESTATUS[0]} -eq 0'
//sh '(cd demo/complex ; bats tests ) 2>&1 | tee -a 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}"
31 changes: 25 additions & 6 deletions build.sh
@@ -1,16 +1,35 @@
#!/bin/bash

cd "$(dirname "$0")"
source common.bash

SKIP_DOWNLOAD=0
while getopts "nh?" opt; do
while getopts "nhr?" opt; do
case $opt in
n) SKIP_DOWNLOAD=1 ;;
h | ?) echo "Options: -n skip download" ; exit 0 ;;
*) echo "Unknown option: $opt" ; exit 1 ;;
n)
SKIP_DOWNLOAD=1
;;
r)
result=$(docker ps -a | grep $maintainer/$imagename:$tag)
if [ ! -z "$result" ]; then
echo "Cleaning up $maintainer/$imagename:$tag..."
docker rm -f $(docker ps -a | grep $maintainer/$imagename:$tag | awk '{print $1}')
docker rmi -f $maintainer/$imagename:$tag
echo "Done"
fi
;;
h | ?)
echo "Options: -n skip download"
exit 0
;;
*)
echo "Unknown option: $opt"
exit 1
;;
esac
done
if [ "$SKIP_DOWNLOAD" = "0" ]; then ./download-midpoint; fi
docker build --tag tier/midpoint:3.9-SNAPSHOT-stable .
if [ "$SKIP_DOWNLOAD" = "0" ]; then ./download-midpoint || exit 1; fi
docker build --tag $maintainer/$imagename:$tag --build-arg maintainer=$maintainer --build-arg imagename=$imagename . || exit 1
echo "---------------------------------------------------------------------------------------"
echo "The midPoint containers were successfully built. To start them, execute the following:"
echo ""
2 changes: 1 addition & 1 deletion common.bash
@@ -1,3 +1,3 @@
maintainer="tier"
imagename="midpoint"
version="3.9-SNAPSHOT-stable"
tag="3.9-SNAPSHOT-stable"
19 changes: 14 additions & 5 deletions download-midpoint
@@ -1,16 +1,25 @@
#!/bin/bash

dir=`dirname "$0"`
echo "Downloading midPoint 3.9-SNAPSHOT"
DIR=`dirname "$0"`
source $DIR/common.bash
if [[ -n "$1" ]]; then
MP_VERSION=$1
else
if [[ $tag == "latest" ]]; then
MP_VERSION=3.9-SNAPSHOT
else
MP_VERSION=$tag
fi
fi
echo "Downloading midPoint $MP_VERSION"
echo "-----------------------------------------"
curl --output $dir/midpoint-3.9-SNAPSHOT-dist.tar.gz "https://evolveum.com/downloads/midpoint-tier/midpoint-3.9-SNAPSHOT-stable-dist.tar.gz"
curl --output $DIR/midpoint-dist.tar.gz "https://evolveum.com/downloads/midpoint-tier/midpoint-$MP_VERSION-dist.tar.gz"
echo "-----------------------------------------"
echo "Checking the download..."
if tar -tf $dir/midpoint-3.9-SNAPSHOT-dist.tar.gz >/dev/null; then
if tar -tf $DIR/midpoint-dist.tar.gz >/dev/null; then
echo "OK"
exit 0
else
echo "The file was not downloaded correctly"
exit 1
fi

19 changes: 0 additions & 19 deletions jenkins-rebuild.sh

This file was deleted.

4 changes: 2 additions & 2 deletions tests/main.bats
@@ -3,11 +3,11 @@
load ../common

@test "010 Image is present" {
docker image inspect tier/midpoint:3.9-SNAPSHOT-stable
docker image inspect tier/midpoint:$tag
}

@test "020 Check basic components" {
docker run -i $maintainer/$imagename \
docker run -i $maintainer/$imagename:$tag \
find \
/usr/local/bin/startup.sh \
/opt/midpoint/var/ \

0 comments on commit 7de06cc

Please sign in to comment.