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
8 changes: 6 additions & 2 deletions xtasks/release-plz
Original file line number Diff line number Diff line change
Expand Up @@ -243,9 +243,13 @@ fi
mise run fetch-gpg-keys
mise run render ::: lint-fix

# Capture current aqua-registry package list before updating
# Capture current aqua-registry package list before updating (from the last tag)
OLD_AQUA_PKGS=""
if [[ -d crates/aqua-registry/aqua-registry/pkgs ]]; then
LATEST_TAG=$(git tag --list "v[0-9]*" --sort=-v:refname | head -1)

if [[ -n $LATEST_TAG ]]; then
OLD_AQUA_PKGS="$(git ls-tree -r --name-only "$LATEST_TAG" crates/aqua-registry/aqua-registry/pkgs | grep "/registry.yaml$" | sed 's|crates/aqua-registry/aqua-registry/pkgs/||;s|/registry.yaml||' | sort)"

Copilot AI Jan 8, 2026

Copy link

Choose a reason for hiding this comment

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

The grep command in the pipeline could fail if no registry.yaml files exist in the tag, causing the script to exit due to pipefail. Consider adding || true at the end of this command substitution, or use grep ... || true to handle the case where no files match the pattern.

Suggested change
OLD_AQUA_PKGS="$(git ls-tree -r --name-only "$LATEST_TAG" crates/aqua-registry/aqua-registry/pkgs | grep "/registry.yaml$" | sed 's|crates/aqua-registry/aqua-registry/pkgs/||;s|/registry.yaml||' | sort)"
OLD_AQUA_PKGS="$(git ls-tree -r --name-only "$LATEST_TAG" crates/aqua-registry/aqua-registry/pkgs | grep "/registry.yaml$" | sed 's|crates/aqua-registry/aqua-registry/pkgs/||;s|/registry.yaml||' | sort || true)"

Copilot uses AI. Check for mistakes.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Script crashes when grep finds no matches

High Severity

The script uses set -euxo pipefail which causes it to exit if any pipeline command fails. When git ls-tree returns empty output (because crates/aqua-registry/aqua-registry/pkgs doesn't exist at the latest tag), grep "/registry.yaml$" receives no input and returns exit code 1. This causes the entire release script to crash. The previous code was safer because find returns exit code 0 even with no matches, and it only ran when the directory existed. Adding || true after grep would prevent this failure.

Fix in Cursor Fix in Web

elif [[ -d crates/aqua-registry/aqua-registry/pkgs ]]; then
OLD_AQUA_PKGS="$(find crates/aqua-registry/aqua-registry/pkgs -name registry.yaml -type f | sed 's|crates/aqua-registry/aqua-registry/pkgs/||;s|/registry.yaml||' | sort)"
fi

Expand Down
Loading