Skip to content

chore: upgrade trivy to v0.69.3 with GOEXPERIMENT=jsonv2#4380

Merged
olegsu merged 2 commits into
mainfrom
cloudbeat-trivy-upgrade
Apr 28, 2026
Merged

chore: upgrade trivy to v0.69.3 with GOEXPERIMENT=jsonv2#4380
olegsu merged 2 commits into
mainfrom
cloudbeat-trivy-upgrade

Conversation

@olegsu
Copy link
Copy Markdown
Collaborator

@olegsu olegsu commented Apr 13, 2026

Summary

  • Upgrades github.com/aquasecurity/trivy from v0.66.0 to v0.69.3
  • Adds GOEXPERIMENT=jsonv2 to all build paths — required because trivy v0.67+ imports Go's experimental encoding/json/v2 packages which are only available at compile time when this flag is set
  • Removes transitive dependency on deprecated AWS SDK v1 (github.com/aws/aws-sdk-go v1.55.8) which was previously pulled in by trivy v0.66.0
  • Co-upgrades 22 transitive dependencies (trivy-checks, trivy-db, opa v1.8→v1.11, helm v3.18→v3.19, k8s.io v0.33→v0.34, kustomize v0.19→v0.20, and others)

Why GOEXPERIMENT=jsonv2 is needed

