Skip to content

Commit

Permalink
fixes after rebasing
Browse files Browse the repository at this point in the history
Signed-off-by: Moritz Wiesinger <moritz.wiesinger@dynatrace.com>
  • Loading branch information
mowies committed Dec 12, 2024
1 parent e8449ae commit d4f0414
Show file tree
Hide file tree
Showing 3 changed files with 74 additions and 17 deletions.
19 changes: 10 additions & 9 deletions cmd/goreleaser/internal/configure.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,26 +118,30 @@ func Build(dist string, buildOrRest bool, pie bool) config.Build {
archs := Architectures
id := dist
ldflags := []string{"-s", "-w"}
var prebuiltPath string

if pie {
ldflags = append(ldflags, "-buildmode=pie")
id = id + "-pie"
prebuiltPath = fmt.Sprintf("artifacts/otelcol-contrib%s_{{ .Target }}/otelcol-contrib{{- if eq .Os \"windows\" }}.exe{{ end }}", "-pie")
} else {
prebuiltPath = "artifacts/otelcol-contrib_{{ .Target }}/otelcol-contrib{{- if eq .Os \"windows\" }}.exe{{ end }}"
}

if dist == ContribDistro && !buildOrRest {
// only return build config for contrib build file
return config.Build{
ID: dist,
ID: id,
Builder: "prebuilt",
PreBuilt: config.PreBuiltOptions{
Path: "artifacts/otelcol-contrib_{{ .Target }}" +
"/otelcol-contrib{{- if eq .Os \"windows\" }}.exe{{ end }}",
Path: prebuiltPath,
},
Goos: goos,
Goarch: archs,
Goarm: ArmVersions(dist),
Dir: "_build",
Binary: dist,
Ignore: generateIgnored(dist, goos, archs, pie),
Ignore: generateIgnored(goos, archs, pie),
}
}

Expand All @@ -158,14 +162,11 @@ func Build(dist string, buildOrRest bool, pie bool) config.Build {
Goos: goos,
Goarch: archs,
Goarm: ArmVersions(dist),
Ignore: IgnoreBuildCombinations(dist),
Ignore: generateIgnored(goos, archs, pie),
}
}

func generateIgnored(dist string, goos, archs []string, pie bool) []config.IgnoredBuild {
if dist == K8sDistro {
return nil
}
func generateIgnored(goos, archs []string, pie bool) []config.IgnoredBuild {
ignored := make([]config.IgnoredBuild, 0)
var build config.IgnoredBuild
for _, goos := range goos {
Expand Down
61 changes: 61 additions & 0 deletions distributions/otelcol-contrib/.goreleaser-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,53 @@ partial:
version: 2
project_name: opentelemetry-collector-releases
builds:
- id: otelcol-contrib-pie
goos:
- darwin
- linux
- windows
goarch:
- "386"
- amd64
- arm
- arm64
- ppc64le
- s390x
goarm:
- "7"
ignore:
- goos: darwin
goarch: "386"
- goos: darwin
goarch: arm
- goos: darwin
goarch: ppc64le
- goos: darwin
goarch: s390x
- goos: linux
goarch: "386"
- goos: linux
goarch: arm
- goos: linux
goarch: s390x
- goos: windows
goarch: arm
- goos: windows
goarch: arm64
- goos: windows
goarch: ppc64le
- goos: windows
goarch: s390x
dir: _build
binary: otelcol-contrib
ldflags:
- -s
- -w
- -buildmode=pie
flags:
- -trimpath
env:
- CGO_ENABLED=0
- id: otelcol-contrib
goos:
- darwin
Expand All @@ -20,10 +67,24 @@ builds:
ignore:
- goos: darwin
goarch: "386"
- goos: darwin
goarch: amd64
- goos: darwin
goarch: arm
- goos: darwin
goarch: arm64
- goos: darwin
goarch: s390x
- goos: linux
goarch: amd64
- goos: linux
goarch: arm64
- goos: linux
goarch: ppc64le
- goos: windows
goarch: "386"
- goos: windows
goarch: amd64
- goos: windows
goarch: arm
- goos: windows
Expand Down
11 changes: 3 additions & 8 deletions distributions/otelcol-contrib/.goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,9 @@ builds:
goarch: s390x
dir: _build
binary: otelcol-contrib
ldflags:
- -s
- -w
- -buildmode=pie
flags:
- -trimpath
env:
- CGO_ENABLED=0
builder: prebuilt
prebuilt:
path: artifacts/otelcol-contrib-pie_{{ .Target }}/otelcol-contrib{{- if eq .Os "windows" }}.exe{{ end }}
- id: otelcol-contrib
goos:
- darwin
Expand Down

0 comments on commit d4f0414

Please sign in to comment.