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
42 changes: 36 additions & 6 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -528,28 +528,43 @@ jobs:
BEFORE_ID=$(gh run list \
--repo docker/inference-engine-llama.cpp \
--workflow release-cli-dd.yml \
--limit 1 --json databaseId --jq '.[0].databaseId // 0')
--limit 1 --json databaseId --jq '.[0].databaseId // 0' 2>/dev/null || echo "")
Comment on lines 528 to +531

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion (bug_risk): Using || echo "" inside command substitution can silently swallow useful error output from gh run list.

Because BEFORE_ID=$(gh run list ... 2>/dev/null || echo "") treats any non‑zero exit from gh as an empty string, you lose potentially useful error diagnostics from gh. Since you already validate $BEFORE_ID via the numeric case, you can drop 2>/dev/null and || echo "" so that gh’s stderr reaches the workflow logs and the case handles invalid or missing IDs.

Suggested change
BEFORE_ID=$(gh run list \
--repo docker/inference-engine-llama.cpp \
--workflow release-cli-dd.yml \
--limit 1 --json databaseId --jq '.[0].databaseId // 0')
--limit 1 --json databaseId --jq '.[0].databaseId // 0' 2>/dev/null || echo "")
BEFORE_ID=$(gh run list \
--repo docker/inference-engine-llama.cpp \
--workflow release-cli-dd.yml \
--limit 1 --json databaseId --jq '.[0].databaseId // 0')

case "$BEFORE_ID" in
''|*[!0-9]*)
echo "::error::Could not read the pre-dispatch run ID for release-cli-dd.yml"
exit 1
;;
esac

gh workflow run release-cli-dd.yml \
--repo docker/inference-engine-llama.cpp \
-f model-cli-ref="$RELEASE_TAG" \
-f tag="v$VERSION"

# Poll for the run WE just triggered: the first run whose ID exceeds
# BEFORE_ID. Tolerate transient `gh` failures mid-poll (empty or
# non-numeric CANDIDATE) by skipping the iteration — a flaky query
# must not abort the release on `integer expression expected`.
RUN_ID=""
LAST_SEEN=""
for _ in $(seq 1 30); do
sleep 3
CANDIDATE=$(gh run list \
--repo docker/inference-engine-llama.cpp \
--workflow release-cli-dd.yml \
--limit 1 --json databaseId --jq '.[0].databaseId // 0')
--limit 1 --json databaseId --jq '.[0].databaseId // 0' 2>/dev/null || echo "")
case "$CANDIDATE" in
''|*[!0-9]*) continue ;;
esac
LAST_SEEN="$CANDIDATE"
if [ "$CANDIDATE" -gt "$BEFORE_ID" ]; then
RUN_ID="$CANDIDATE"
break
fi
done

if [ -z "$RUN_ID" ]; then
echo "::error::Failed to determine Desktop CLI release run ID"
echo "::error::Failed to determine Desktop CLI release run ID after ~90s (before=$BEFORE_ID, last seen=${LAST_SEEN:-none})"
exit 1
fi

Expand Down Expand Up @@ -596,27 +611,42 @@ jobs:
BEFORE_ID=$(gh run list \
--repo docker/packaging \
--workflow release-model.yml \
--limit 1 --json databaseId --jq '.[0].databaseId // 0')
--limit 1 --json databaseId --jq '.[0].databaseId // 0' 2>/dev/null || echo "")
case "$BEFORE_ID" in
''|*[!0-9]*)
echo "::error::Could not read the pre-dispatch run ID for release-model.yml"
exit 1
;;
esac

gh workflow run release-model.yml \
--repo docker/packaging \
-f ref="$RELEASE_TAG"

# Poll for the run WE just triggered: the first run whose ID exceeds
# BEFORE_ID. Tolerate transient `gh` failures mid-poll (empty or
# non-numeric CANDIDATE) by skipping the iteration — a flaky query
# must not abort the release on `integer expression expected`.
RUN_ID=""
LAST_SEEN=""
for _ in $(seq 1 30); do
sleep 3
CANDIDATE=$(gh run list \
--repo docker/packaging \
--workflow release-model.yml \
--limit 1 --json databaseId --jq '.[0].databaseId // 0')
--limit 1 --json databaseId --jq '.[0].databaseId // 0' 2>/dev/null || echo "")
case "$CANDIDATE" in
''|*[!0-9]*) continue ;;
esac
LAST_SEEN="$CANDIDATE"
if [ "$CANDIDATE" -gt "$BEFORE_ID" ]; then
RUN_ID="$CANDIDATE"
break
fi
done

if [ -z "$RUN_ID" ]; then
echo "::error::Failed to determine packaging workflow run ID"
echo "::error::Failed to determine packaging workflow run ID after ~90s (before=$BEFORE_ID, last seen=${LAST_SEEN:-none})"
exit 1
fi

Expand Down
Loading