Skip to content

Commit 81540ab

Browse files
Copilotdata-douser
andauthored
fix: always upgrade lock files and show output on failure in upgrade-packs.sh
- Move `codeql pack upgrade` before the wildcard check so wildcard packs (e.g., javascript/examples/src) still get their lock files refreshed; only skip the pinning step for wildcard deps - Capture `codeql pack upgrade` output and print it to stderr on failure instead of silencing all output with >/dev/null 2>&1 - Update inline comment to reflect the new behaviour Agent-Logs-Url: https://github.com/advanced-security/codeql-development-mcp-server/sessions/7483057a-9273-4f33-aa96-a2f662c84d44 Co-authored-by: data-douser <70299490+data-douser@users.noreply.github.com>
1 parent 480906d commit 81540ab

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

server/scripts/upgrade-packs.sh

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,8 @@ cd "${REPO_ROOT}"
8383
## Strategy: run `codeql pack upgrade` first to resolve the latest compatible
8484
## version into the lock file, then read the resolved version back and update
8585
## the codeql-pack.yml to pin that exact version. Packs with wildcard
86-
## dependencies (e.g., '*') are skipped — those intentionally float.
86+
## dependencies (e.g., '*') still get their lock files upgraded, but the
87+
## pinning step is skipped — those versions intentionally float.
8788
pin_upstream_dep() {
8889
local pack_dir="$1"
8990
local pack_yml="${pack_dir}/codeql-pack.yml"
@@ -105,15 +106,22 @@ pin_upstream_dep() {
105106
dep_name=$(echo "${dep_line}" | sed 's/^[[:space:]]*//' | cut -d: -f1)
106107
dep_old_version=$(echo "${dep_line}" | sed 's/^[^:]*:[[:space:]]*//')
107108

108-
## Skip wildcard dependencies — these intentionally float
109+
## Always run codeql pack upgrade so the lock file stays in sync with
110+
## the CLI, even for packs with wildcard dependencies that intentionally
111+
## float. Only the pinning step is skipped for wildcard deps.
112+
local upgrade_output
113+
if ! upgrade_output=$(codeql pack upgrade -- "${pack_dir}" 2>&1); then
114+
echo " ❌ codeql pack upgrade failed for ${pack_dir}:" >&2
115+
echo "${upgrade_output}" >&2
116+
return 1
117+
fi
118+
119+
## Skip pinning for wildcard dependencies — these intentionally float
109120
if [[ "${dep_old_version}" == *"*"* ]]; then
110-
echo " ℹ️ ${dep_name}: ${dep_old_version} (wildcard — skipping)"
121+
echo " ℹ️ ${dep_name}: ${dep_old_version} (wildcard — lock file upgraded, pinning skipped)"
111122
return
112123
fi
113124

114-
## Run codeql pack upgrade to resolve the latest compatible version
115-
codeql pack upgrade -- "${pack_dir}" >/dev/null 2>&1
116-
117125
if [[ ! -f "${lock_file}" ]]; then
118126
echo " ⚠️ No lock file after upgrade for ${pack_dir}" >&2
119127
return

0 commit comments

Comments
 (0)