Skip to content

Commit

Permalink
fix: Disable CGO for supervisor and agent builds (#1972)
Browse files Browse the repository at this point in the history
* Disable CGO for supervisor and agent builds

* Consolidate CGO_ENABLED=0 flag
  • Loading branch information
mrsillydog authored Nov 18, 2024
1 parent d55bf5c commit 682cae5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ VERSION ?= $(if $(CURRENT_TAG),$(CURRENT_TAG),$(PREVIOUS_TAG))
# Builds the agent for current GOOS/GOARCH pair
.PHONY: agent
agent:
builder --config="./manifests/observIQ/manifest.yaml" --ldflags "-s -w -X github.com/observiq/bindplane-agent/internal/version.version=$(VERSION)"
CGO_ENABLED=0 builder --config="./manifests/observIQ/manifest.yaml" --ldflags "-s -w -X github.com/observiq/bindplane-agent/internal/version.version=$(VERSION)"
mkdir -p $(OUTDIR); cp ./builder/observiq-otel-collector $(OUTDIR)/collector_$(GOOS)_$(GOARCH)$(EXT)

# Builds a custom distro for the current GOOS/GOARCH pair using the manifest specified
Expand All @@ -45,7 +45,7 @@ distro:
# Builds the updater for current GOOS/GOARCH pair && sets flags
.PHONY: updater
updater:
cd ./updater/; go build -ldflags "-s -w\
cd ./updater/; CGO_ENABLED=0 go build -ldflags "-s -w\
-X 'github.com/observiq/bindplane-agent/updater/internal/version.version=$(VERSION)'\
-X 'github.com/observiq/bindplane-agent/updater/internal/version.gitHash=$(shell git rev-parse HEAD)'\
-X 'github.com/observiq/bindplane-agent/updater/internal/version.date=$(shell date -u +"%Y-%m-%dT%H:%M:%SZ")'"\
Expand Down
2 changes: 1 addition & 1 deletion buildscripts/download-dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,6 @@ for PLATFORM in "${PLATFORMS[@]}"; do
EXT=""
fi
echo "Building supervisor for $GOOS/$GOARCH"
GOOS="$GOOS" GOARCH="$GOARCH" go build -o $PROJECT_BASE/$DOWNLOAD_DIR/supervisor_bin/opampsupervisor_${GOOS}_${GOARCH}${EXT} .
GOOS="$GOOS" GOARCH="$GOARCH" CGO_ENABLED=0 go build -o $PROJECT_BASE/$DOWNLOAD_DIR/supervisor_bin/opampsupervisor_${GOOS}_${GOARCH}${EXT} .
done
$(cd $PROJECT_BASE/$DOWNLOAD_DIR && rm -rf opentelemetry-collector-contrib)

0 comments on commit 682cae5

Please sign in to comment.