Add selective release-asset syncing (--os-include, --os-exclude, --compression-format) - #193
Merged
Merged
Conversation
…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>
There was a problem hiding this comment.
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
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
pullandsync. - 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 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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Problem
pull/syncdownloads every asset attached to each relevantcodeql-actionrelease. Real releases contain, per OS (linux64,linux-arm64,osx64,win64, ...), both a.tar.gzand a.tar.zstbundle plus checksum files. Downloading all of these:Solution
Added new flags to
pullandsync:--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-format—gzorzst. If omitted, both formats are kept (current/default behavior).Implementation
internal/pull/pull.go— new regex parsescodeql-bundle-<os>.tar.<gz|zst>(and.checksum.txtvariants) out of asset names; ashouldDownloadAssethelper implements the include/exclude/compression-format logic and is used inpullReleasesto 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 bothsyncandpullusage sections.internal/pull/pull_test.go— added unit tests forshouldDownloadAssetand an integration test verifying filtered assets are skipped end-to-end.Testing
go build ./...,go vet ./...,gofmt -l .(clean),go test ./...all pass.pull --help.Co-authored-by: Copilot App 223556219+Copilot@users.noreply.github.com