diff options
author | cyBerta <cyberta@riseup.net> | 2017-10-03 10:57:53 +0200 |
---|---|---|
committer | cyBerta <cyberta@riseup.net> | 2017-10-11 18:45:02 +0200 |
commit | ca6a6bab5412dd13ab19f7043f320efe14a72dbd (patch) | |
tree | affd52c4a501e3d6ce9f56e3c664d940a0d63387 | |
parent | adc6f7672c380d534fc963d868fe5aebcab54b4a (diff) |
8755 redirect logs during docker image creation to an artifact file
-rw-r--r-- | .gitlab-ci.yml | 8 | ||||
-rwxr-xr-x | .gitlab/build.sh | 11 | ||||
-rw-r--r-- | docker/android-emulator/Dockerfile | 2 | ||||
-rw-r--r-- | docker/android-ndk/Dockerfile | 2 |
4 files changed, 16 insertions, 7 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index bddbc547..5819f343 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -24,7 +24,13 @@ variables: script: - docker --version - docker info - - .gitlab/build.sh ${DOCKER_IMAGE} + - if ! .gitlab/build.sh ${DOCKER_IMAGE} >> dockerbuild.log 2>&1; then echo "Image build failed. Please check dockerbuild.log."; exit 1; fi; + allow_failure: false + artifacts: + when: on_failure + expire_in: 31d + paths: + - dockerbuild.log docker_image:sdk: stage: docker_image_sdk diff --git a/.gitlab/build.sh b/.gitlab/build.sh index cc63075d..6f989001 100755 --- a/.gitlab/build.sh +++ b/.gitlab/build.sh @@ -17,8 +17,13 @@ TAG=${2:-latest} DOCKERFILE=docker/${DIR}/${2:-Dockerfile}${2:+.dockerfile} TARGET=${CI_REGISTRY_IMAGE}/${DIR}:${TAG} +function quit { + echo "Image build failed. Exit value: $?." + exit 1 +} + if git diff "$LAST_COMMIT" HEAD --name-only | egrep "($DOCKERFILE|^.gitlab)"; then - docker login -u gitlab-ci-token -p "$CI_JOB_TOKEN" "$CI_REGISTRY" - docker build -t "$TARGET" -f "$DOCKERFILE" docker/ - docker push "$TARGET" + docker login -u gitlab-ci-token -p "$CI_JOB_TOKEN" "$CI_REGISTRY" || quit + docker build -t "$TARGET" -f "$DOCKERFILE" docker/ || quit + docker push "$TARGET" || quit fi diff --git a/docker/android-emulator/Dockerfile b/docker/android-emulator/Dockerfile index 7cdd9b3e..bececd08 100644 --- a/docker/android-emulator/Dockerfile +++ b/docker/android-emulator/Dockerfile @@ -31,7 +31,7 @@ RUN apt-get update -qq && \ RUN echo y | sdkmanager "emulator" # Install System Images for emulators -RUN echo y | sdkmanager "system-images;android-26;google_apis;x86_64" +RUN echo y | sdkmanager "system-images;android-26;google_apis;x86" RUN echo y | sdkmanager "system-images;android-25;google_apis;x86_64" RUN echo y | sdkmanager "system-images;android-24;google_apis;x86_64" RUN echo y | sdkmanager "system-images;android-23;google_apis;x86_64" diff --git a/docker/android-ndk/Dockerfile b/docker/android-ndk/Dockerfile index 34d1d641..7739fa47 100644 --- a/docker/android-ndk/Dockerfile +++ b/docker/android-ndk/Dockerfile @@ -8,7 +8,6 @@ ENV DEBIAN_FRONTEND noninteractive # ------------------------------------------------------ # --- Install System Dependencies -RUN if test -f /etc/apt/sources.list.d/leap.list; then rm /etc/apt/sources.list.d/leap.list; fi # Need docker package in order to do Docker-in-Docker (DIND) RUN apt-get update -qq && \ apt-get -y dist-upgrade && \ @@ -22,7 +21,6 @@ RUN apt-get update -qq && \ apt-get autoclean && \ rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* - # ------------------------------------------------------ # --- Install Android NDK (for running C code) |