Starting with trivy v0.67.0, trivy uses encoding/json/v2 (Go's experimental next-gen JSON library) via github.com/aquasecurity/trivy/pkg/x/json. Without GOEXPERIMENT=jsonv2 set at compile time, any go build that imports trivy fails with:

build constraints exclude all Go files in .../encoding/json/jsontext

Go 1.26.1 (already in use) satisfies the Go ≥ 1.25 requirement, but the flag is still required as encoding/json/v2 remains experimental.

Files changed

File Change
go.mod / go.sum Bumped trivy + transitive deps
magefile.go args.Env["GOEXPERIMENT"] = "jsonv2" in Build() and GolangCrossBuild()
.buildkite/scripts/package.sh export GOEXPERIMENT=jsonv2 after hermit activation
.github/workflows/packaging.yml Added to top-level env:
.github/workflows/ci-pull_request.yml New top-level env: block
.github/workflows/binary-size-monitor.yml Added to env:
.github/workflows/eks-ci.yml Added to env:
.github/actions/docker-images/action.yml Added to Build cloudbeat binary step env:
justfile Inline GOEXPERIMENT=jsonv2 on go build in build-binary and build-cloudbeat-debug

Test plan

  • GOEXPERIMENT=jsonv2 go build ./... — clean
  • GOEXPERIMENT=jsonv2 go vet ./... — clean
  • go mod verify — all modules verified
  • TestVulnerabilityWorker_Run — PASS
  • Full go test ./... (will run in CI)
  • Packaging CI (packaging.yml) validates cross-build path
  • Watch first Buildkite DRA pipeline on merge to confirm golang-crossbuild containers work

See trivy-upgrade-report.md for the full analysis including DRA process breakdown.

🤖 Generated with Claude Code

@olegsu olegsu requested a review from a team as a code owner April 13, 2026 21:19
@mergify mergify Bot assigned olegsu Apr 13, 2026
@mergify
Copy link
Copy Markdown
Contributor

mergify Bot commented Apr 13, 2026

This pull request does not have a backport label. Could you fix it @olegsu? 🙏
To fixup this pull request, you need to add the backport labels for the needed
branches, such as:

  • backport-v./d./d./d is the label to automatically backport to the 8./d branch. /d is the digit
  • backport-active-all is the label that automatically backports to all active branches.
  • backport-active-8 is the label that automatically backports to all active minor branches for the 8 major.
  • backport-active-9 is the label that automatically backports to all active minor branches for the 9 major.

@olegsu olegsu added Team:Security-Cloud Services Security Data Experience - Cloud Services team. labels Apr 13, 2026
@mergify
Copy link
Copy Markdown
Contributor

mergify Bot commented Apr 14, 2026

Caution

The updated Mergify configuration is adding new deprecated fields:

  • pull_request_rules → actions → delete_head_branch
  • pull_request_rules → actions → delete_head_branch

@mergify
Copy link
Copy Markdown
Contributor

mergify Bot commented Apr 14, 2026

This pull request is now in conflicts. Could you fix it? 🙏
To fixup this pull request, you can check out it locally. See documentation: https://help.github.com/articles/checking-out-pull-requests-locally/

git fetch upstream
git checkout -b cloudbeat-trivy-upgrade upstream/cloudbeat-trivy-upgrade
git merge upstream/main
git push upstream cloudbeat-trivy-upgrade

@olegsu olegsu force-pushed the cloudbeat-trivy-upgrade branch 2 times, most recently from 5722066 to 7979a18 Compare April 14, 2026 16:30
@mergify
Copy link
Copy Markdown
Contributor

mergify Bot commented Apr 14, 2026

This pull request is now in conflicts. Could you fix it? 🙏
To fixup this pull request, you can check out it locally. See documentation: https://help.github.com/articles/checking-out-pull-requests-locally/

git fetch upstream
git checkout -b cloudbeat-trivy-upgrade upstream/cloudbeat-trivy-upgrade
git merge upstream/main
git push upstream cloudbeat-trivy-upgrade

@olegsu
Copy link
Copy Markdown
Collaborator Author

olegsu commented Apr 15, 2026

Update: created an environment with the changes from this PR,so far I dont see any unexpected logs
@gurevichdmitry

@olegsu olegsu force-pushed the cloudbeat-trivy-upgrade branch 2 times, most recently from a804144 to 653ce3f Compare April 21, 2026 16:29
@olegsu olegsu force-pushed the cloudbeat-trivy-upgrade branch from 653ce3f to 002988f Compare April 22, 2026 21:25
@mergify
Copy link
Copy Markdown
Contributor

mergify Bot commented Apr 22, 2026

This pull request is now in conflicts. Could you fix it? 🙏
To fixup this pull request, you can check out it locally. See documentation: https://help.github.com/articles/checking-out-pull-requests-locally/

git fetch upstream
git checkout -b cloudbeat-trivy-upgrade upstream/cloudbeat-trivy-upgrade
git merge upstream/main
git push upstream cloudbeat-trivy-upgrade

@olegsu olegsu force-pushed the cloudbeat-trivy-upgrade branch from 002988f to 97948a4 Compare April 24, 2026 13:46
- Bump github.com/aquasecurity/trivy v0.66.0 -> v0.69.3
- Add GOEXPERIMENT=jsonv2 to magefile.go Build() and GolangCrossBuild()
- Add GOEXPERIMENT=jsonv2 to all CI/CD build paths (Buildkite, GHA, justfile)
- Remove transitive dep on deprecated aws-sdk-go v1.55.8
- Co-upgrade 22 transitive deps (trivy-checks, trivy-db, opa, helm, k8s.io, kustomize)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@olegsu olegsu force-pushed the cloudbeat-trivy-upgrade branch from 97948a4 to bc65815 Compare April 28, 2026 15:16
@mergify
Copy link
Copy Markdown
Contributor

mergify Bot commented Apr 28, 2026

This pull request is now in conflicts. Could you fix it? 🙏
To fixup this pull request, you can check out it locally. See documentation: https://help.github.com/articles/checking-out-pull-requests-locally/

git fetch upstream
git checkout -b cloudbeat-trivy-upgrade upstream/cloudbeat-trivy-upgrade
git merge upstream/main
git push upstream cloudbeat-trivy-upgrade

@olegsu olegsu added this pull request to the merge queue Apr 28, 2026
Merged via the queue into main with commit cfd61d8 Apr 28, 2026
12 of 16 checks passed
@olegsu olegsu deleted the cloudbeat-trivy-upgrade branch April 28, 2026 21:28
olegsu added a commit that referenced this pull request May 5, 2026
- Upgrades `github.com/aquasecurity/trivy` from `v0.66.0` to `v0.69.3`
- Adds `GOEXPERIMENT=jsonv2` to all build paths — required because trivy
v0.67+ imports Go's experimental `encoding/json/v2` packages which are
only available at compile time when this flag is set
- Removes transitive dependency on deprecated AWS SDK v1
(`github.com/aws/aws-sdk-go v1.55.8`) which was previously pulled in by
trivy v0.66.0
- Co-upgrades 22 transitive dependencies (trivy-checks, trivy-db, opa
v1.8→v1.11, helm v3.18→v3.19, k8s.io v0.33→v0.34, kustomize v0.19→v0.20,
and others)

Starting with trivy v0.67.0, trivy uses `encoding/json/v2` (Go's
experimental next-gen JSON library) via
`github.com/aquasecurity/trivy/pkg/x/json`. Without
`GOEXPERIMENT=jsonv2` set at **compile time**, any `go build` that
imports trivy fails with:
```
build constraints exclude all Go files in .../encoding/json/jsontext
```

Go 1.26.1 (already in use) satisfies the Go ≥ 1.25 requirement, but the
flag is still required as `encoding/json/v2` remains experimental.

| File | Change |
|------|--------|
| `go.mod` / `go.sum` | Bumped trivy + transitive deps |
| `magefile.go` | `args.Env["GOEXPERIMENT"] = "jsonv2"` in `Build()` and
`GolangCrossBuild()` |
| `.buildkite/scripts/package.sh` | `export GOEXPERIMENT=jsonv2` after
hermit activation |
| `.github/workflows/packaging.yml` | Added to top-level `env:` |
| `.github/workflows/ci-pull_request.yml` | New top-level `env:` block |
| `.github/workflows/binary-size-monitor.yml` | Added to `env:` |
| `.github/workflows/eks-ci.yml` | Added to `env:` |
| `.github/actions/docker-images/action.yml` | Added to `Build cloudbeat
binary` step `env:` |
| `justfile` | Inline `GOEXPERIMENT=jsonv2` on `go build` in
`build-binary` and `build-cloudbeat-debug` |

- [x] `GOEXPERIMENT=jsonv2 go build ./...` — clean
- [x] `GOEXPERIMENT=jsonv2 go vet ./...` — clean
- [x] `go mod verify` — all modules verified
- [x] `TestVulnerabilityWorker_Run` — PASS
- [x] Full `go test ./...` (will run in CI)
- [ ] Packaging CI (`packaging.yml`) validates cross-build path
- [ ] Watch first Buildkite DRA pipeline on merge to confirm
golang-crossbuild containers work
@olegsu
Copy link
Copy Markdown
Collaborator Author

olegsu commented May 5, 2026

@Mergifyio backport 9.4

@mergify
Copy link
Copy Markdown
Contributor

mergify Bot commented May 5, 2026

backport 9.4

✅ Backports have been created

Details

Cherry-pick of cfd61d8 has failed:

On branch mergify/bp/9.4/pr-4380
Your branch is up to date with 'origin/9.4'.

You are currently cherry-picking commit cfd61d8f.
  (fix conflicts and run "git cherry-pick --continue")
  (use "git cherry-pick --skip" to skip this patch)
  (use "git cherry-pick --abort" to cancel the cherry-pick operation)

Changes to be committed:
	modified:   .buildkite/scripts/package.sh
	modified:   .github/actions/docker-images/action.yml
	modified:   .github/workflows/binary-size-monitor.yml
	modified:   .github/workflows/ci-pull_request.yml
	modified:   .github/workflows/eks-ci.yml
	modified:   .github/workflows/packaging.yml
	modified:   justfile
	modified:   magefile.go

Unmerged paths:
  (use "git add <file>..." to mark resolution)
	both modified:   go.mod
	both modified:   go.sum

To fix up this pull request, you can check it out locally. See documentation: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/checking-out-pull-requests-locally

olegsu added a commit that referenced this pull request May 5, 2026
Cherry-pick of #4380 onto 9.4 left unresolved conflict markers in
go.mod and go.sum. Resolution strategy:
- trivy v0.69.3, trivy-db, trivy-checks: cherry-pick side (upgrade goal)
- aws-sdk-go-v2 and AWS service modules: HEAD side (9.4 Renovate bumps)
- toqueteos/webbrowser, transparency-dev/formats: cherry-pick (new trivy deps)
- golang.org/x/exp: HEAD (newer timestamp from 9.4 Renovate)
- go.sum: union of both sides

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport-v9.4.0 Team:Security-Cloud Services Security Data Experience - Cloud Services team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants