From cd8a41e200243150a9b7b3c3fe0a527075e5caab Mon Sep 17 00:00:00 2001 From: Andrea Frittoli Date: Thu, 12 Sep 2024 10:47:24 +0100 Subject: [PATCH] Adapt koparse step to handle no import path The case of no import path included in image paths breaks koparse. Adapting the step to handle this case too. Signed-off-by: Andrea Frittoli --- tekton/publish.yaml | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/tekton/publish.yaml b/tekton/publish.yaml index a790a813237..e36110f003f 100644 --- a/tekton/publish.yaml +++ b/tekton/publish.yaml @@ -192,7 +192,22 @@ spec: script: | set -ex - IMAGES_PATH=${CONTAINER_REGISTRY}/$(params.package) + IMAGES_PATH=${CONTAINER_REGISTRY} + + # Find "--preserve-import-paths" in a list of args + function find_preserve_import_path() { + for arg in $@; do + if [[ "$arg" == "--preserve-import-paths" ]]; then + return 0 + fi + done + return 1 + } + + # If "--preserve-import-paths" is used, include "package" in the expected path + find_preserve_import_path \ + $(echo $KO_EXTRA_ARGS) && \ + IMAGES_PATH=${IMAGES_PATH}/$(params.package) || true for cmd in $(params.images) do