Skip to content

Commit

Permalink
travis support files
Browse files Browse the repository at this point in the history
  • Loading branch information
paxtonhare committed Oct 2, 2017
1 parent 02b3350 commit 6595eb2
Show file tree
Hide file tree
Showing 8 changed files with 258 additions and 4 deletions.
12 changes: 10 additions & 2 deletions .travis/Dockerfile
Expand Up @@ -34,9 +34,17 @@ ENV JAVA_HOME /usr/java/latest
ENV PATH /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/MarkLogic/mlcmd/bin

# Install MarkLogic
COPY ./MarkLogic.rpm /tmp/MarkLogic.rpm
COPY .travis/install-ml-8.sh /tmp/install-ml-8.sh
COPY .travis/install-ml-9.sh /tmp/install-ml-9.sh
COPY .travis/install-ml-10.sh /tmp/install-ml-10.sh
COPY .travis/install-ml.sh /tmp/install-ml.sh

RUN yum -y install /tmp/MarkLogic.rpm 2>&1 > /dev/null
ARG MLBUILD_USER
ARG MLBUILD_PASSWORD
ARG ML_VERSION

RUN chmod 755 /tmp/install-ml.sh
RUN /tmp/install-ml.sh "$MLBUILD_USER" "$MLBUILD_PASSWORD" "$ML_VERSION"

# Expose MarkLogic Server ports - add additional ones for your REST, etc
# endpoints
Expand Down
51 changes: 51 additions & 0 deletions .travis/install-ml-10.sh
@@ -0,0 +1,51 @@
#!/bin/bash

# runs command from parameters and exits with the eoror code of the command
# if it fails
function successOrExit {
"$@"
local status=$?
if [ $status -ne 0 ]; then
echo "$1 exited with error: $status"
exit $status
fi
}

test $1 && MLBUILD_USER=$1
test $2 && MLBUILD_PASSWORD=$2
test $3 && ML_VERSION=$3

suffix=$(sed -e 's#.*\.\(\)#\1#' <<< $ML_VERSION)
if [[ $suffix = 'nightly' ]]; then
# find today
day=$(date +"%Y%m%d")

# if the user passed a day string as a param then use it instead
test $4 && day=$4
# make a version number out of the date
ver="10.0-$day"

echo "********* Downloading MarkLogic nightly $ver"

# fetch/install ML nightly
fname="MarkLogic-$ver.x86_64.rpm"

url="https://root.marklogic.com/nightly/builds/linux64-rh7/rh7v-10-tst-1.marklogic.com/HEAD/pkgs.$day/$fname"

status=$(curl -k --anyauth -u $MLBUILD_USER:$MLBUILD_PASSWORD --head --write-out %{http_code} --silent --output /dev/null $url)
if [[ $status = 200 ]]; then
successOrExit curl -k --anyauth -u $MLBUILD_USER:$MLBUILD_PASSWORD -o ./$fname $url

fname=$(pwd)/$fname

yum -y install $fname 2>&1 > /dev/null

echo "********* MarkLogic nightly $ver installed"
else
echo "CANNOT DOWNLOAD: status = $status for date $day (URL=\"$url\")"
exit 1
fi
else
echo "There is no ML 10, silly!"
exit 1
fi
66 changes: 66 additions & 0 deletions .travis/install-ml-8.sh
@@ -0,0 +1,66 @@
#!/bin/bash

# runs command from parameters and exits with the eoror code of the command
# if it fails
function successOrExit {
"$@"
local status=$?
if [ $status -ne 0 ]; then
echo "$1 exited with error: $status"
exit $status
fi
}

test $1 && MLBUILD_USER=$1
test $2 && MLBUILD_PASSWORD=$2
test $3 && ML_VERSION=$3

suffix=$(sed -e 's#.*\.\(\)#\1#' <<< $ML_VERSION)
if [[ $suffix = 'nightly' ]]; then
# find today
day=$(date +"%Y%m%d")

# if the user passed a day string as a param then use it instead
test $4 && day=$4
# make a version number out of the date
ver="8.0-$day"

echo "********* Downloading MarkLogic nightly $ver"

# fetch/install ML nightly
fname="MarkLogic-RHEL7-$ver.x86_64.rpm"

url="https://root.marklogic.com/nightly/builds/linux64-rh7/rh7-intel64-80-test-1.marklogic.com/b8_0/pkgs.$day/$fname"

status=$(curl -k --anyauth -u $MLBUILD_USER:$MLBUILD_PASSWORD --head --write-out %{http_code} --silent --output /dev/null $url)
if [[ $status = 200 ]]; then
successOrExit curl -k --anyauth -u $MLBUILD_USER:$MLBUILD_PASSWORD -o ./$fname $url

fname=$(pwd)/$fname

yum -y install $fname --skip-broken

echo "********* MarkLogic nightly $ver installed"
else
echo "CANNOT DOWNLOAD: status = $status for date $day (URL=\"$url\")"
exit 1
fi
else
ver=${ML_VERSION}
fname=MarkLogic-RHEL7-${ver}.x86_64.rpm

