mirror of
https://github.com/livekit/livekit.git
synced 2026-08-22 05:39:46 +00:00
Update renovate and pinning behavior, run tools from go.mod (#4759)
- Renovate config:recommended (config:base is deprecated) and matchPackageNames globs instead of the deprecated matchPackagePrefixes. Vulnerability alerts get a fast path: 2-day quarantine, no concurrency/hourly/schedule limits. Go modules are no longer grouped into one "go deps" PR — each gets its own, so a bad bump can be reverted alone. The pion modules stay grouped as a documented exception: they're co-released and interdependent, so individual PRs wouldn't build. First-party github.com/livekit/** skips the 2-week quarantine. go.mod's go directive is no longer an update target — the build toolchain is pinned in the Dockerfile instead. Dockerfile deps get pinDigests; the golang image is ungrouped with separateMinorPatch so a patch and a minor bump are each separately approvable. Custom manager to bump the builder image's -alpineA.B suffix together with its digest, which the stock docker manager holds fixed. - Pinning Both Dockerfiles pin golang and alpine by digest alongside the readable tag. GOTOOLCHAIN=local so a go.mod bump fails loudly instead of silently downloading a different toolchain. apk upgrade in the runtime stage — a digest pin plus the 2-week quarantine would otherwise ship base-package CVEs Alpine has already fixed. This relies on a cold layer cache, which holds today because the release workflow configures no buildx cache; there's a comment saying so. Workflows resolve the Go version from the Dockerfile via .github/scripts/go-version.sh, so tests, releases and images share one toolchain. - Tools All four code generators now come from the module graph, and tools/tools.go (the pre-Go-1.24 blank-import idiom) is replaced by go.mod tool directives: tool how why goimports go tool lives in x/tools — its own module is the one being selected gotestfmt go tool zero dependencies, nothing to skew wire go run pins x/tools v0.24.1; building it in our graph changes its output counterfeiter go run unchanged, matches its //go:generate directives The wire distinction is load-bearing. Building wire inside our module raises it from the x/tools v0.24.1 it pins to our v0.48.0, and that module version difference changes what it generates: it falls back to v/v2/v3 instead of deriving real identifiers from the type. wire_gen.go is regenerated here to match the in-module build — a cosmetic rename of 9 lines, with no other change to the generated code. golangci-lint deliberately keeps its action rather than becoming a tool: it pins its own x/tools (v0.44.0 vs our v0.48.0) for the analyzers it bundles, adding it to go.mod would double our go.mod/go.sum (158→338 / 441→889 lines), and the action supplies caching, only-new-issues and PR annotations that invoking a binary can't. Its version stays manual by request.
This commit is contained in:
@@ -35,29 +35,34 @@ jobs:
|
||||
auto-start: true
|
||||
- run: redis-cli ping
|
||||
|
||||
# Test with the same Go toolchain the published image is built with
|
||||
- name: Resolve Go version
|
||||
id: go-version
|
||||
run: |
|
||||
# Assign first so a failed lookup trips `set -e`; inside echo its exit
|
||||
# status would be discarded and an empty version written.
|
||||
version=$(.github/scripts/go-version.sh Dockerfile)
|
||||
echo "version=$version" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7
|
||||
with:
|
||||
go-version: "^1.26"
|
||||
|
||||
- name: Set up gotestfmt
|
||||
run: go install github.com/gotesttools/gotestfmt/v2/cmd/gotestfmt@v2.4.1
|
||||
go-version: ${{ steps.go-version.outputs.version }}
|
||||
|
||||
- name: Replace mutexes
|
||||
run: |
|
||||
go get github.com/sasha-s/go-deadlock
|
||||
grep -rl sync.Mutex ./pkg | xargs sed -i 's/sync\.Mutex/deadlock\.Mutex/g'
|
||||
grep -rl sync.RWMutex ./pkg | xargs sed -i 's/sync\.RWMutex/deadlock\.RWMutex/g'
|
||||
go install golang.org/x/tools/cmd/goimports@latest
|
||||
grep -rl deadlock.Mutex ./pkg | xargs goimports -w
|
||||
grep -rl deadlock.RWMutex ./pkg | xargs goimports -w
|
||||
grep -rl deadlock.Mutex ./pkg | xargs go tool goimports -w
|
||||
grep -rl deadlock.RWMutex ./pkg | xargs go tool goimports -w
|
||||
go mod tidy
|
||||
|
||||
# Run mage at the version go.mod pins, rather than the mage-action's
|
||||
# `version: latest`, so the binary matches the mage/mg library the magefile is
|
||||
# compiled against and Renovate owns the version like any other module.
|
||||
- name: Mage Build
|
||||
uses: magefile/mage-action@a662bd8c29d8106879588cfff83b2faf6e6f59db # v4
|
||||
with:
|
||||
version: latest
|
||||
args: build
|
||||
run: go run github.com/magefile/mage build
|
||||
|
||||
- name: Lint
|
||||
uses: golangci/golangci-lint-action@1e7e51e771db61008b38414a730f564565cf7c20 # v9.2.0
|
||||
@@ -67,7 +72,7 @@ jobs:
|
||||
- name: Test
|
||||
run: |
|
||||
set -euo pipefail
|
||||
MallocNanoZone=0 go test -race -json -v ./... 2>&1 | tee /tmp/gotest.log | gotestfmt
|
||||
MallocNanoZone=0 go test -race -json -v ./... 2>&1 | tee /tmp/gotest.log | go tool gotestfmt
|
||||
|
||||
# Upload the original go test log as an artifact for later review.
|
||||
- name: Upload test log
|
||||
|
||||
@@ -43,19 +43,28 @@ jobs:
|
||||
type=semver,pattern=v{{version}}
|
||||
type=semver,pattern=v{{major}}.{{minor}}
|
||||
|
||||
# Generate with the same Go toolchain the published image is built with
|
||||
- name: Resolve Go version
|
||||
id: go-version
|
||||
run: |
|
||||
# Assign first so a failed lookup trips `set -e`; inside echo its exit
|
||||
# status would be discarded and an empty version written.
|
||||
version=$(.github/scripts/go-version.sh Dockerfile)
|
||||
echo "version=$version" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7
|
||||
with:
|
||||
go-version-file: "go.mod"
|
||||
go-version: ${{ steps.go-version.outputs.version }}
|
||||
|
||||
- name: Download Go modules
|
||||
run: go mod download
|
||||
|
||||
# Run mage at the version go.mod pins, rather than the mage-action's
|
||||
# `version: latest`, so the binary matches the mage/mg library the magefile is
|
||||
# compiled against and Renovate owns the version like any other module.
|
||||
- name: Generate code
|
||||
uses: magefile/mage-action@a662bd8c29d8106879588cfff83b2faf6e6f59db # v4
|
||||
with:
|
||||
version: latest
|
||||
args: generate
|
||||
run: go run github.com/magefile/mage generate
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # v4
|
||||
|
||||
@@ -32,10 +32,19 @@ jobs:
|
||||
- name: Fetch all tags
|
||||
run: git fetch --force --tags
|
||||
|
||||
# Release with the same Go toolchain the published image is built with
|
||||
- name: Resolve Go version
|
||||
id: go-version
|
||||
run: |
|
||||
# Assign first so a failed lookup trips `set -e`; inside echo its exit
|
||||
# status would be discarded and an empty version written.
|
||||
version=$(.github/scripts/go-version.sh Dockerfile)
|
||||
echo "version=$version" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7
|
||||
with:
|
||||
go-version-file: "go.mod"
|
||||
go-version: ${{ steps.go-version.outputs.version }}
|
||||
|
||||
- name: Run GoReleaser
|
||||
uses: goreleaser/goreleaser-action@ec59f474b9834571250b370d4735c50f8e2d1e29 # v7
|
||||
|
||||
Reference in New Issue
Block a user