Repository navigation
ci: make SCA analysis cache compression portable - #28166
Merged
XuPeng-SH merged 3 commits intoSep 4, 2026
Merged
Conversation
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
VioletQwQ-0
pushed a commit
to VioletQwQ-0/matrixone
that referenced
this pull request
Sep 17, 2026
## Which issue(s) this PR fixes: Refs matrixorigin#28100 ## What this PR does / why we need it: The trusted SCA analysis-cache producer introduced by matrixorigin#28101 completed the full golangci-lint run twice, then failed before publication because the `arm64-mo-shanghai-4c8g` image has `libzstd-dev` but no `zstd` command in `PATH`: - https://github.com/matrixorigin/matrixone/actions/runs/33852599450/job/100958542982 - https://github.com/matrixorigin/matrixone/actions/runs/33859727455/job/100981164687 Both runs ended with `0 issues` after 30m06s / 26m29s, then failed at the archive-size estimate with `zstd: command not found`. Consequently no trusted analysis cache was saved and PR SCA consumers continued to take the complete cold path. This change makes the producer follow the same compression capability contract as `actions/[email protected]`: - resolve compression after environment setup and before cache restore or expensive analysis; - use zstd only when `zstd`, `zstdmt`, and `unzstd` form a complete toolchain that passes a byte-level round trip; - otherwise use the supported gzip fallback already selected internally by `actions/cache`; - fail immediately with an actionable message when neither method is usable, a compressor round trip fails, or zstd is only partially installed; - estimate the publication size using the selected method, including `zstdmt` to match the actual cache creation path; - retain the existing empty-cache, 200,000-file, and 160-MiB compressed-size bounds. The producer does not install packages at runtime. A per-job package installation would add a network dependency and startup cost to solve a case that `actions/cache` already supports natively. ## Correctness, safety, and unhappy paths - Analyzer selection, package coverage, license checks, and PR failure semantics are unchanged. - Only the trusted main producer can publish; PR jobs remain restore-only. - Compression method values are produced internally and consumed through an explicit `zstd` / `gzip` case, with unknown values rejected. - `set -euo pipefail` still makes tar or compressor failures terminal instead of accepting a truncated size. - A missing or partial compressor now fails before the 26–30 minute cold golangci run. - `actions/cache` owns gzip/zstd archive compatibility and includes the compression method in its internal cache version, so a future runner-image transition causes a safe cache miss and one new warm publication. ## Performance and resource impact Measured locally with the representative matrixorigin#28101 golangci cache (89,757 files, 353 MiB filesystem usage): | Method | Archive bytes | Estimate time | | --- | ---: | ---: | | zstdmt | 6,971,000 | 10.06s | | gzip | 8,055,900 | 10.83s | For this representative cache, gzip adds about 1.1 MiB and 0.77s, remains far below the 160-MiB budget, and avoids a new network/package-manager dependency. The analysis itself remains the dominant cold cost; once publication succeeds, later PR jobs can restore the analysis cache. ## QA test plan - `actionlint` 1.7.12 passes for `.github/workflows/sca-go-module-cache.yaml`. - ShellCheck 0.11.0 passes for both modified Bash steps. - YAML parsing and `git diff --check` pass. - The exact compression-resolution step selects zstd and gzip only after a successful byte-level round trip. - The gzip-only simulation matches the observed Shanghai runner state. - Broken zstd, broken gzip, partial-zstd, and no-compressor simulations fail with the intended early errors. - The exact archive-budget block succeeds with both gzip and zstd on a non-empty cache. ## Staged acceptance After merge, the main push runs the trusted producer on the target ARM runner. Acceptance requires: 1. `Resolve analysis cache compression` reports gzip on the current image; 2. the warm step records a bounded non-empty archive and reaches `Save golangci-lint analysis cache`; 3. a later PR SCA reports a usable exact or prefix analysis-cache restore; 4. cache-hit analyzer and total SCA durations are compared with the existing matrixorigin#28100 baseline. If publication or restore remains unreliable, disabling the analysis-cache restore path rolls back only the optimization; SCA coverage remains complete.
VioletQwQ-0
pushed a commit
to VioletQwQ-0/matrixone
that referenced
this pull request
Sep 17, 2026
## Which issue(s) this PR fixes: Refs matrixorigin#28100 ## What this PR does / why we need it: The trusted SCA analysis-cache producer introduced by matrixorigin#28101 completed the full golangci-lint run twice, then failed before publication because the `arm64-mo-shanghai-4c8g` image has `libzstd-dev` but no `zstd` command in `PATH`: - https://github.com/matrixorigin/matrixone/actions/runs/33852599450/job/100958542982 - https://github.com/matrixorigin/matrixone/actions/runs/33859727455/job/100981164687 Both runs ended with `0 issues` after 30m06s / 26m29s, then failed at the archive-size estimate with `zstd: command not found`. Consequently no trusted analysis cache was saved and PR SCA consumers continued to take the complete cold path. This change makes the producer follow the same compression capability contract as `actions/[email protected]`: - resolve compression after environment setup and before cache restore or expensive analysis; - use zstd only when `zstd`, `zstdmt`, and `unzstd` form a complete toolchain that passes a byte-level round trip; - otherwise use the supported gzip fallback already selected internally by `actions/cache`; - fail immediately with an actionable message when neither method is usable, a compressor round trip fails, or zstd is only partially installed; - estimate the publication size using the selected method, including `zstdmt` to match the actual cache creation path; - retain the existing empty-cache, 200,000-file, and 160-MiB compressed-size bounds. The producer does not install packages at runtime. A per-job package installation would add a network dependency and startup cost to solve a case that `actions/cache` already supports natively. ## Correctness, safety, and unhappy paths - Analyzer selection, package coverage, license checks, and PR failure semantics are unchanged. - Only the trusted main producer can publish; PR jobs remain restore-only. - Compression method values are produced internally and consumed through an explicit `zstd` / `gzip` case, with unknown values rejected. - `set -euo pipefail` still makes tar or compressor failures terminal instead of accepting a truncated size. - A missing or partial compressor now fails before the 26–30 minute cold golangci run. - `actions/cache` owns gzip/zstd archive compatibility and includes the compression method in its internal cache version, so a future runner-image transition causes a safe cache miss and one new warm publication. ## Performance and resource impact Measured locally with the representative matrixorigin#28101 golangci cache (89,757 files, 353 MiB filesystem usage): | Method | Archive bytes | Estimate time | | --- | ---: | ---: | | zstdmt | 6,971,000 | 10.06s | | gzip | 8,055,900 | 10.83s | For this representative cache, gzip adds about 1.1 MiB and 0.77s, remains far below the 160-MiB budget, and avoids a new network/package-manager dependency. The analysis itself remains the dominant cold cost; once publication succeeds, later PR jobs can restore the analysis cache. ## QA test plan - `actionlint` 1.7.12 passes for `.github/workflows/sca-go-module-cache.yaml`. - ShellCheck 0.11.0 passes for both modified Bash steps. - YAML parsing and `git diff --check` pass. - The exact compression-resolution step selects zstd and gzip only after a successful byte-level round trip. - The gzip-only simulation matches the observed Shanghai runner state. - Broken zstd, broken gzip, partial-zstd, and no-compressor simulations fail with the intended early errors. - The exact archive-budget block succeeds with both gzip and zstd on a non-empty cache. ## Staged acceptance After merge, the main push runs the trusted producer on the target ARM runner. Acceptance requires: 1. `Resolve analysis cache compression` reports gzip on the current image; 2. the warm step records a bounded non-empty archive and reaches `Save golangci-lint analysis cache`; 3. a later PR SCA reports a usable exact or prefix analysis-cache restore; 4. cache-hit analyzer and total SCA durations are compared with the existing matrixorigin#28100 baseline. If publication or restore remains unreliable, disabling the analysis-cache restore path rolls back only the optimization; SCA coverage remains complete.
VioletQwQ-0
pushed a commit
to VioletQwQ-0/matrixone
that referenced
this pull request
Sep 17, 2026
## Which issue(s) this PR fixes: Refs matrixorigin#28100 ## What this PR does / why we need it: The trusted SCA analysis-cache producer introduced by matrixorigin#28101 completed the full golangci-lint run twice, then failed before publication because the `arm64-mo-shanghai-4c8g` image has `libzstd-dev` but no `zstd` command in `PATH`: - https://github.com/matrixorigin/matrixone/actions/runs/33852599450/job/100958542982 - https://github.com/matrixorigin/matrixone/actions/runs/33859727455/job/100981164687 Both runs ended with `0 issues` after 30m06s / 26m29s, then failed at the archive-size estimate with `zstd: command not found`. Consequently no trusted analysis cache was saved and PR SCA consumers continued to take the complete cold path. This change makes the producer follow the same compression capability contract as `actions/[email protected]`: - resolve compression after environment setup and before cache restore or expensive analysis; - use zstd only when `zstd`, `zstdmt`, and `unzstd` form a complete toolchain that passes a byte-level round trip; - otherwise use the supported gzip fallback already selected internally by `actions/cache`; - fail immediately with an actionable message when neither method is usable, a compressor round trip fails, or zstd is only partially installed; - estimate the publication size using the selected method, including `zstdmt` to match the actual cache creation path; - retain the existing empty-cache, 200,000-file, and 160-MiB compressed-size bounds. The producer does not install packages at runtime. A per-job package installation would add a network dependency and startup cost to solve a case that `actions/cache` already supports natively. ## Correctness, safety, and unhappy paths - Analyzer selection, package coverage, license checks, and PR failure semantics are unchanged. - Only the trusted main producer can publish; PR jobs remain restore-only. - Compression method values are produced internally and consumed through an explicit `zstd` / `gzip` case, with unknown values rejected. - `set -euo pipefail` still makes tar or compressor failures terminal instead of accepting a truncated size. - A missing or partial compressor now fails before the 26–30 minute cold golangci run. - `actions/cache` owns gzip/zstd archive compatibility and includes the compression method in its internal cache version, so a future runner-image transition causes a safe cache miss and one new warm publication. ## Performance and resource impact Measured locally with the representative matrixorigin#28101 golangci cache (89,757 files, 353 MiB filesystem usage): | Method | Archive bytes | Estimate time | | --- | ---: | ---: | | zstdmt | 6,971,000 | 10.06s | | gzip | 8,055,900 | 10.83s | For this representative cache, gzip adds about 1.1 MiB and 0.77s, remains far below the 160-MiB budget, and avoids a new network/package-manager dependency. The analysis itself remains the dominant cold cost; once publication succeeds, later PR jobs can restore the analysis cache. ## QA test plan - `actionlint` 1.7.12 passes for `.github/workflows/sca-go-module-cache.yaml`. - ShellCheck 0.11.0 passes for both modified Bash steps. - YAML parsing and `git diff --check` pass. - The exact compression-resolution step selects zstd and gzip only after a successful byte-level round trip. - The gzip-only simulation matches the observed Shanghai runner state. - Broken zstd, broken gzip, partial-zstd, and no-compressor simulations fail with the intended early errors. - The exact archive-budget block succeeds with both gzip and zstd on a non-empty cache. ## Staged acceptance After merge, the main push runs the trusted producer on the target ARM runner. Acceptance requires: 1. `Resolve analysis cache compression` reports gzip on the current image; 2. the warm step records a bounded non-empty archive and reaches `Save golangci-lint analysis cache`; 3. a later PR SCA reports a usable exact or prefix analysis-cache restore; 4. cache-hit analyzer and total SCA durations are compared with the existing matrixorigin#28100 baseline. If publication or restore remains unreliable, disabling the analysis-cache restore path rolls back only the optimization; SCA coverage remains complete.
This branch had an error being deployed
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.
Which issue(s) this PR fixes:
Refs #28100
What this PR does / why we need it:
The trusted SCA analysis-cache producer introduced by #28101 completed the full golangci-lint run twice, then failed before publication because the
arm64-mo-shanghai-4c8gimage haslibzstd-devbut nozstdcommand inPATH:Both runs ended with
0 issuesafter 30m06s / 26m29s, then failed at the archive-size estimate withzstd: command not found. Consequently no trusted analysis cache was saved and PR SCA consumers continued to take the complete cold path.This change makes the producer follow the same compression capability contract as
actions/[email protected]:zstd,zstdmt, andunzstdform a complete toolchain that passes a byte-level round trip;actions/cache;zstdmtto match the actual cache creation path;The producer does not install packages at runtime. A per-job package installation would add a network dependency and startup cost to solve a case that
actions/cachealready supports natively.Correctness, safety, and unhappy paths
zstd/gzipcase, with unknown values rejected.set -euo pipefailstill makes tar or compressor failures terminal instead of accepting a truncated size.actions/cacheowns gzip/zstd archive compatibility and includes the compression method in its internal cache version, so a future runner-image transition causes a safe cache miss and one new warm publication.Performance and resource impact
Measured locally with the representative #28101 golangci cache (89,757 files, 353 MiB filesystem usage):
For this representative cache, gzip adds about 1.1 MiB and 0.77s, remains far below the 160-MiB budget, and avoids a new network/package-manager dependency. The analysis itself remains the dominant cold cost; once publication succeeds, later PR jobs can restore the analysis cache.
QA test plan
actionlint1.7.12 passes for.github/workflows/sca-go-module-cache.yaml.git diff --checkpass.Staged acceptance
After merge, the main push runs the trusted producer on the target ARM runner. Acceptance requires:
Resolve analysis cache compressionreports gzip on the current image;Save golangci-lint analysis cache;If publication or restore remains unreliable, disabling the analysis-cache restore path rolls back only the optimization; SCA coverage remains complete.