Skip to content

[SDK-2337] Upgrade GoReleaser to v2.15 and simplify config with dockers_v2#661

Draft
aaron-zeisler wants to merge 4 commits into
v8from
aaronz/SDK-2337/upgrade-goreleaser
Draft

[SDK-2337] Upgrade GoReleaser to v2.15 and simplify config with dockers_v2#661
aaron-zeisler wants to merge 4 commits into
v8from
aaronz/SDK-2337/upgrade-goreleaser

Conversation

@aaron-zeisler
Copy link
Copy Markdown
Contributor

@aaron-zeisler aaron-zeisler commented May 8, 2026

Summary

  • Upgrade GoReleaser from v2.11.2 to v2.15.4
  • Replace legacy dockers + docker_manifests (51 entries) with dockers_v2 (3 entries)
  • Reduce .goreleaser.yml from 529 lines to 117 lines (77% reduction)

Motivation

The current GoReleaser config is 529 lines, with the vast majority being repetitive Docker image/manifest definitions (36 dockers entries + 15 docker_manifests entries). GoReleaser v2.12 introduced dockers_v2, which uses docker buildx natively to build multi-arch manifests in a single step — eliminating the need to separately define per-architecture images and then wire them together in manifests.

This is an alternative to fully replacing GoReleaser (see #660). Instead of removing GoReleaser, this approach upgrades it and leverages new features to achieve the same goal of simplification.

Changes

File Description
.goreleaser.yml Rewritten: 529 → 117 lines. Uses dockers_v2 with conditional tag templates
Dockerfile.goreleaser Use ARG TARGETPLATFORM + COPY ${TARGETPLATFORM}/ld-relay
Dockerfile-static-debian12-nonroot.goreleaser Same
Dockerfile-static-debian12-debug-nonroot.goreleaser Same
.github/actions/publish/action.yml Pin GoReleaser ~> v2.15, update artifact digest query
scripts/run-goreleaser.sh v2.11.2v2.15.4

How dockers_v2 simplifies things

Before (legacy): Each Docker tag × architecture × variant required its own entry, with manual skip_push conditionals. Manifests were separately wired to reference the per-arch images by tag name.

After (dockers_v2): One entry per Dockerfile variant. Tags use Go template conditionals (empty tags are ignored). GoReleaser + buildx handle multi-arch manifest creation automatically.

# Example: the Alpine variant — replaces 12 dockers entries + 6 docker_manifests entries
- id: alpine
  dockerfile: Dockerfile.goreleaser
  images:
    - "launchdarkly/ld-relay"
  tags:
    - "{{ .Version }}"
    - "{{ .Version }}-alpine"
    - '{{ if eq .Env.LD_RELEASER_UPDATE_MAJOR "true" }}v{{ .Major }}{{ end }}'
    - '{{ if eq .Env.LD_RELEASER_UPDATE_MAJOR "true" }}v{{ .Major }}-alpine{{ end }}'
    - '{{ if eq .Env.LD_RELEASER_UPDATE_LATEST "true" }}latest{{ end }}'
    - '{{ if eq .Env.LD_RELEASER_UPDATE_LATEST "true" }}latest-alpine{{ end }}'
  platforms:
    - linux/amd64
    - linux/arm64
    - linux/arm/v7
    - linux/386

Other cleanup

  • Removed dead ldflags (-X internal.version.Version={{.Version}} has no effect since Version is a const, not a var)
  • Updated artifact digest query to handle both "Docker Manifest" and "Docker Image" artifact types

Test plan

  • Verify GoReleaser v2.15 passes goreleaser check on the new config
  • Dry-run in CI to confirm binary/package builds still work
  • Verify Docker image tags match existing naming conventions
  • Confirm attestation output (images_and_digests) is correctly populated
  • Test snapshot mode locally: goreleaser release --snapshot --clean

Note

dockers_v2 is currently marked as experimental in GoReleaser and will become the default dockers in v3. The legacy dockers + docker_manifests will be deprecated at that point.

JIRA

SDK-2337

Made with Cursor

aaron-zeisler and others added 4 commits May 8, 2026 08:18
…rs_v2

Replace the legacy dockers + docker_manifests configuration (36 image
entries + 15 manifest entries) with the new dockers_v2 feature that
handles multi-arch manifest creation natively via docker buildx.

- Upgrade GoReleaser from v2.11.2 to v2.15.4
- Reduce .goreleaser.yml from 529 lines to 117 lines (77% reduction)
- Use conditional tag templates instead of per-entry skip_push
- Update Dockerfiles to use $TARGETPLATFORM for binary paths
- Remove dead ldflags -X injection (Version is a const, not var)
- Pin GoReleaser version ~> v2.15 in GitHub Actions

Tracked by SDK-2337.

Co-authored-by: Cursor <cursoragent@cursor.com>
…ge builds

dockers_v2 builds multi-arch manifests via buildx, which can't --load
into the local Docker daemon. The Docker Scout scan needs per-arch
images available locally (e.g. ld-relay:8.19.1-amd64).

Fix: use --snapshot mode for products-for-release, which causes
GoReleaser to "explode" dockers_v2 into individual per-platform builds
with --load and arch-suffixed tags. Add snapshot.version_template to
preserve the current version string (instead of GoReleaser's default
patch-increment behavior).

Co-authored-by: Cursor <cursoragent@cursor.com>
…templates

The dockers_v2 tag templates reference LD_RELEASER_UPDATE_MAJOR and
LD_RELEASER_UPDATE_LATEST env vars. These are only set during the
publish workflow but not during the CI security scan. GoReleaser's
template engine fails with 'map has no entry for key' if they're
missing.

Set both to 'false' in the products-for-release target since we
don't need major/latest tags for local CI builds.

Co-authored-by: Cursor <cursoragent@cursor.com>
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.

1 participant