Skip to content

Commit

Permalink
fix: handle breaking changes around arm64
Browse files Browse the repository at this point in the history
Signed-off-by: Bence Csati <[email protected]>
  • Loading branch information
csatib02 committed Nov 21, 2024
1 parent 300b29b commit d53204d
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 13 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/base-ci-goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ on:
type: string

env:
GORELEASER_PRO_VERSION: v2.4.1
GORELEASER_PRO_VERSION: v2.4.7

jobs:
check-goreleaser:
Expand Down Expand Up @@ -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:
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/base-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ on:
type: string

env:
GORELEASER_PRO_VERSION: v2.4.1
GORELEASER_PRO_VERSION: v2.4.7

jobs:
prepare:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down
30 changes: 24 additions & 6 deletions cmd/goreleaser/internal/configure.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,15 @@ import (

const (
ArmArch = "arm"
Arm64Arch = "arm64"
CoreDistro = "otelcol"
ImageName = "axoflow-otel-collector"
)

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}
Expand Down Expand Up @@ -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"},
},
Expand Down Expand Up @@ -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{
Expand All @@ -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{
{
Expand Down
6 changes: 4 additions & 2 deletions distributions/axoflow-otel-collector/.goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ builds:
goarch:
- amd64
- arm64
goarm64:
- v8.0
ignore:
- goos: windows
goarch: arm64
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit d53204d

Please sign in to comment.