Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions graduated/codefresh-run/step.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ kind: step-type
metadata:
name: codefresh-run
title: Run a Codefresh pipeline
version: 1.6.2
version: 1.6.3
isPublic: true
description: Run a Codefresh pipeline by ID or name and attach the created build logs.
sources:
Expand Down Expand Up @@ -288,15 +288,16 @@ spec:
[[- else ]]
[[/* Terminate the child build only when the timeout is reached, not on other errors (e.g. API errors). */]]
[[/* The timeout is detected by exit code 124 (CLI >= 1.3.0) or by the error message (older CLI versions exit with 1). */]]
[[/* Commands run with "set -e", so every failure that must not abort the script is caught with "||". */]]
- >-
{ codefresh wait --verbose $BUILD_ID --timeout [[(printf "%s" .Arguments.TIMEOUT_MINS)]] 2>&1;
echo $? > /tmp/codefresh-wait.rc; } | tee /tmp/codefresh-wait.log;
WAIT_RC=$(cat /tmp/codefresh-wait.rc 2>/dev/null);
{ WAIT_RC=0;
codefresh wait --verbose $BUILD_ID --timeout [[(printf "%s" .Arguments.TIMEOUT_MINS)]] 2>&1 || WAIT_RC=$?;
echo $WAIT_RC > /tmp/codefresh-wait.rc; } | tee /tmp/codefresh-wait.log;
WAIT_RC=$(cat /tmp/codefresh-wait.rc 2>/dev/null || echo 1);
if [ "$WAIT_RC" != "0" ]; then
WAIT_RC=${WAIT_RC:-1};
if [ "$WAIT_RC" -eq 124 ] || grep -q "Operation has timed out" /tmp/codefresh-wait.log; then
echo "TERMINATE_ON_TIMEOUT was set to true, sending termination request";
codefresh terminate $BUILD_ID;
codefresh terminate $BUILD_ID || echo "Failed to terminate build $BUILD_ID";
fi;
exit $WAIT_RC;
fi
Expand Down
Loading