ATS-400 : Build improvements for TravisCI (#24)

* ATS-400 : Build improvements for TravisCI

Building the LibreOffice docker image takes a long time due to the
large packages that need to be downloaded and installed. This results
in more than 10 minutes of inactivity in the build log and TravisCI
kills the job.
Improvements:
- remove and replace unnecessary steps in Docker builds
- cache LibreOffice GZIP distribution in Travis
This commit is contained in:
CezarLeahu 2019-05-20 13:38:44 +03:00 committed by GitHub
parent 27a55855fb
commit 053a6f16e8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 43 additions and 36 deletions

View File

@ -13,6 +13,7 @@ services:
cache: cache:
directories: directories:
- ${HOME}/.m2/repository - ${HOME}/.m2/repository
- ${HOME}/artifacts
branches: branches:
only: only:
@ -37,6 +38,7 @@ jobs:
stage: build stage: build
if: branch NOT IN (company_release) if: branch NOT IN (company_release)
before_install: bash _ci/init.sh before_install: bash _ci/init.sh
before_script: travis_wait bash _ci/cache_artifacts.sh
script: bash _ci/build.sh script: bash _ci/build.sh
- name: "WhiteSource" - name: "WhiteSource"
@ -49,6 +51,7 @@ jobs:
stage: release stage: release
if: branch IN (release, release/SP/1.3.N, release/SP/2.0.N) if: branch IN (release, release/SP/1.3.N, release/SP/2.0.N)
before_install: bash _ci/init.sh before_install: bash _ci/init.sh
before_script: travis_wait bash _ci/cache_artifacts.sh
script: bash _ci/release.sh script: bash _ci/release.sh
before_deploy: source _ci/prepare_staging_deploy.sh before_deploy: source _ci/prepare_staging_deploy.sh
deploy: deploy:

22
_ci/cache_artifacts.sh Normal file
View File

@ -0,0 +1,22 @@
#!/usr/bin/env bash
echo "=========================== Starting Cache Artifacts Script ==========================="
PS4="\[\e[35m\]+ \[\e[m\]"
set -vex
pushd "$(dirname "${BASH_SOURCE[0]}")/../"
# Cache the LibreOffice distribution, as it is takes a long time to download and it can cause the
# build to fail (no output for more than 10 minutes)
LIBREOFFICE_RPM_URL="https://nexus.alfresco.com/nexus/service/local/repositories/thirdparty/content/org/libreoffice/libreoffice-dist/5.4.6/libreoffice-dist-5.4.6-linux.gz"
if [ -f "${HOME}/artifacts/libreoffice-dist-5.4.6-linux.gz" ]; then
echo "Using cached LibreOffice distribution..."
else
echo "Downloading LibreOffice distribution..."
curl -s -S ${LIBREOFFICE_RPM_URL} -o "${HOME}/artifacts/libreoffice-dist-5.4.6-linux.gz"
fi
cp "${HOME}/artifacts/libreoffice-dist-5.4.6-linux.gz" alfresco-docker-libreoffice/
popd
set +vex
echo "=========================== Finishing Cache Artifacts Script =========================="

View File

@ -18,12 +18,10 @@ ARG USERID=33001
COPY target/alfresco-docker-alfresco-pdf-renderer-${env.project_version}.jar /usr/bin COPY target/alfresco-docker-alfresco-pdf-renderer-${env.project_version}.jar /usr/bin
RUN ln /usr/bin/alfresco-docker-alfresco-pdf-renderer-${env.project_version}.jar /usr/bin/alfresco-docker-alfresco-pdf-renderer.jar && \ RUN ln /usr/bin/alfresco-docker-alfresco-pdf-renderer-${env.project_version}.jar /usr/bin/alfresco-docker-alfresco-pdf-renderer.jar && \
yum install -y wget && \ curl -s -S $ALFRESCO_PDF_RENDERER_LIB_RPM_URL -o alfresco-pdf-renderer-linux.tgz && \
wget $ALFRESCO_PDF_RENDERER_LIB_RPM_URL && \ curl -s -S $PDFIUM_LICENSE_FILE -o pdfium.txt && \
wget $PDFIUM_LICENSE_FILE && \ tar xf alfresco-pdf-renderer-linux.tgz -C /usr/bin && \
tar xf alfresco-pdf-renderer-*-linux.tgz -C /usr/bin && \ rm -f alfresco-pdf-renderer-linux.tgz && \
rm -f alfresco-pdf-renderer-*-linux.tgz && \
yum remove -y wget && \
yum clean all yum clean all
ADD target/generated-resources/licenses /licenses ADD target/generated-resources/licenses /licenses

View File

@ -67,7 +67,6 @@
<groupId>io.fabric8</groupId> <groupId>io.fabric8</groupId>
<artifactId>fabric8-maven-plugin</artifactId> <artifactId>fabric8-maven-plugin</artifactId>
<configuration> <configuration>
<verbose/>
<images> <images>
<image> <image>
<name>${image.name}:${image.tag}</name> <name>${image.name}:${image.tag}</name>
@ -112,7 +111,6 @@
<groupId>io.fabric8</groupId> <groupId>io.fabric8</groupId>
<artifactId>fabric8-maven-plugin</artifactId> <artifactId>fabric8-maven-plugin</artifactId>
<configuration> <configuration>
<verbose/>
<images> <images>
<!-- QuayIO image --> <!-- QuayIO image -->
<image> <image>
@ -154,7 +152,6 @@
<groupId>io.fabric8</groupId> <groupId>io.fabric8</groupId>
<artifactId>fabric8-maven-plugin</artifactId> <artifactId>fabric8-maven-plugin</artifactId>
<configuration combine.self="override"> <configuration combine.self="override">
<verbose/>
<images> <images>
<!-- QuayIO image --> <!-- QuayIO image -->
<image> <image>

View File

@ -19,13 +19,11 @@ ARG USERID=33002
COPY target/alfresco-docker-imagemagick-${env.project_version}.jar /usr/bin COPY target/alfresco-docker-imagemagick-${env.project_version}.jar /usr/bin
RUN ln /usr/bin/alfresco-docker-imagemagick-${env.project_version}.jar /usr/bin/alfresco-docker-imagemagick.jar && \ RUN ln /usr/bin/alfresco-docker-imagemagick-${env.project_version}.jar /usr/bin/alfresco-docker-imagemagick.jar && \
yum install -y wget && \ curl -s -S $IMAGEMAGICK_RPM_URL -o imagemagick-distribution-linux.rpm && \
wget $IMAGEMAGICK_RPM_URL && \ curl -s -S $IMAGEMAGICK_LIB_RPM_URL -o imagemagick-distribution-libs-linux.rpm && \
wget $IMAGEMAGICK_LIB_RPM_URL && \ curl -s -S $IMAGEMAGICK_LICENSE_FILE -o ImageMagick-license.txt && \
wget $IMAGEMAGICK_LICENSE_FILE && \ yum localinstall -y imagemagick-distribution-*linux.rpm && \
yum localinstall -y imagemagick-distribution-*-linux.rpm && \ rm -f imagemagick-distribution-*.rpm && \
rm -f imagemagick-distribution-*-linux.rpm && \
yum remove -y wget && \
yum clean all yum clean all
ADD target/generated-resources/licenses /licenses ADD target/generated-resources/licenses /licenses

View File

@ -67,7 +67,6 @@
<groupId>io.fabric8</groupId> <groupId>io.fabric8</groupId>
<artifactId>fabric8-maven-plugin</artifactId> <artifactId>fabric8-maven-plugin</artifactId>
<configuration> <configuration>
<verbose/>
<images> <images>
<image> <image>
<name>${image.name}:${image.tag}</name> <name>${image.name}:${image.tag}</name>
@ -112,7 +111,6 @@
<groupId>io.fabric8</groupId> <groupId>io.fabric8</groupId>
<artifactId>fabric8-maven-plugin</artifactId> <artifactId>fabric8-maven-plugin</artifactId>
<configuration> <configuration>
<verbose/>
<images> <images>
<!-- QuayIO image --> <!-- QuayIO image -->
<image> <image>
@ -154,7 +152,6 @@
<groupId>io.fabric8</groupId> <groupId>io.fabric8</groupId>
<artifactId>fabric8-maven-plugin</artifactId> <artifactId>fabric8-maven-plugin</artifactId>
<configuration combine.self="override"> <configuration combine.self="override">
<verbose/>
<images> <images>
<!-- QuayIO image --> <!-- QuayIO image -->
<image> <image>

View File

@ -15,17 +15,17 @@ ARG GROUPID=1000
ARG USERNAME=libreoffice ARG USERNAME=libreoffice
ARG USERID=33003 ARG USERID=33003
COPY target/alfresco-docker-libreoffice-${env.project_version}.jar /usr/bin COPY target/alfresco-docker-libreoffice-${env.project_version}.jar libreoffice-dist-*-linux.gz /
RUN ln /usr/bin/alfresco-docker-libreoffice-${env.project_version}.jar /usr/bin/alfresco-docker-libreoffice.jar && \ RUN ln /alfresco-docker-libreoffice-${env.project_version}.jar /usr/bin/alfresco-docker-libreoffice.jar && \
yum install -y wget && \
yum install -y cairo cups-libs libSM && \ yum install -y cairo cups-libs libSM && \
wget $LIBREOFFICE_RPM_URL && \ test -f libreoffice-dist-5.4.6-linux.gz && \
wget $LIBREOFFICE_LICENSE_FILE && \ mv libreoffice-dist-5.4.6-linux.gz libreoffice-dist-linux.gz || \
tar xzf libreoffice-dist-*-linux.gz && \ curl -s -S $LIBREOFFICE_RPM_URL -o libreoffice-dist-linux.gz && \
curl -s -S $LIBREOFFICE_LICENSE_FILE -o libreoffice.txt && \
tar xzf libreoffice-dist-linux.gz && \
yum localinstall -y LibreOffice*/RPMS/*.rpm && \ yum localinstall -y LibreOffice*/RPMS/*.rpm && \
rm -rf libreoffice-dist-*-linux.gz LibreOffice_*_Linux_x86-64_rpm && \ rm -rf libreoffice-dist-linux.gz LibreOffice_*_Linux_x86-64_rpm && \
yum remove -y wget && \
yum clean all yum clean all
ADD target/generated-resources/licenses /licenses ADD target/generated-resources/licenses /licenses

View File

@ -75,7 +75,6 @@
<groupId>io.fabric8</groupId> <groupId>io.fabric8</groupId>
<artifactId>fabric8-maven-plugin</artifactId> <artifactId>fabric8-maven-plugin</artifactId>
<configuration> <configuration>
<verbose/>
<images> <images>
<image> <image>
<name>${image.name}:${image.tag}</name> <name>${image.name}:${image.tag}</name>
@ -120,7 +119,6 @@
<groupId>io.fabric8</groupId> <groupId>io.fabric8</groupId>
<artifactId>fabric8-maven-plugin</artifactId> <artifactId>fabric8-maven-plugin</artifactId>
<configuration> <configuration>
<verbose/>
<images> <images>
<!-- QuayIO image --> <!-- QuayIO image -->
<image> <image>
@ -162,7 +160,6 @@
<groupId>io.fabric8</groupId> <groupId>io.fabric8</groupId>
<artifactId>fabric8-maven-plugin</artifactId> <artifactId>fabric8-maven-plugin</artifactId>
<configuration combine.self="override"> <configuration combine.self="override">
<verbose/>
<images> <images>
<!-- QuayIO image --> <!-- QuayIO image -->
<image> <image>

View File

@ -17,9 +17,7 @@ ARG USERID=33004
COPY target/alfresco-docker-tika-${env.project_version}.jar /usr/bin COPY target/alfresco-docker-tika-${env.project_version}.jar /usr/bin
RUN ln /usr/bin/alfresco-docker-tika-${env.project_version}.jar /usr/bin/alfresco-docker-tika.jar && \ RUN ln /usr/bin/alfresco-docker-tika-${env.project_version}.jar /usr/bin/alfresco-docker-tika.jar && \
yum install -y wget && \ curl -s -S $APACHE_LICENSE_FILE -o Apache\ 2.0.txt && \
wget $APACHE_LICENSE_FILE && \
yum remove -y wget && \
yum clean all yum clean all
ADD target/generated-resources/licenses /licenses ADD target/generated-resources/licenses /licenses

View File

@ -139,7 +139,6 @@
<groupId>io.fabric8</groupId> <groupId>io.fabric8</groupId>
<artifactId>fabric8-maven-plugin</artifactId> <artifactId>fabric8-maven-plugin</artifactId>
<configuration> <configuration>
<verbose/>
<images> <images>
<image> <image>
<name>${image.name}:${image.tag}</name> <name>${image.name}:${image.tag}</name>
@ -184,7 +183,6 @@
<groupId>io.fabric8</groupId> <groupId>io.fabric8</groupId>
<artifactId>fabric8-maven-plugin</artifactId> <artifactId>fabric8-maven-plugin</artifactId>
<configuration> <configuration>
<verbose/>
<images> <images>
<!-- QuayIO image --> <!-- QuayIO image -->
<image> <image>
@ -226,7 +224,6 @@
<groupId>io.fabric8</groupId> <groupId>io.fabric8</groupId>
<artifactId>fabric8-maven-plugin</artifactId> <artifactId>fabric8-maven-plugin</artifactId>
<configuration combine.self="override"> <configuration combine.self="override">
<verbose/>
<images> <images>
<!-- QuayIO image --> <!-- QuayIO image -->
<image> <image>