Commit b12a0394 authored by David Diederich's avatar David Diederich
Browse files

Attempting to get much fancier by using an inline-generate script file instead...

Attempting to get much fancier by using an inline-generate script file instead of the super-long one liner
parent 04654d4b
......@@ -77,10 +77,31 @@ compile-and-unit-test:
- .skipForTriggeringMergeRequests
stage: build
script:
# This creates a script for running maven, capturing output to a file.
# - First argument is the directory to build from
# - Second argument is the name to use for the logfile
# - The remaining arguments are the maven command to run
- |
cat > maven-build.sh <<EOF
cd "$1"; shift
outputFile="$2"; shift
echo "********************************************************************************"
pwd
echo Running $MAVEN "$@" ...
if $MAVEN "$@" >& "$outputFile"; then
tail -n 100 "$outputFile"
echo '**** Showing the last 100 lines of the passed build (above). See Job artifacts for full log details *****'
else
tail -n 200 "$outputFile"
echo '**** Showing the last 200 lines of the failed build (above). See Job artifacts for full log details *****'
exit 255
fi
EOF
# First, build and deploy all the independent POM projects that we find
- xargs -0rn 1 -I {} sh -c "cd '{}' && $MAVEN deploy --update-snapshots -DskipTests=true >& maven-output.txt || (tail -n 200 maven-output.txt; echo '**** Showing the last 200 lines of the failed build. See Job artifacts for full log details *****'; exit 255) && (tail -n 100 maven-output.txt; echo '**** Showing the last 100 lines of the passed build. See Job artifacts for full log details *****' ")" < $ALL_MAVEN_BUILD_DIRS_Z
- xargs -0rn 1 -I {} sh maven-build.sh {} maven-output.txt deploy --update-snapshots -DskipTests=true < $ALL_MAVEN_BUILD_DIRS_Z
# Then, run the unit tests on the main project only
- $MAVEN test >& maven-test-output.txt
- tail -n 100 maven-test-output.txt
- sh maven-build.sh . maven-test-output.txt test
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment