Skip to content

Commit

Permalink
another try
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 11, 2024
1 parent bdd7a46 commit 9380631
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 12 deletions.
21 changes: 12 additions & 9 deletions cmd/goreleaser/internal/configure.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,14 @@ 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_{{ .Target }}%s/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 {
Expand All @@ -129,16 +134,14 @@ func Build(dist string, buildOrRest bool, pie bool) config.Build {
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(goos, archs, pie),
NoUniqueDistDir: "true",
Goos: goos,
Goarch: archs,
Goarm: ArmVersions(dist),
Dir: "_build",
Binary: dist,
Ignore: generateIgnored(goos, archs, pie),
}
}

Expand Down
4 changes: 1 addition & 3 deletions distributions/otelcol-contrib/.goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,8 @@ builds:
dir: _build
binary: otelcol-contrib
builder: prebuilt
no_unique_dist_dir: "true"
prebuilt:
path: artifacts/otelcol-contrib_{{ .Target }}/otelcol-contrib{{- if eq .Os "windows" }}.exe{{ end }}
path: artifacts/otelcol-contrib_{{ .Target }}-pie/otelcol-contrib{{- if eq .Os "windows" }}.exe{{ end }}
- id: otelcol-contrib
goos:
- darwin
Expand Down Expand Up @@ -99,7 +98,6 @@ builds:
dir: _build
binary: otelcol-contrib
builder: prebuilt
no_unique_dist_dir: "true"
prebuilt:
path: artifacts/otelcol-contrib_{{ .Target }}/otelcol-contrib{{- if eq .Os "windows" }}.exe{{ end }}
archives:
Expand Down

0 comments on commit 9380631

Please sign in to comment.