Skip to content

Commit

Permalink
minor refactoring
Browse files Browse the repository at this point in the history
Signed-off-by: Moritz Wiesinger <[email protected]>
  • Loading branch information
mowies committed Nov 25, 2024
1 parent ffb1420 commit 9dda072
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
12 changes: 7 additions & 5 deletions cmd/goreleaser/internal/configure.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,29 +92,31 @@ func Builds(dist string, buildOrRest bool) []config.Build {
// Build configures a goreleaser build.
// https://goreleaser.com/customization/build/
func Build(dist string, buildOrRest bool) config.Build {
if !buildOrRest && dist == ContribDistro {
goos := []string{"darwin", "linux", "windows"}
archs := Architectures

if dist == ContribDistro && !buildOrRest {
// only return build config for contrib build file
return config.Build{
ID: dist,
Builder: "prebuilt",
PreBuilt: config.PreBuiltOptions{
Path: "artifacts/otelcol-contrib_{{ .Os }}_{{ .Arch }}{{ with .Amd64 }}_{{ . }}{{ end }}{{ with .Arm }}_{{ . }}{{ end }}{{ with .Mips }}_{{ . }}{{ end }}/otelcol-contrib{{- if eq .Os \"windows\" }}.exe{{ end }}",
},
Goos: []string{"darwin", "linux", "windows"},
Goarch: Architectures,
Goos: goos,
Goarch: archs,
Goarm: ArmVersions(dist),
Dir: "_build",
Binary: dist,
Ignore: IgnoreBuildCombinations(dist),
}
}

goos := []string{"darwin", "linux", "windows"}
archs := Architectures
if dist == K8sDistro {
goos = K8sGoos
archs = K8sArchs
}

return config.Build{
ID: dist,
Dir: "_build",
Expand Down
2 changes: 1 addition & 1 deletion cmd/goreleaser/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import (
)

var distFlag = flag.String("d", "", "Collector distributions to build")
var contribBuildOrRestFlag = flag.Bool("b", false, "Collector Contrib distribution only - switch between build and package config file - set to true to generate build step, false to generate pacakge step")
var contribBuildOrRestFlag = flag.Bool("b", false, "Collector Contrib distribution only - switch between build and package config file - set to true to generate build step, false to generate package step")

func main() {
flag.Parse()
Expand Down

0 comments on commit 9dda072

Please sign in to comment.