From 2138c52c9c1c155a718191ee123a3a71abafdd44 Mon Sep 17 00:00:00 2001 From: Patrik Lundin Date: Wed, 5 Feb 2025 20:29:37 +0100 Subject: [PATCH] Bundling --context with arg in "" does not work Try converting to bash to get access to arrays instead. --- entrypoint.sh | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/entrypoint.sh b/entrypoint.sh index 7720844..da48f30 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/usr/bin/env bash # Setup auth echo '{"auths":{"'"$(printf "%s" "$INPUT_REGISTRY")"'":{"auth":"'"$(printf "%s" "$INPUT_CREDENTIAL" | base64 | tr -d '\n')"'"}}}' > /kaniko/.docker/config.json @@ -8,10 +8,11 @@ if [ -n "$INPUT_WORKDIR" ]; then printf 'cd %s -> %s\n' "$OLDPWD" "$PWD" fi -context_flag="" +options=() if [ -n "$INPUT_CONTEXT" ]; then - context_flag="--context $INPUT_CONTEXT" + options+=('--context') + options+=("$INPUT_CONTEXT") fi # Build container -/kaniko/executor --dockerfile "$INPUT_DOCKERFILE" --destination "$INPUT_REGISTRY/$INPUT_IMAGE" "$context_flag" +/kaniko/executor --dockerfile "$INPUT_DOCKERFILE" --destination "$INPUT_REGISTRY/$INPUT_IMAGE" "${options[@]}"