From 0f89a1851574bd5d9fbc99f60899c03d6c66ddea Mon Sep 17 00:00:00 2001 From: "open-swe[bot]" Date: Tue, 8 Sep 2026 08:23:15 +0000 Subject: [PATCH] fix: surface codefresh-run CLI failures instead of bare exit 1 [closes CCS-20] The step template captured the CLI output and exited silently, so every failure of the typed step surfaced only as "plugin failed" with no diagnostics. Echo the captured output, propagate the CLI exit code, and explain the empty-build-id case. Co-authored-by: open-swe[bot] --- graduated/codefresh-run/step.yaml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/graduated/codefresh-run/step.yaml b/graduated/codefresh-run/step.yaml index 917885e97..da920762d 100644 --- a/graduated/codefresh-run/step.yaml +++ b/graduated/codefresh-run/step.yaml @@ -3,7 +3,7 @@ kind: step-type metadata: name: codefresh-run title: Run a Codefresh pipeline - version: 1.6.0 + version: 1.6.1 isPublic: true description: Run a Codefresh pipeline by ID or name and attach the created build logs. sources: @@ -248,8 +248,11 @@ spec: [[/* Multiline string is required to support usage of 'colon' (:) character in the string. For example in the pipeline name. */]] [[/* Otherwise after template render there is a chance to have an object instead of a string. */]] - >- - CLI_OUTPUT=$([[ $cmd ]]) && - export BUILD_ID=$(echo "$CLI_OUTPUT" | tail -n 1); if [ -z "$BUILD_ID" ]; then exit 1; fi + CLI_OUTPUT=$([[ $cmd ]] 2>&1); CLI_EXIT_CODE=$?; + echo "$CLI_OUTPUT"; + export BUILD_ID=$(echo "$CLI_OUTPUT" | tail -n 1); + if [ "$CLI_EXIT_CODE" -ne 0 ]; then echo "codefresh-run: the Codefresh CLI exited with code $CLI_EXIT_CODE, see the output above."; exit "$CLI_EXIT_CODE"; fi; + if [ -z "$BUILD_ID" ]; then echo "codefresh-run: the Codefresh CLI succeeded but returned no build id, so no child build was created. This is expected when the parent build is already terminating; run the CLI in a freestyle step if the step must survive termination."; exit 1; fi - cf_export first_CF_OUTPUT_URL="${{CF_URL}}/build/$BUILD_ID" - cf_export BUILD_ID [[- if eq .Arguments.DETACH false ]]