Skip to content

Commit aa4b995

Browse files
felickzCopilot
andauthored
fix(workflows): add packages: read permission to update-codeql-version.yml (#163)
* fix(workflows): add packages: read permission to update-codeql-version.yml Fixes a live failure hit during the first real end-to-end test of this workflow (dispatched with codeql_version: 2.21.4): the 'Upgrade every pack's dependencies' step failed resolving codeql/namebinding ('not found in the registry') while running codeql pack upgrade on ruby/src. The job's default GITHUB_TOKEN lacked packages: read, matching what ci.yml already grants for the same kind of pack resolution. Tracked in issue #162. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> * debug: temporary step to inspect codeql resolve qlpacks output * debug: test gh-codeql bundle install + qlpacks disk layout * debug: point directly at gh-codeql bundle unpack dir * debug: search go dir + resolve qlpacks with bundle codeql binary * debug: try codeql-action codeql-bundle release asset * debug: list all qlpacks dir entries via tar tzf without extraction * fix(workflows): pin codeql/* library deps to the CLI-bundle version before upgrade codeql pack upgrade resolves unconstrained '*' dependencies to the latest-ever-published registry version, completely independent of the CLI version pinned in .codeqlversion. This caused e.g. codeql/go-all to jump to 7.2.0 (registry-latest) instead of 4.2.6 (the version actually shipped with/tested against CLI 2.21.4), and caused 'codeql/namebinding not found in the registry' fatal errors for other languages since registry-latest go-all depends on packages not present at the versions being resolved. Add .github/scripts/pin-codeql-library-versions.sh, which downloads the official CodeQL Bundle (github/codeql-action release codeql-bundle-v<version>) for the target CLI version and rewrites every codeql/<lang>-all / codeql/<lang>-queries dependency across all qlpack.yml files from '*' to that exact bundled version, before codeql pack upgrade runs. Internal githubsecuritylab/* cross-pack dependencies are left untouched (they intentionally track our own latest published versions). * chore: mark pin-codeql-library-versions.sh executable * fix(workflows): exclude ql/hotspots from the pack-upgrade loop ql/hotspots is a standalone local dev tool (see ql/hotspots/README.md and hotspots.yml), not one of the per-language src/lib/ext packs that ci.yml/publish.yml operate on. Its codeql/ql: '*' dependency isn't a real resolvable GHCR package, so it always fails codeql pack upgrade regardless of CLI version - a pre-existing, unrelated latent bug this workflow's blanket 'find . -name qlpack.yml' loop was hitting for the first time now that the codeql/*-all resolution bug is fixed and the loop can actually reach this directory. * fix(workflows): gitignore the downloaded codeql_home CLI install dir The install-codeql composite action downloads/extracts the CodeQL CLI into github.workspace/codeql_home, i.e. inside the repository checkout, but this directory was never gitignored. update-codeql-version.yml is the first workflow to both install CodeQL AND commit/push changes (via peter-evans/create-pull-request), and its push was rejected by GitHub's 100MB file size limit because codeql_home/codeql-linux64.zip (~474MB) and several 50+MB extractor binaries got staged as untracked files alongside the real qlpack.yml/lock-file changes. * docs(contributing): document exact-pinning of codeql/* dependencies Explains why codeql/<lang>-all / codeql/<lang>-queries dependencies in qlpack.yml are now pinned to an exact version (matching the official CodeQL Bundle for the target CLI release) instead of left as an unconstrained '*' range: codeql pack upgrade resolves '*' to the latest-ever-published registry version, independent of .codeqlversion, which previously let a routine CLI bump silently jump a library several major versions ahead of anything that CLI actually ships/tests against. Also documents: - How the pin values are derived (github/codeql-action bundle release listing via tar tzf, not gh-codeql or a web scrape) and why those two alternatives were rejected. - The new pin-codeql-library-versions.sh step in the update-codeql-version.yml process (as step 2.1, before codeql pack upgrade). - Why ql/hotspots is excluded from the pack-upgrade loop (standalone dev tool, not a real per-language pack, codeql/ql is not a real registry/bundle package). - That this is a go-forward convention: existing qlpack.yml files stay unpinned until their next CLI-bump run, not retroactively true today. * fix(workflows): exclude codeql_home from qlpack.yml discovery loops Copilot review caught this on PR #163: .github/actions/install-codeql downloads/extracts the CodeQL CLI into ./codeql_home (inside the repo checkout), and the bare CLI ships its own small vendored qlpack.yml packs (codeql/<lang>/downgrades, codeql/legacy-upgrades) that have nothing to do with this repo's packs. Confirmed via the live test run (29110858206) log: both the pin script and the upgrade loop's `find . -name qlpack.yml` picked up and ran `codeql pack upgrade` against 10 of these vendored packs under ./codeql_home/codeql/*/downgrades and ./codeql_home/codeql/legacy-upgrades, in addition to this repo's real 47 pack directories. It happened to succeed silently this time and was invisible in the resulting PR diff only because codeql_home is now gitignored (fixed in ee26fcc) - but it was still real wasted work, and a future CLI version's vendored pack could just as easily hit the same "not found in the registry" failure mode as ql/hotspots did, for the same underlying reason (a `codeql/*: */ dependency that isn't a real resolvable package). * fix(pin-script): make library-version pinning idempotent across CLI bumps The pin script previously only matched dependency lines with a literal '*' value. Once a qlpack.yml dependency got pinned to an exact version by one run, that regex would never match again on subsequent runs - meaning every CLI bump after the first would silently fail to re-pin codeql/* dependencies to the new bundle version, permanently desyncing .codeqlversion from the actual pins. Rewrite the match/rewrite logic to match ANY current value for a recognized codeql/<pkg> dependency (unquoted/quoted '*', or an already- pinned exact version) and unconditionally overwrite it to the target bundle version, preserving quote style and trailing comments. Verified locally against a mock qlpack.yml simulating a post-first-run state: an existing pinned version and a double-quoted pinned version were both correctly overwritten to new target versions, while unrelated/unknown dependencies were left untouched. Also add the ./codeql/* and */.codeql/* path exclusions to update-codeql-version.yml's upgrade loop for parity with the pin script's existing exclusions (defense in depth, per review feedback). Update CONTRIBUTING.md's two spots describing the pinning step to reflect this unconditional-overwrite/idempotent behavior instead of "only rewrites literal *". Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
1 parent dd2357d commit aa4b995

4 files changed

Lines changed: 225 additions & 15 deletions

File tree

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
#!/usr/bin/env bash
2+
# Pins every `codeql/<name>` dependency in this repo's qlpack.yml files to the
3+
# exact library version shipped in the official CodeQL Bundle for a given CLI
4+
# release - overwriting whatever value is currently there (an unconstrained
5+
# `'*'`, or an exact version pinned by a previous run of this script against
6+
# an older CLI).
7+
#
8+
# Why this exists: `codeql pack upgrade` resolves an unconstrained `'*'`
9+
# dependency to the *latest-ever-published* version in the configured
10+
# registry (GHCR) - completely independent of whatever CodeQL CLI version is
11+
# pinned in `.codeqlversion`. That mismatch can jump `codeql/<lang>-all`
12+
# several major versions ahead of what the pinned CLI actually ships/tests
13+
# against, which can silently break analyses (see CONTRIBUTING.md's
14+
# "Updating the pinned CodeQL CLI/library version" section for a worked
15+
# example). Pinning these `codeql/*` deps to the exact bundle-paired version
16+
# before running `codeql pack upgrade` makes that resolution deterministic
17+
# and keeps every pack's declared library dependency in lockstep with the
18+
# CLI version this repo says it supports.
19+
#
20+
# This script is idempotent and must be re-run (with a new target version)
21+
# on every subsequent CLI bump: once a dependency is pinned to an exact
22+
# version, it no longer matches an "unconstrained" pattern, so this script
23+
# unconditionally overwrites any `codeql/<pkg>: <value>` line for every
24+
# package it finds in the target bundle, regardless of what value (if any)
25+
# is already there - otherwise the pin would only ever get set once, and
26+
# every later `.codeqlversion` bump would silently keep resolving against
27+
# the stale version from the first run.
28+
#
29+
# Usage: pin-codeql-library-versions.sh <cli-version>
30+
# e.g. pin-codeql-library-versions.sh 2.21.4
31+
#
32+
# Requires: gh (authenticated), tar, sed, find. Run from the repo root.
33+
set -euo pipefail
34+
35+
if [[ $# -ne 1 ]]; then
36+
echo "Usage: $0 <cli-version>" >&2
37+
exit 1
38+
fi
39+
40+
VERSION="$1"
41+
BUNDLE_TAG="codeql-bundle-v${VERSION}"
42+
WORKDIR="$(mktemp -d)"
43+
trap 'rm -rf "$WORKDIR"' EXIT
44+
45+
echo "Determining codeql/* library versions bundled with CodeQL CLI ${VERSION}..."
46+
echo "(source of truth: github/codeql-action release '${BUNDLE_TAG}', asset codeql-bundle-linux64.tar.gz)"
47+
48+
if ! gh release download "$BUNDLE_TAG" --repo github/codeql-action \
49+
--pattern "codeql-bundle-linux64.tar.gz" --dir "$WORKDIR" --clobber; then
50+
echo "::error::Could not download the CodeQL Bundle for tag '${BUNDLE_TAG}' from github/codeql-action releases." >&2
51+
echo "Every CLI release published to github/codeql-cli-binaries should have a matching 'codeql-bundle-v<version>' release in github/codeql-action - check that the tag exists." >&2
52+
exit 1
53+
fi
54+
55+
# List every bundled `codeql/<name>` qlpack and its exact version WITHOUT
56+
# extracting any file contents - the bundle is large (~500MB) and we only
57+
# need the directory listing (name + version are encoded in the path).
58+
VERSIONS_FILE="$WORKDIR/versions.txt"
59+
tar tzf "$WORKDIR/codeql-bundle-linux64.tar.gz" \
60+
| grep -E '^codeql/qlpacks/codeql/[^/]+/[^/]+/$' \
61+
| sed -E 's#^codeql/qlpacks/codeql/([^/]+)/([^/]+)/$#\1 \2#' \
62+
| sort -u > "$VERSIONS_FILE"
63+
64+
echo "Discovered $(wc -l < "$VERSIONS_FILE") bundled codeql/* packages for CLI ${VERSION}."
65+
66+
# Every real qlpack.yml in the repo, excluding gitignored local build
67+
# artifacts (.codeql/ pack caches, the /codeql cloned-repo checkout dir, and
68+
# /codeql_home, where .github/actions/install-codeql downloads/extracts the
69+
# CodeQL CLI - which ships its own small vendored qlpack.yml packs, e.g.
70+
# codeql/<lang>/downgrades, that have nothing to do with this repo).
71+
mapfile -t QLPACK_FILES < <(find . -name qlpack.yml -not -path "*/.codeql/*" -not -path "./codeql/*" -not -path "./codeql_home/*")
72+
73+
declare -A PINNED_COUNT=()
74+
while read -r pkg ver; do
75+
[[ -z "$pkg" ]] && continue
76+
count=0
77+
for file in "${QLPACK_FILES[@]}"; do
78+
# Match a `codeql/<pkg>: <value>` dependency line regardless of its
79+
# current value - unquoted or quoted `*`, or an already-pinned exact
80+
# version from a previous run - and overwrite it to the target bundle
81+
# version, preserving quote style and any trailing comment.
82+
if grep -qE "^[[:space:]]*codeql/${pkg}:[[:space:]]*[\"']?[^\"'#[:space:]]+[\"']?[[:space:]]*(#.*)?\$" "$file"; then
83+
sed -i -E "s#^([[:space:]]*codeql/${pkg}:[[:space:]]*)([\"']?)[^\"'#[:space:]]+\\2#\\1\\2${ver}\\2#" "$file"
84+
count=$((count + 1))
85+
fi
86+
done
87+
if [[ $count -gt 0 ]]; then
88+
PINNED_COUNT["$pkg@$ver"]=$count
89+
fi
90+
done < "$VERSIONS_FILE"
91+
92+
echo
93+
echo "Pinned codeql/* dependencies:"
94+
for key in "${!PINNED_COUNT[@]}"; do
95+
echo " - ${key} (${PINNED_COUNT[$key]} file(s))"
96+
done | sort
97+
98+
# Surface any remaining unconstrained codeql/* dependency that this script
99+
# did NOT pin (e.g. it isn't one of the standard per-language bundle
100+
# packages, like ql/hotspots' `codeql/ql`) so it doesn't silently keep
101+
# resolving to registry-latest. Since every package the loop above finds in
102+
# the bundle gets its value unconditionally overwritten (see the loop
103+
# comment), anything still showing a literal `'*'` here was never found in
104+
# any bundle this script has been run against.
105+
echo
106+
echo "codeql/* dependencies left unpinned (not found in the CodeQL Bundle):"
107+
REMAINING=0
108+
for file in "${QLPACK_FILES[@]}"; do
109+
if grep -qE "^[[:space:]]*codeql/[A-Za-z0-9_.-]+:[[:space:]]*[\"']?\*[\"']?[[:space:]]*(#.*)?\$" "$file"; then
110+
grep -nE "^[[:space:]]*codeql/[A-Za-z0-9_.-]+:[[:space:]]*[\"']?\*[\"']?[[:space:]]*(#.*)?\$" "$file" | sed "s#^# ${file}:#"
111+
REMAINING=1
112+
fi
113+
done
114+
if [[ "$REMAINING" -eq 0 ]]; then
115+
echo " (none)"
116+
fi

‎.github/workflows/update-codeql-version.yml‎

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ jobs:
2323
runs-on: ubuntu-latest
2424
permissions:
2525
contents: read # PR creation uses a scoped GitHub App token (SECLABS_APP_ID/SECLABS_APP_KEY), not GITHUB_TOKEN
26+
packages: read # `codeql pack upgrade` resolves codeql/* library deps from GHCR (see ci.yml)
2627

2728
steps:
2829
- name: Checkout
@@ -48,12 +49,33 @@ jobs:
4849
- name: Setup CodeQL
4950
uses: ./.github/actions/install-codeql
5051

52+
- name: Pin codeql/* library dependencies to the CodeQL Bundle version
53+
env:
54+
GH_TOKEN: ${{ github.token }}
55+
run: |
56+
.github/scripts/pin-codeql-library-versions.sh "${{ steps.version.outputs.version }}"
57+
5158
- name: Upgrade every pack's dependencies
5259
env:
5360
GITHUB_TOKEN: ${{ github.token }}
5461
run: |
5562
set -euo pipefail
56-
for dir in $(find . -name qlpack.yml -exec dirname {} \;); do
63+
# Exclusions (kept in sync with the same exclusions in
64+
# .github/scripts/pin-codeql-library-versions.sh):
65+
# - ./ql/hotspots is a standalone local dev tool (see
66+
# ql/hotspots/README.md and .github/workflows/hotspots.yml), not
67+
# one of the per-language src/lib/ext/ext-library-sources packs
68+
# that ci.yml and publish.yml operate on. Its `codeql/ql: '*'`
69+
# dependency isn't a real resolvable GHCR package, so it always
70+
# fails `codeql pack upgrade`.
71+
# - ./codeql_home is where .github/actions/install-codeql
72+
# downloads/extracts the CodeQL CLI; it ships its own small
73+
# vendored qlpack.yml packs (e.g. codeql/<lang>/downgrades) that
74+
# have nothing to do with this repo and shouldn't be touched.
75+
# - ./codeql and */.codeql are a locally-cloned github/codeql
76+
# checkout (used by ql/hotspots) and CodeQL's own per-pack build
77+
# caches, respectively - neither is a repo pack either.
78+
for dir in $(find . -name qlpack.yml -not -path "./ql/hotspots/*" -not -path "./codeql_home/*" -not -path "./codeql/*" -not -path "*/.codeql/*" -exec dirname {} \;); do
5779
echo "::group::codeql pack upgrade $dir"
5880
codeql pack upgrade "$dir"
5981
echo "::endgroup::"
@@ -86,8 +108,13 @@ jobs:
86108
87109
This PR:
88110
- Updates `.codeqlversion` to `${{ steps.version.outputs.version }}`.
111+
- Pins every `codeql/<lang>-all` / `codeql/<lang>-queries` dependency across all
112+
`qlpack.yml` files to the exact version shipped in the official CodeQL Bundle
113+
for this CLI release (see `.github/scripts/pin-codeql-library-versions.sh`) -
114+
this keeps `codeql pack upgrade` from jumping those libraries to
115+
registry-latest instead of the version this CLI actually ships/tests against.
89116
- Runs `codeql pack upgrade <dir>` for every pack directory to refresh its
90-
`codeql-pack.lock.yml` against the new CLI.
117+
`codeql-pack.lock.yml` against the new CLI and pinned library versions.
91118
92119
**This PR does not publish anything by itself** - no pack `version:` field is
93120
bumped here, so `publish.yml`'s version-diff trigger won't fire for it yet.

‎.gitignore‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111
*/*.class
1212
# Cloned repository of codeql
1313
/codeql
14+
# Downloaded/extracted CodeQL CLI (see .github/actions/install-codeql), cached
15+
# by actions/cache between CI runs - never meant to be committed.
16+
/codeql_home
1417

1518
# Test files / folders
1619
test.ql

‎CONTRIBUTING.md‎

Lines changed: 77 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -66,18 +66,59 @@ Every query pack in this repository is compiled and tested against a specific ve
6666

6767
The pinning is codified per language across:
6868
- [`.codeqlversion`][codeqlversion] (repo root): the CodeQL **CLI** version CI installs and compiles/tests against.
69-
- `<language>/src/codeql-pack.lock.yml` **and** `<language>/lib/codeql-pack.lock.yml`: the exact resolved
70-
(locked) version of `codeql/<language>-all` (and, for `src`, `codeql/<language>-queries` where used),
71-
generated by `codeql pack install`/`codeql pack upgrade` against the CLI above. The `qlpack.yml` files
72-
themselves only declare an unpinned `'*'` range, so the lock files, not the `qlpack.yml`, are the real
73-
source of truth. **`src` and `lib` each have their own independently-resolved lock file** - nothing
74-
keeps them in sync automatically, so it's possible (if `codeql pack upgrade` is run against one
75-
directory but not the other) for them to drift apart. Always upgrade both when bumping
69+
- `<language>/{src,lib}/qlpack.yml`: **every `codeql/<language>-all` / `codeql/<language>-queries`
70+
dependency is pinned to an exact version** (e.g. `codeql/go-all: '4.2.6'`), not left as an
71+
unconstrained `'*'` range. This is deliberate, not incidental — see the warning box below for why.
72+
Internal `githubsecuritylab/*` cross-pack dependencies (e.g. `<language>/lib` depending on
73+
`<language>/ext`) are unaffected and still use whatever range/pin a maintainer set by hand.
74+
- `<language>/src/codeql-pack.lock.yml` **and** `<language>/lib/codeql-pack.lock.yml`: the exact
75+
resolved (locked) version tree generated by `codeql pack install`/`codeql pack upgrade` against the
76+
CLI and the pinned `qlpack.yml` dependency above. **`src` and `lib` each have their own
77+
independently-resolved lock file** - nothing keeps them in sync automatically, so it's possible (if
78+
`codeql pack upgrade` is run against one directory but not the other, or one `qlpack.yml` pin is
79+
hand-edited without the other) for them to drift apart. Always upgrade both when bumping
7680
`.codeqlversion` (the [automated workflow](#updating-the-pinned-codeql-clilibrary-version) does this
7781
for every pack directory in one pass); the table below only shows `src` for brevity, but the
7882
auto-generated table in every publish summary (see [Cutting a release](#cutting-a-release)) checks
7983
both and will flag drift between them.
8084

85+
> [!WARNING]
86+
> **Why `codeql/*` dependencies are pinned to an exact version instead of left as `'*'`:** they used
87+
> to be unconstrained (`codeql/go-all: '*'`, etc.). The problem: `codeql pack upgrade` resolves an
88+
> unconstrained `'*'` dependency to the **latest-ever-published** version in the configured registry
89+
> (GHCR) - completely independent of whatever CodeQL CLI version is pinned in `.codeqlversion`. In
90+
> practice this let a routine `.codeqlversion` bump silently jump `codeql/go-all` from the version
91+
> actually bundled/tested with the target CLI (e.g. `4.2.6`, bundled with CLI `v2.21.4`) to whatever
92+
> was newest in the registry at that moment (e.g. `7.2.0`) - a library several major versions ahead of
93+
> anything that CLI version ships or has ever been tested against, which can silently break analyses
94+
> or fail outright with errors like `'codeql/namebinding' not found in the registry`.
95+
>
96+
> The fix: [`.github/scripts/pin-codeql-library-versions.sh`][pin-codeql-library-versions-script] runs
97+
> before `codeql pack upgrade` (as part of
98+
> [`update-codeql-version.yml`](#updating-the-pinned-codeql-clilibrary-version)) and unconditionally
99+
> overwrites every `codeql/<pkg>` dependency it recognizes - whether currently `'*'` or an exact
100+
> version pinned by a previous run against an older CLI - to the *exact* version shipped in the
101+
> **official CodeQL Bundle** for the target CLI release - i.e. the same library versions GitHub
102+
> itself builds, tests, and ships together with that CLI. It's re-run (with a new target version)
103+
> on every subsequent CLI bump, so pins are always re-enforced against the bundle, not just set once.
104+
> It determines these versions by downloading the bundle release asset
105+
> (`codeql-bundle-linux64.tar.gz`, tag `codeql-bundle-v<version>`) from
106+
> [github/codeql-action releases](https://github.com/github/codeql-action/releases) and listing its
107+
> `codeql/qlpacks/codeql/<pkg>/<version>/` directory entries (via `tar tzf`, no extraction needed) -
108+
> this is the CLI-native source of truth, not a web scrape of any documentation page. (Two other
109+
> approaches were considered and rejected: the [`gh-codeql`](https://github.com/github/gh-codeql)
110+
> extension's `gh codeql set-version` only installs the bare CLI without any bundled library packs, so
111+
> it can't answer this question; and `codeql resolve packs`/`codeql pack upgrade` themselves are what's
112+
> *being* fixed, so they can't be used to validate their own input.) Any `codeql/*` dependency the
113+
> script can't find in the bundle (there's exactly one, see the note on [`ql/hotspots`](#ql-hotspots)
114+
> below) is left untouched and surfaced as a warning rather than silently skipped.
115+
>
116+
> Every `qlpack.yml` becomes pinned this way starting with the next CLI bump run through
117+
> [`update-codeql-version.yml`](#updating-the-pinned-codeql-clilibrary-version) - if you're reading
118+
> this shortly after this pinning behavior was introduced and a pack's `qlpack.yml` still shows
119+
> `codeql/<pkg>: '*'`, that just means its dependencies haven't been re-resolved since, not that the
120+
> convention doesn't apply to it.
121+
81122
CodeQL CLI: `v2.21.1` (released 2025-04-16) ([Bundle](https://github.com/github/codeql-action/releases/tag/codeql-bundle-v2.21.1) / [Binary](https://github.com/github/codeql-cli-binaries/releases/tag/v2.21.1))
82123

83124
| Language | Query pack | Standard library (`*-all`) | Upstream query pack (`*-queries`) | Lock file |
@@ -159,13 +200,25 @@ coding agent) in the loop for the hard part — fixing whatever the new CLI brea
159200
when to actually take the upgrade (and deal with any breakage) is a deliberate call, not
160201
something to run unattended.
161202
2. **Dependency refresh** — run [`update-codeql-version.yml`][update-codeql-version-workflow]
162-
(`workflow_dispatch`, input the new CLI version, e.g. `2.22.0`). It updates `.codeqlversion`,
163-
runs `codeql pack upgrade <dir>` for every pack directory to refresh each
164-
`codeql-pack.lock.yml`, and opens a PR (via the same GitHub App token as
203+
(`workflow_dispatch`, input the new CLI version, e.g. `2.22.0`). It updates `.codeqlversion`, then:
204+
1. Unconditionally re-pins every `codeql/<pkg>` dependency it recognizes across every
205+
`qlpack.yml` to the exact version shipped in the official CodeQL Bundle for that CLI release
206+
(see the warning box under [Supported CodeQL versions](#supported-codeql-versions) above for
207+
why this step exists), via
208+
[`pin-codeql-library-versions.sh`][pin-codeql-library-versions-script] - this overwrites
209+
whatever value is currently there, whether that's an unconstrained `'*'` or an exact version
210+
pinned by an earlier run of this same workflow, so pins always stay in lockstep with
211+
`.codeqlversion` on every bump, not just the first one.
212+
2. Runs `codeql pack upgrade <dir>` for every pack directory (except
213+
[`ql/hotspots`](#ql-hotspots), see below) to refresh each `codeql-pack.lock.yml` against the
214+
newly-pinned dependencies.
215+
216+
It then opens a PR (via the same GitHub App token as
165217
[`update-release.yml`][update-release-workflow], so CI actually runs on it — a plain
166-
`GITHUB_TOKEN`-authored PR would not trigger downstream workflows). This is the automated
167-
version of [#118][pr-118]'s original proposal, extended to also own the `.codeqlversion` bump
168-
itself (not just the `codeql pack upgrade` loop) and to use a token that triggers CI.
218+
`GITHUB_TOKEN`-authored PR would not trigger downstream workflows). This is the automated version
219+
of [#118][pr-118]'s original proposal, extended to also own the `.codeqlversion` bump and the
220+
exact-version pinning (not just a bare `codeql pack upgrade` loop) and to use a token that triggers
221+
CI.
169222
3. **Fix breakage and finish the checklist** — this PR does **not** publish anything by itself (no
170223
pack `version:` field is touched), so there's no rush, but it still needs:
171224
- [ ] Fix any compilation/test errors CI surfaces from upstream API changes (usually the
@@ -177,6 +230,16 @@ coding agent) in the loop for the hard part — fixing whatever the new CLI brea
177230
[Cutting a release](#cutting-a-release) below to bump every pack's `version:` in
178231
lockstep and trigger the real batch publish.
179232

233+
> [!NOTE]
234+
> <a id="ql-hotspots"></a>**Why `ql/hotspots` is excluded from the `codeql pack upgrade` loop:**
235+
> `ql/hotspots` is a standalone local dev tool (a QL-4-QL hotspot query generator, see
236+
> `ql/hotspots/README.md` and `.github/workflows/hotspots.yml`) that patches a freshly-cloned
237+
> `github/codeql` checkout — it's not one of the per-language `src`/`lib`/`ext`/`ext-library-sources`
238+
> packs `ci.yml`/`publish.yml` operate on. Its `qlpack.yml` declares `codeql/ql: '*'`, but
239+
> `codeql/ql` isn't a real package published to the registry or shipped in the CodeQL Bundle, so
240+
> `codeql pack upgrade`/the pinning script can never resolve it. This is a pre-existing, unrelated
241+
> quirk of that tool, not something the version-bump automation needs to (or can) fix.
242+
180243
> [!WARNING]
181244
> The `.codeqlversion` bump and the pack version bumps don't have to land in the same PR, but
182245
> splitting them is risky: [#124][pr-124] refreshed `.codeqlversion` and every language's
@@ -282,6 +345,7 @@ Please do get in touch (privacy@github.com) if you have any questions about this
282345
[update-release-workflow]: ./.github/workflows/update-release.yml
283346
[update-codeql-version-workflow]: ./.github/workflows/update-codeql-version.yml
284347
[detect-codeql-release-workflow]: ./.github/workflows/detect-codeql-release.yml
348+
[pin-codeql-library-versions-script]: ./.github/scripts/pin-codeql-library-versions.sh
285349
[codeql-cli-binaries]: https://github.com/github/codeql-cli-binaries/releases
286350
[release-config]: ./.release.yml
287351
[patch-release-me]: https://github.com/42ByteLabs/patch-release-me

0 commit comments

Comments
 (0)