Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: handle breaking changes around arm64 #34

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
43 changes: 35 additions & 8 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 @@ -194,7 +197,14 @@ func Package(dist string) config.NFPM {
func DockerImages(dist string) []config.Docker {
r := make([]config.Docker, 0)
for _, arch := range Architectures {
r = append(r, DockerImage(dist, arch, ""))
switch arch {
case Arm64Arch:
for _, vers := range Arm64Versions {
r = append(r, DockerImage(dist, arch, vers))
}
default:
r = append(r, DockerImage(dist, arch, ""))
}
}
return r
}
Expand All @@ -203,9 +213,13 @@ func DockerImages(dist string) []config.Docker {
// https://goreleaser.com/customization/docker/
func DockerImage(dist, arch, armVersion string) config.Docker {
dockerArchName := archName(arch, armVersion)
dockerArchTag := dockerArchName
imageTemplates := make([]string, 0)
for _, prefix := range ImagePrefixes {
dockerArchTag := strings.ReplaceAll(dockerArchName, "/", "")
switch arch {
case Arm64Arch:
dockerArchTag = strings.ReplaceAll(dockerArchName, "/", "_")
}
imageTemplates = append(
imageTemplates,
fmt.Sprintf("%s/%s:{{ .Version }}-%s", prefix, imageName(dist), dockerArchTag),
Expand Down Expand Up @@ -256,10 +270,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(archName(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 @@ -278,6 +303,8 @@ func archName(arch, armVersion string) string {
switch arch {
case ArmArch:
return fmt.Sprintf("%s/v%s", arch, armVersion)
case Arm64Arch:
return fmt.Sprintf("%s/%s", arch, armVersion)
default:
return arch
}
Expand Down
13 changes: 8 additions & 5 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 @@ -86,15 +88,16 @@ dockers:
use: buildx
- goos: linux
goarch: arm64
goarm: v8.0
dockerfile: Dockerfile
image_templates:
- ghcr.io/axoflow/axoflow-otel-collector/axoflow-otel-collector:{{ .Version }}-arm64
- ghcr.io/axoflow/axoflow-otel-collector/axoflow-otel-collector:latest-arm64
- ghcr.io/axoflow/axoflow-otel-collector/axoflow-otel-collector:{{ .Version }}-arm64_v8.0
- ghcr.io/axoflow/axoflow-otel-collector/axoflow-otel-collector:latest-arm64_v8.0
extra_files:
- config.yaml
build_flag_templates:
- --pull
- --platform=linux/arm64
- --platform=linux/arm64/v8.0
- --label=org.opencontainers.image.created={{.Date}}
- --label=org.opencontainers.image.name={{.ProjectName}}
- --label=org.opencontainers.image.revision={{.FullCommit}}
Expand All @@ -106,11 +109,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
Loading