curl -c cookies.txt --data "email=${MLBUILD_USER}&password=${MLBUILD_PASSWORD}" https://developer.marklogic.com/login
dl_link=$(curl -b cookies.txt --data "download=/download/binaries/8.0/${fname}" https://developer.marklogic.com/get-download-url | perl -pe 's/.*"path":"([^"]+).*/\1/')
url="https://developer.marklogic.com${dl_link}"

echo "********* Downloading MarkLogic $ver"
echo "Download URL: $url"

successOrExit curl -k -o ./$fname $url

fname=$(pwd)/$fname

yum -y install $fname --skip-broken

echo "********* MarkLogic $ver installed"
fi
65 changes: 65 additions & 0 deletions .travis/install-ml-9.sh
@@ -0,0 +1,65 @@
#!/bin/bash

# runs command from parameters and exits with the eoror code of the command
# if it fails
function successOrExit {
"$@"
local status=$?
if [ $status -ne 0 ]; then
echo "$1 exited with error: $status"
exit $status
fi
}

test $1 && MLBUILD_USER=$1
test $2 && MLBUILD_PASSWORD=$2
test $3 && ML_VERSION=$3

suffix=$(sed -e 's#.*\.\(\)#\1#' <<< $ML_VERSION)
if [[ $suffix = 'nightly' ]]; then
# find today
day=$(date +"%Y%m%d")

# if the user passed a day string as a param then use it instead
test $4 && day=$4
# make a version number out of the date
ver="9.0-$day"

echo "********* Downloading MarkLogic nightly $ver"

# fetch/install ML nightly
fname="MarkLogic-$ver.x86_64.rpm"

url="https://root.marklogic.com/nightly/builds/linux64-rh7/rh7v-intel64-90-test-build.marklogic.com/b9_0/pkgs.$day/$fname"

status=$(curl -k --anyauth -u $MLBUILD_USER:$MLBUILD_PASSWORD --head --write-out %{http_code} --silent --output /dev/null $url)
if [[ $status = 200 ]]; then
successOrExit curl -k --anyauth -u $MLBUILD_USER:$MLBUILD_PASSWORD -o ./$fname $url

fname=$(pwd)/$fname

yum -y install $fname 2>&1 > /dev/null

echo "********* MarkLogic nightly $ver installed"
else
echo "CANNOT DOWNLOAD: status = $status for date $day (URL=\"$url\")"
exit 1
fi
else
ver=${ML_VERSION}
fname=MarkLogic-${ver}.x86_64.rpm

curl -c cookies.txt --data "email=${MLBUILD_USER}&password=${MLBUILD_PASSWORD}" https://developer.marklogic.com/login
dl_link=$(curl -b cookies.txt --data "download=/download/binaries/9.0/${fname}" https://developer.marklogic.com/get-download-url | perl -pe 's/.*"path":"([^"]+).*/\1/')
url="https://developer.marklogic.com${dl_link}"

echo "********* Downloading MarkLogic $ver"

successOrExit curl -k -o ./$fname $url

fname=$(pwd)/$fname

yum -y install $fname 2>&1 > /dev/null

echo "********* MarkLogic $ver installed"
fi
24 changes: 24 additions & 0 deletions .travis/install-ml.sh
@@ -0,0 +1,24 @@
#!/bin/bash

test $1 && MLBUILD_USER=$1
test $2 && MLBUILD_PASSWORD=$2
test $3 && ML_VERSION=$3
echo "ML_VERSION = ${ML_VERSION}"
MAJOR_VER=$(sed -e 's#\([^.]*\)\..*#\1#' <<< $ML_VERSION)
echo "major version = ${MAJOR_VER}"
if [ "${MAJOR_VER}" = "8" ]; then
echo "/tmp/install-ml-8.sh"
chmod 755 /tmp/install-ml-8.sh
/tmp/install-ml-8.sh ${MLBUILD_USER} ${MLBUILD_PASSWORD} ${ML_VERSION}
elif [ "${MAJOR_VER}" = "9" ]; then
echo "/tmp/install-ml-9.sh"
chmod 755 /tmp/install-ml-9.sh
/tmp/install-ml-9.sh ${MLBUILD_USER} ${MLBUILD_PASSWORD} ${ML_VERSION}
elif [ "${MAJOR_VER}" = "10" ]; then
echo "/tmp/install-ml-10.sh"
chmod 755 /tmp/install-ml-10.sh
/tmp/install-ml-10.sh ${MLBUILD_USER} ${MLBUILD_PASSWORD} ${ML_VERSION}
else
echo "NOTHING TO INSTALL!"
exit 1
fi
32 changes: 32 additions & 0 deletions build-docker.sh
@@ -0,0 +1,32 @@
#!/bin/sh

# This script is used to build the docker images
# used to test the DHF in Travis

# build release images
read -p "DMC User: " myuser
read -s -p "DMC Password: " mypass

test $myuser && export MLBUILD_USER=$myuser
test $mypass && export MLBUILD_PASSWORD=$mypass
echo

for ver in 8.0-7 9.0-1.1 9.0-2 9.0-3
do
export ML_VERSION=$ver
docker-compose build
done

# build nightly images
read -p "Nightly User: " myuser
read -s -p "Nightly Password: " mypass

test $myuser && export MLBUILD_USER=$myuser
test $mypass && export MLBUILD_PASSWORD=$mypass
echo

for ver in 8.nightly 9.nightly 10.nightly
do
export ML_VERSION=$ver
docker-compose build
done
6 changes: 5 additions & 1 deletion build.gradle
@@ -1,7 +1,11 @@
allprojects {
task resolveAllDependencies {
doLast {
configurations.all { it.resolve() }
configurations.all {
if (it.isCanBeResolved()) {
it.resolve()
}
}
}
}
}
Expand Down
6 changes: 5 additions & 1 deletion docker-compose.yml
@@ -1,10 +1,14 @@
version: '3'
services:
marklogic:
image: marklogiccommunity/marklogic-datahub:${ML_VERSION}
image: "marklogiccommunity/marklogic-datahub:${ML_VERSION}"
build:
context: .
dockerfile: ./.travis/Dockerfile
args:
- MLBUILD_USER
- MLBUILD_PASSWORD
- ML_VERSION
ports:
- "5005:5005"
- "8000-8020:8000-8020"
Expand Down

0 comments on commit 6595eb2

Please sign in to comment.