Commit 26351fc2 authored by David Diederich's avatar David Diederich
Browse files

Merge branch 'maven-output-as-file' into 'master'

Maven output as file

See merge request osdu/platform/ci-cd-pipelines!186
parents 962c81bc 3161e7d0
Pipeline #28856 passed with stages
in 20 seconds
......@@ -16,7 +16,13 @@
- ./*/target/*.jar
- ./*/*/target/*.jar
- ./*/*/*/target/*.jar
expire_in: 1 day
- ./maven-output.txt
- ./maven-test-output.txt
- ./*/maven-output.txt
- ./*/*/maven-output.txt
- ./*/*/*/maven-output.txt
when: always
expire_in: 14 days
before_script:
- | # Check for the presence of a maven wrapper script
......@@ -71,8 +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="\$1"; shift
echo "********************************************************************************"
pwd
echo Running \$MAVEN "\$@" ...
if \$MAVEN "\$@" > "\$outputFile" 2>&1; then
tail -n 25 "\$outputFile";
echo '**** Showing the last 25 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 || exit 255" < $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
- 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