1
0
mirror of https://github.com/tektoncd/catalog.git synced 2024-11-21 05:55:35 +00:00

Fix Kamel-run failing with multiple parameters

In case of multiple arguments the command kamel-run interpreted them as a single parameter.
This commit is contained in:
Gaelle Fournier 2023-09-25 10:38:30 +02:00 committed by tekton-robot
parent 1dfd21c4b8
commit 61f4ff3696

View File

@ -45,11 +45,13 @@ spec:
script: |
#!/usr/bin/env bash
KAMEL_RUN_ARGS="$(params.filename)"
[[ ! "$(params.namespace)" == "" ]] && KAMEL_RUN_ARGS="$KAMEL_RUN_ARGS -n $(params.namespace)"
[[ ! "$(params.container-image)" == "" ]] && KAMEL_RUN_ARGS="$KAMEL_RUN_ARGS -t container.image=$(params.container-image)"
[[ "$(params.wait)" == "true" ]] && KAMEL_RUN_ARGS="$KAMEL_RUN_ARGS --wait"
kamel_output=$(kamel run "$KAMEL_RUN_ARGS")
KAMEL_RUN_ARGS=()
KAMEL_RUN_ARGS+=("$(params.filename)")
[[ ! "$(params.namespace)" == "" ]] && KAMEL_RUN_ARGS+=(-n "$(params.namespace)")
[[ ! "$(params.container-image)" == "" ]] && KAMEL_RUN_ARGS+=(-t "container.image=$(params.container-image)")
[[ "$(params.wait)" == "true" ]] && KAMEL_RUN_ARGS+=(--wait)
kamel_output=$(kamel run "${KAMEL_RUN_ARGS[@]}")
echo "$kamel_output"
# Let's use the output produced to scrape the integration name and phase
echo "$kamel_output" | grep -oP 'Integration ".*?" (updated|created|unchanged)' | awk -F ' ' '{print $2}' | sed "s/\"//g" | tr -d '\n' | tee "$(results.integration-name.path)"