Skip to content

Commit 0e909d4

Browse files
committed
enable cgo
1 parent c23f474 commit 0e909d4

File tree

7 files changed

+18
-13
lines changed

7 files changed

+18
-13
lines changed

cmd/goreleaser/internal/configure.go

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,7 @@ var (
155155
d.containerImageManifests = slices.Concat(
156156
newContainerImageManifests(d.name, "linux", ebpfProfilerArchs, containerImageOptions{}),
157157
)
158+
d.enableCgo = true
158159
}).WithDefaultArchives().WithDefaultChecksum().WithDefaultSigns().WithDefaultDockerSigns().WithDefaultSBOMs().Build()
159160
)
160161

@@ -399,6 +400,7 @@ type distribution struct {
399400
dockerSigns []config.Sign
400401
sboms []config.SBOM
401402
checksum config.Checksum
403+
enableCgo bool
402404
}
403405

404406
func (d *distribution) BuildProject() config.Project {
@@ -407,18 +409,22 @@ func (d *distribution) BuildProject() config.Project {
407409
builds = append(builds, buildConfig.Build(d.name))
408410
}
409411

412+
env := []string{
413+
"COSIGN_YES=true",
414+
"LD_FLAGS=-s -w",
415+
"BUILD_FLAGS=-trimpath",
416+
}
417+
if !d.enableCgo {
418+
env = append(env, "CGO_ENABLED=0")
419+
}
420+
410421
return config.Project{
411422
ProjectName: "opentelemetry-collector-releases",
412423
Release: config.Release{
413424
ReplaceExistingArtifacts: true,
414425
},
415-
Checksum: d.checksum,
416-
Env: []string{
417-
"COSIGN_YES=true",
418-
"LD_FLAGS=-s -w",
419-
"CGO_ENABLED=0",
420-
"BUILD_FLAGS=-trimpath",
421-
},
426+
Checksum: d.checksum,
427+
Env: env,
422428
Builds: builds,
423429
Archives: d.archives,
424430
MSI: d.msiConfig,

distributions/otelcol-contrib/.goreleaser-build.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ project_name: opentelemetry-collector-releases
33
env:
44
- COSIGN_YES=true
55
- LD_FLAGS=-s -w
6-
- CGO_ENABLED=0
76
- BUILD_FLAGS=-trimpath
7+
- CGO_ENABLED=0
88
release:
99
replace_existing_artifacts: true
1010
builds:

distributions/otelcol-contrib/.goreleaser.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ project_name: opentelemetry-collector-releases
33
env:
44
- COSIGN_YES=true
55
- LD_FLAGS=-s -w
6-
- CGO_ENABLED=0
76
- BUILD_FLAGS=-trimpath
7+
- CGO_ENABLED=0
88
release:
99
replace_existing_artifacts: true
1010
msi:

distributions/otelcol-ebpf-profiler/.goreleaser.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ project_name: opentelemetry-collector-releases
33
env:
44
- COSIGN_YES=true
55
- LD_FLAGS=-s -w
6-
- CGO_ENABLED=0
76
- BUILD_FLAGS=-trimpath
87
release:
98
replace_existing_artifacts: true

distributions/otelcol-k8s/.goreleaser.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ project_name: opentelemetry-collector-releases
33
env:
44
- COSIGN_YES=true
55
- LD_FLAGS=-s -w
6-
- CGO_ENABLED=0
76
- BUILD_FLAGS=-trimpath
7+
- CGO_ENABLED=0
88
release:
99
replace_existing_artifacts: true
1010
builds:

distributions/otelcol-otlp/.goreleaser.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ project_name: opentelemetry-collector-releases
33
env:
44
- COSIGN_YES=true
55
- LD_FLAGS=-s -w
6-
- CGO_ENABLED=0
76
- BUILD_FLAGS=-trimpath
7+
- CGO_ENABLED=0
88
release:
99
replace_existing_artifacts: true
1010
msi:

distributions/otelcol/.goreleaser.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ project_name: opentelemetry-collector-releases
33
env:
44
- COSIGN_YES=true
55
- LD_FLAGS=-s -w
6-
- CGO_ENABLED=0
76
- BUILD_FLAGS=-trimpath
7+
- CGO_ENABLED=0
88
release:
99
replace_existing_artifacts: true
1010
msi:

0 commit comments

Comments
 (0)