From d53204dfb63b182ab116d99eb32a78f0b962dd97 Mon Sep 17 00:00:00 2001 From: Bence Csati Date: Thu, 21 Nov 2024 15:10:47 +0100 Subject: [PATCH] fix: handle breaking changes around arm64 Signed-off-by: Bence Csati --- .github/workflows/base-ci-goreleaser.yaml | 4 +-- .github/workflows/base-release.yaml | 6 ++-- cmd/goreleaser/internal/configure.go | 30 +++++++++++++++---- .../axoflow-otel-collector/.goreleaser.yaml | 6 ++-- 4 files changed, 33 insertions(+), 13 deletions(-) diff --git a/.github/workflows/base-ci-goreleaser.yaml b/.github/workflows/base-ci-goreleaser.yaml index 81f1368e..f18dae23 100644 --- a/.github/workflows/base-ci-goreleaser.yaml +++ b/.github/workflows/base-ci-goreleaser.yaml @@ -14,7 +14,7 @@ on: type: string env: - GORELEASER_PRO_VERSION: v2.4.1 + GORELEASER_PRO_VERSION: v2.4.7 jobs: check-goreleaser: @@ -60,7 +60,7 @@ jobs: uses: goreleaser/goreleaser-action@v6 with: distribution: goreleaser-pro - version: v2.3.2 + version: ${{ env.GORELEASER_PRO_VERSION }} workdir: distributions/${{ inputs.distribution }} args: --snapshot --clean --skip=sign,sbom --timeout 2h --split env: diff --git a/.github/workflows/base-release.yaml b/.github/workflows/base-release.yaml index d7f97695..d7a0bffd 100644 --- a/.github/workflows/base-release.yaml +++ b/.github/workflows/base-release.yaml @@ -14,7 +14,7 @@ on: type: string env: - GORELEASER_PRO_VERSION: v2.4.1 + GORELEASER_PRO_VERSION: v2.4.7 jobs: prepare: @@ -77,7 +77,7 @@ jobs: uses: goreleaser/goreleaser-action@v6 with: distribution: goreleaser-pro - version: v2.3.2 + version: ${{ env.GORELEASER_PRO_VERSION }} workdir: distributions/${{ inputs.distribution }} args: release --clean --split --timeout 2h env: @@ -152,7 +152,7 @@ jobs: uses: goreleaser/goreleaser-action@v6 with: distribution: goreleaser-pro - version: v2.3.2 + version: ${{ env.GORELEASER_PRO_VERSION }} workdir: distributions/${{ inputs.distribution }} args: continue --merge --timeout 2h env: diff --git a/cmd/goreleaser/internal/configure.go b/cmd/goreleaser/internal/configure.go index 2c28bb78..cc4fb6cf 100644 --- a/cmd/goreleaser/internal/configure.go +++ b/cmd/goreleaser/internal/configure.go @@ -29,6 +29,7 @@ import ( const ( ArmArch = "arm" + Arm64Arch = "arm64" CoreDistro = "otelcol" ImageName = "axoflow-otel-collector" ) @@ -36,6 +37,7 @@ const ( var ( ImagePrefixes = []string{"ghcr.io/axoflow/axoflow-otel-collector"} Architectures = []string{"amd64", "arm64"} + Arm64Versions = []string{"v8.0"} Goos = []string{"linux", "windows"} DefaultConfigDists = map[string]bool{ImageName: true} MSIWindowsDists = map[string]bool{ImageName: true} @@ -88,8 +90,9 @@ func Build(dist string) config.Build { Flags: []string{"-trimpath"}, Ldflags: []string{"-s", "-w"}, }, - Goos: Goos, - Goarch: Architectures, + Goos: Goos, + Goarch: Architectures, + Goarm64: Arm64Versions, Ignore: []config.IgnoredBuild{ {Goos: "windows", Goarch: "arm64"}, }, @@ -256,10 +259,21 @@ func DockerManifests(dist string) []config.DockerManifest { func DockerManifest(prefix, version, dist string) config.DockerManifest { var imageTemplates []string for _, arch := range Architectures { - imageTemplates = append( - imageTemplates, - fmt.Sprintf("%s/%s:%s-%s", prefix, imageName(dist), version, arch), - ) + switch arch { + case Arm64Arch: + for _, arm64Vers := range Arm64Versions { + dockerArchTag := strings.ReplaceAll(arch64Name(arch, arm64Vers), "/", "_") + imageTemplates = append( + imageTemplates, + fmt.Sprintf("%s/%s:%s-%s", prefix, imageName(dist), version, dockerArchTag), + ) + } + default: + imageTemplates = append( + imageTemplates, + fmt.Sprintf("%s/%s:%s-%s", prefix, imageName(dist), version, arch), + ) + } } return config.DockerManifest{ @@ -283,6 +297,10 @@ func archName(arch, armVersion string) string { } } +func arch64Name(arch, arm64Version string) string { + return fmt.Sprintf("%s/%s", arch, arm64Version) +} + func Sign() []config.Sign { return []config.Sign{ { diff --git a/distributions/axoflow-otel-collector/.goreleaser.yaml b/distributions/axoflow-otel-collector/.goreleaser.yaml index b83b6508..bcd32f0e 100644 --- a/distributions/axoflow-otel-collector/.goreleaser.yaml +++ b/distributions/axoflow-otel-collector/.goreleaser.yaml @@ -18,6 +18,8 @@ builds: goarch: - amd64 - arm64 + goarm64: + - v8.0 ignore: - goos: windows goarch: arm64 @@ -106,11 +108,11 @@ docker_manifests: - name_template: ghcr.io/axoflow/axoflow-otel-collector/axoflow-otel-collector:{{ .Version }} image_templates: - ghcr.io/axoflow/axoflow-otel-collector/axoflow-otel-collector:{{ .Version }}-amd64 - - ghcr.io/axoflow/axoflow-otel-collector/axoflow-otel-collector:{{ .Version }}-arm64 + - ghcr.io/axoflow/axoflow-otel-collector/axoflow-otel-collector:{{ .Version }}-arm64_v8.0 - name_template: ghcr.io/axoflow/axoflow-otel-collector/axoflow-otel-collector:latest image_templates: - ghcr.io/axoflow/axoflow-otel-collector/axoflow-otel-collector:latest-amd64 - - ghcr.io/axoflow/axoflow-otel-collector/axoflow-otel-collector:latest-arm64 + - ghcr.io/axoflow/axoflow-otel-collector/axoflow-otel-collector:latest-arm64_v8.0 signs: - cmd: cosign args: