Skip to content

Add selective release-asset syncing (--os-include, --os-exclude, --compression-format) - #193

Merged
JohnBreault merged 2 commits into
mainfrom
johnbreault-selective-release-asset-sync
Sep 22, 2026
Merged

JohnBreault merged 2 commits into
mainfrom
johnbreault-selective-release-asset-sync

Conversation

@JohnBreault

Copy link
Copy Markdown
Contributor

Problem

pull/sync downloads every asset attached to each relevant codeql-action release. Real releases contain, per OS (linux64, linux-arm64, osx64, win64, ...), both a .tar.gz and a .tar.zst bundle plus checksum files. Downloading all of these:

  1. Puts heavy CPU/RAM load on the GHES VM during syncing.
  2. Wastes bandwidth/disk on OS assets that aren't needed for the runners attached to a given GHES instance.
  3. Duplicates data by syncing both compression formats when only one is needed.

Solution

Added new flags to pull and sync:

  • --os-include — comma-separated list of OS identifiers to include (e.g. linux64,win64). Mutually exclusive with --os-exclude (validation error if both given).
  • --os-exclude — comma-separated list of OS identifiers to exclude (e.g. win64,osx64).
  • --compression-formatgz or zst. If omitted, both formats are kept (current/default behavior).

Implementation

  • internal/pull/pull.go — new regex parses codeql-bundle-<os>.tar.<gz|zst> (and .checksum.txt variants) out of asset names; a shouldDownloadAsset helper implements the include/exclude/compression-format logic and is used in pullReleases to skip filtered assets before download. Non-OS-specific assets (e.g. cli-version-*.txt) are always kept.
  • cmd/pull.go / cmd/sync.go — new flags with validation for mutual exclusivity and valid compression values.
  • README.md — documented the new flags under both sync and pull usage sections.
  • internal/pull/pull_test.go — added unit tests for shouldDownloadAsset and an integration test verifying filtered assets are skipped end-to-end.

Testing

  • go build ./..., go vet ./..., gofmt -l . (clean), go test ./... all pass.
  • Manually built the binary and confirmed the new flags appear in pull --help.

Co-authored-by: Copilot App 223556219+Copilot@users.noreply.github.com

…ive release-asset syncing

Allows GHES admins to select which CodeQL bundle OS assets to sync and
which compression format (gz or zst) to use, reducing load on the GHES
VM and avoiding syncing unnecessary release assets.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings September 21, 2026 23:53

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot review overview

🟡 Changes recommended

Reused caches can retain and upload assets excluded by the current filters.

Get a fresh assessment by requesting another Copilot review.

Review effort: Balanced
Findings: 1 High severity

Open (1)
What changed in this PR

Adds selective CodeQL release-asset syncing by OS and compression format.

Changes:

  • Adds and validates filtering flags for pull and sync.
  • Filters matching release assets before download, with tests.
  • Documents flags and ignores local release artifacts.
File Description
.gitignore Ignores local release artifacts.
README.md Documents filtering flags.
cmd/​pull.go Defines, parses, and validates flags.
cmd/​sync.go Applies filters during sync.
internal/​pull/​pull.go Implements asset filtering.
internal/​pull/​pull_test.go Tests filtering behavior.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread internal/pull/pull.go
Comment on lines +266 to +269
if !pullService.shouldDownloadAsset(asset.GetName()) {
log.Debugf("Skipping asset %s due to OS/compression format filters.", asset.GetName())
continue
}
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@JohnBreault
JohnBreault merged commit 27598c1 into main Sep 22, 2026
8 of 10 checks passed
@JohnBreault
JohnBreault deleted the johnbreault-selective-release-asset-sync branch September 22, 2026 00:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants