Skip to content
This repository has been archived by the owner on Aug 16, 2024. It is now read-only.

Commit

Permalink
Added dockerfile with precashed mvn articats for usage in tests. (#111)
Browse files Browse the repository at this point in the history
Added dockerfile with precashed mvn articats for usage in tests.

Signed-off-by: Radim Hopp <rhopp@redhat.com>
  • Loading branch information
rhopp authored and monaka committed Nov 25, 2019
1 parent ff81dbe commit a61946e
Show file tree
Hide file tree
Showing 5 changed files with 61 additions and 0 deletions.
15 changes: 15 additions & 0 deletions arbitrary-users-patch/happy-path/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
ARG TAG
FROM quay.io/eclipse/che-java11-maven:${TAG}

USER root

RUN cd / && \
git clone /~https://github.com/spring-projects/spring-petclinic && \
cd /spring-petclinic && \
mvn clean package && \
mkdir -p /home/user/.m2/repository && \
cp -r /root/.m2/repository/* /home/user/.m2/repository && \
rm -rf spring-petclinic/ /root/.m2/repository/* && \
chmod -R g=u /home/user

USER 10001
35 changes: 35 additions & 0 deletions arbitrary-users-patch/happy-path/build_happy_path_image.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/bin/bash
#
# Copyright (c) 2012-2019 Red Hat, Inc.
# This program and the accompanying materials are made
# available under the terms of the Eclipse Public License 2.0
# which is available at https://www.eclipse.org/legal/epl-2.0/
#
# SPDX-License-Identifier: EPL-2.0
#

set -e

SCRIPT_DIR=$(cd "$(dirname "$0")"; pwd)

DEFAULT_REGISTRY="quay.io"
DEFAULT_ORGANIZATION="eclipse"
DEFAULT_TAG="nightly"

REGISTRY=${REGISTRY:-${DEFAULT_REGISTRY}}
ORGANIZATION=${ORGANIZATION:-${DEFAULT_ORGANIZATION}}
TAG=${TAG:-${DEFAULT_TAG}}

NAME_FORMAT="${REGISTRY}/${ORGANIZATION}"

PUSH_IMAGES=false
if [ "$1" == "--push" ]; then
PUSH_IMAGES=true
fi

# Build image for happy-path tests with precashed mvn dependencies
docker build -t "${NAME_FORMAT}/happy-path:${TAG}" --no-cache --build-arg TAG=${TAG} "${SCRIPT_DIR}"/
if ${PUSH_IMAGES}; then
echo "Pushing ${NAME_FORMAT}/happy-path:${TAG}" to remote registry
docker push "${NAME_FORMAT}/happy-path:${TAG}"
fi
1 change: 1 addition & 0 deletions cico_build_nightly.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,5 @@ set_nightly_tag
setup_environment

build_patched_base_images
build_happy_path_image
build_and_push
1 change: 1 addition & 0 deletions cico_build_release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,5 @@ set_release_tag
setup_environment

build_patched_base_images
build_happy_path_image
build_and_push_release
9 changes: 9 additions & 0 deletions cico_functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -133,3 +133,12 @@ function build_patched_base_images() {
echo "CICO: pushed '${TAG}' version of the arbitrary-user patched base images"
fi
}

function build_happy_path_image() {
if [ "$TARGET" == "centos" ]; then
local TAG=${TAG:-${GIT_COMMIT_TAG}}
echo "CICO: building image for happy path testing with tag '${TAG}'"
"${SCRIPT_DIR}"/arbitrary-users-patch/happy-path/build_happy_path_image.sh --push
echo "CICO: pushed '${TAG}' version of the happy path image"
fi
}

0 comments on commit a61946e

Please sign in to comment.