From 774078b184a89cea91afc9fc91c47f8d38708582 Mon Sep 17 00:00:00 2001 From: Michiel Meeuwissen Date: Sun, 17 Nov 2024 20:21:37 +0100 Subject: [PATCH] Made it less warry. --- README.adoc | 15 ++++++++------- scripts/kaniko-functions.sh | 5 ++--- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/README.adoc b/README.adoc index 78881e3..73a75c4 100644 --- a/README.adoc +++ b/README.adoc @@ -1,16 +1,17 @@ = npo-poms/kaniko -`gcr.io/kaniko-project/executor:debug` with some extra scripts that are use in our pipeline. It's better to have the scripts in an image, which is used in a pipeline than having the scripts themselves encapsulated in a yaml. +`gcr.io/kaniko-project/executor:debug` with some extra scripts that are use in our pipelines. It's better to have the scripts in an image, which is used in a pipeline than having the scripts themselves encapsulated in a yaml. == features -The scripts are mainly targeted at maven projects +The entrypoint of the image is `/script.sh`. This will look for +- a Dockerfile in the current directory +- or if not present in Dockerfiles in subdirectories (non-recursively). +- every Dockerfile is build and pushed to the registry (default registry.npohosting.nl) + The name of the artifact can be influenced by environment variables, but on default + it is based on the ARG NAME in the Dockerfile itself. -- that produce wars -- multimodule, a project running this in can even product multiple wars. -- a module producing a war, must contain a Dockerfile with a ARG NAME= - which will be used to generate the image name -- the resulting images are default pushed to registry.npohosting.nl +We mainly use this in maven-projects. Which might have 1 or more submodules that produce wars that are encapsulated in a docker-image with tomcat. diff --git a/scripts/kaniko-functions.sh b/scripts/kaniko-functions.sh index 1b98b87..6828062 100644 --- a/scripts/kaniko-functions.sh +++ b/scripts/kaniko-functions.sh @@ -29,12 +29,11 @@ package_all_docker() { echo "Packaging the root directory only" package_docker . else - echo "No Dockerfile and no OS_APPLICATIONS variable found" - OS_APPLICATIONS=$(find . -maxdepth 3 -mindepth 3 -name "*${PROJECT_VERSION}.war" -exec sh -c 'f=$(dirname $1); (cd $f/..; basename $PWD) ;' shell {} \; | tr '\n' ',' | sed 's/,$//') + OS_APPLICATIONS=$(find . -maxdepth 2 -mindepth 2 -name "Dockerfile" -exec sh -c 'f=$(dirname $1); basename $f;' shell {} \; | tr '\n' ',' | sed 's/,$//') if [ ! -z "$OS_APPLICATIONS" ] ; then echo "Guessed OS_APPLICATIONS=$OS_APPLICATIONS" - package_wars + package_all_docker else echo "Could not guess either for ${PROJECT_VERSION}" fi