From 77fba860d63b9efa7133a5162eafd1cb1439c680 Mon Sep 17 00:00:00 2001 From: Robert Fratto Date: Fri, 22 Mar 2024 18:43:39 -0400 Subject: [PATCH] build: temporarily remove boringcrypto (#63) Temporarily remove boringcrypto builds as we need time to figure out what boringcrypto support looks like in Alloy and how we deliver release assets for boringcrypto builds. --- .drone/drone.yml | 53 +---------------------- .drone/pipelines/crosscompile.jsonnet | 22 +--------- .drone/pipelines/publish.jsonnet | 5 +-- Makefile | 62 ++++++++------------------- tools/ci/docker-containers | 20 +-------- tools/make/packaging.mk | 24 +---------- 6 files changed, 25 insertions(+), 161 deletions(-) diff --git a/.drone/drone.yml b/.drone/drone.yml index 59fc5df03c..a8a40627e9 100644 --- a/.drone/drone.yml +++ b/.drone/drone.yml @@ -252,57 +252,6 @@ trigger: type: docker --- kind: pipeline -name: Build agent-boringcrypto (Linux amd64 boringcrypto) -platform: - arch: amd64 - os: linux -steps: -- commands: - - make generate-ui - - GO_TAGS="builtinassets promtail_journal_enabled" GOOS=linux GOARCH=amd64 GOARM= - GOEXPERIMENT=boringcrypto make agent-boringcrypto - image: grafana/agent-build-image:0.40.2 - name: Build -trigger: - event: - - pull_request -type: docker ---- -kind: pipeline -name: Build agent-boringcrypto (Linux arm64 boringcrypto) -platform: - arch: amd64 - os: linux -steps: -- commands: - - make generate-ui - - GO_TAGS="builtinassets promtail_journal_enabled" GOOS=linux GOARCH=arm64 GOARM= - GOEXPERIMENT=boringcrypto make agent-boringcrypto - image: grafana/agent-build-image:0.40.2 - name: Build -trigger: - event: - - pull_request -type: docker ---- -kind: pipeline -name: Build agent-windows-boringcrypto (Windows amd64) -platform: - arch: amd64 - os: linux -steps: -- commands: - - make generate-ui - - GO_TAGS="builtinassets" GOOS=windows GOARCH=amd64 GOARM= GOEXPERIMENT=cngcrypto - make agent-windows-boringcrypto - image: grafana/agent-build-image:0.40.2-boringcrypto - name: Build -trigger: - event: - - pull_request -type: docker ---- -kind: pipeline name: Publish development Linux agent container platform: arch: amd64 @@ -450,6 +399,6 @@ kind: secret name: updater_private_key --- kind: signature -hmac: eb4c87d4abc880513c7c2977c46910fa96041461aa2edea16a7970f5c145dd01 +hmac: 2088d828b5aeec4f38008f932b1402a03745e941ba06c6c4d72a96d42dfb7f01 ... diff --git a/.drone/pipelines/crosscompile.jsonnet b/.drone/pipelines/crosscompile.jsonnet index 58c28575ad..b516ffcb79 100644 --- a/.drone/pipelines/crosscompile.jsonnet +++ b/.drone/pipelines/crosscompile.jsonnet @@ -32,24 +32,6 @@ local targets = [ 'agent', ]; -local targets_boringcrypto = [ - 'agent-boringcrypto', -]; -local targets_boringcrypto_windows = [ - 'agent-windows-boringcrypto', -]; - - -local os_arch_types_boringcrypto = [ - // Linux boringcrypto - { name: 'Linux amd64 boringcrypto', os: 'linux', arch: 'amd64', experiment: 'boringcrypto' }, - { name: 'Linux arm64 boringcrypto', os: 'linux', arch: 'arm64', experiment: 'boringcrypto' }, -]; -local windows_os_arch_types_boringcrypto = [ - // Windows boringcrypto - { name: 'Windows amd64', os: 'windows', arch: 'amd64', experiment: 'cngcrypto' }, -]; - local build_environments(targets, tuples, image) = std.flatMap(function(target) ( std.map(function(platform) ( pipelines.linux('Build %s (%s)' % [target, platform.name]) { @@ -81,6 +63,4 @@ local build_environments(targets, tuples, image) = std.flatMap(function(target) ), tuples) ), targets); -build_environments(targets, os_arch_tuples, build_image.linux) + -build_environments(targets_boringcrypto, os_arch_types_boringcrypto, build_image.linux) + -build_environments(targets_boringcrypto_windows, windows_os_arch_types_boringcrypto, build_image.boringcrypto) +build_environments(targets, os_arch_tuples, build_image.linux) diff --git a/.drone/pipelines/publish.jsonnet b/.drone/pipelines/publish.jsonnet index 7501017ac3..e81d4386de 100644 --- a/.drone/pipelines/publish.jsonnet +++ b/.drone/pipelines/publish.jsonnet @@ -6,8 +6,7 @@ local ghTokenFilename = '/drone/src/gh-token.txt'; // job_names gets the list of job names for use in depends_on. local job_names = function(jobs) std.map(function(job) job.name, jobs); -local linux_containers = ['agent', 'agent-boringcrypto']; -local dev_linux_containers = ['agent']; // TODO(rfratto): add boringcrypto after figuring out what to do with it +local linux_containers = ['agent']; local linux_containers_dev_jobs = std.map(function(container) ( pipelines.linux('Publish development Linux %s container' % container) { @@ -59,7 +58,7 @@ local linux_containers_dev_jobs = std.map(function(container) ( host: { path: '/var/run/docker.sock' }, }], } -), dev_linux_containers); +), linux_containers); local linux_containers_jobs = std.map(function(container) ( diff --git a/Makefile b/Makefile index b369f6bec9..5fd875edc9 100644 --- a/Makefile +++ b/Makefile @@ -23,15 +23,12 @@ ## ## binaries Compiles all binaries. ## agent Compiles cmd/grafana-agent to $(AGENT_BINARY) -## agent-boringcrypto Compiles cmd/grafana-agent with GOEXPERIMENT=boringcrypto to $(AGENT_BORINGCRYPTO_BINARY) -## agent-windows-boringcrypto Compiles cmd/grafana-agent to $(AGENT_BORINGCRYPTO_BINARY) ## agent-service Compiles cmd/grafana-agent-service to $(SERVICE_BINARY) ## ## Targets for building Docker images: ## ## images Builds all Docker images. ## agent-image Builds agent Docker image. -## agent-boringcrypto-image Builds agent Docker image with boringcrypto. ## ## Targets for packaging: ## @@ -60,30 +57,25 @@ ## ## Environment variables: ## -## USE_CONTAINER Set to 1 to enable proxying commands to build container -## AGENT_IMAGE Image name:tag built by `make agent-image` -## BUILD_IMAGE Image name:tag used by USE_CONTAINER=1 -## AGENT_BINARY Output path of `make agent` (default build/grafana-agent) -## AGENT_BORINGCRYPTO_BINARY Output path of `make agent-boringcrypto` (default build/grafana-agent-boringcrypto) -## AGENT_BORINGCRYPTO_WINDOWS_BINARY Output path of `make agent-windows-boringcrypto` (default build/grafana-agent-windows-boringcrypto.exe) -## SERVICE_BINARY Output path of `make agent-service` (default build/grafana-agent-service) -## GOOS Override OS to build binaries for -## GOARCH Override target architecture to build binaries for -## GOARM Override ARM version (6 or 7) when GOARCH=arm -## CGO_ENABLED Set to 0 to disable Cgo for binaries. -## RELEASE_BUILD Set to 1 to build release binaries. -## VERSION Version to inject into built binaries. -## GO_TAGS Extra tags to use when building. -## DOCKER_PLATFORM Overrides platform to build Docker images for (defaults to host platform). -## GOEXPERIMENT Used to enable features, most likely boringcrypto via GOEXPERIMENT=boringcrypto. +## USE_CONTAINER Set to 1 to enable proxying commands to build container +## AGENT_IMAGE Image name:tag built by `make agent-image` +## BUILD_IMAGE Image name:tag used by USE_CONTAINER=1 +## AGENT_BINARY Output path of `make agent` (default build/grafana-agent) +## SERVICE_BINARY Output path of `make agent-service` (default build/grafana-agent-service) +## GOOS Override OS to build binaries for +## GOARCH Override target architecture to build binaries for +## GOARM Override ARM version (6 or 7) when GOARCH=arm +## CGO_ENABLED Set to 0 to disable Cgo for binaries. +## RELEASE_BUILD Set to 1 to build release binaries. +## VERSION Version to inject into built binaries. +## GO_TAGS Extra tags to use when building. +## DOCKER_PLATFORM Overrides platform to build Docker images for (defaults to host platform). +## GOEXPERIMENT Used to enable Go features behind feature flags. include tools/make/*.mk AGENT_IMAGE ?= grafana/agent:latest -AGENT_BORINGCRYPTO_IMAGE ?= grafana/agent-boringcrypto:latest AGENT_BINARY ?= build/grafana-agent -AGENT_BORINGCRYPTO_BINARY ?= build/grafana-agent-boringcrypto -AGENT_BORINGCRYPTO_WINDOWS_BINARY ?= build/grafana-agent-windows-boringcrypto.exe SERVICE_BINARY ?= build/grafana-agent-service AGENTLINT_BINARY ?= build/agentlint GOOS ?= $(shell go env GOOS) @@ -98,7 +90,7 @@ GOEXPERIMENT ?= $(shell go env GOEXPERIMENT) PROPAGATE_VARS := \ AGENT_IMAGE \ BUILD_IMAGE GOOS GOARCH GOARM CGO_ENABLED RELEASE_BUILD \ - AGENT_BINARY AGENT_BORINGCRYPTO_BINARY \ + AGENT_BINARY \ VERSION GO_TAGS GOEXPERIMENT # @@ -159,8 +151,8 @@ integration-test: # Targets for building binaries # -.PHONY: binaries agent agent-boringcrypto -binaries: agent agent-boringcrypto +.PHONY: binaries agent +binaries: agent agent: ifeq ($(USE_CONTAINER),1) @@ -169,20 +161,6 @@ else $(GO_ENV) go build $(GO_FLAGS) -o $(AGENT_BINARY) ./cmd/grafana-agent endif -agent-boringcrypto: -ifeq ($(USE_CONTAINER),1) - $(RERUN_IN_CONTAINER) -else - GOEXPERIMENT=boringcrypto $(GO_ENV) go build $(GO_FLAGS) -o $(AGENT_BORINGCRYPTO_BINARY) ./cmd/grafana-agent -endif - -agent-windows-boringcrypto: -ifeq ($(USE_CONTAINER),1) - $(RERUN_IN_CONTAINER) -else - GOEXPERIMENT=cngcrypto $(GO_ENV) go build $(GO_FLAGS) -tags cngcrypto -o $(AGENT_BORINGCRYPTO_WINDOWS_BINARY) ./cmd/grafana-agent -endif - # agent-service is not included in binaries since it's Windows-only. agent-service: ifeq ($(USE_CONTAINER),1) @@ -208,13 +186,11 @@ ifneq ($(DOCKER_PLATFORM),) DOCKER_FLAGS += --platform=$(DOCKER_PLATFORM) endif -.PHONY: images agent-image agent-boringcrypto-image -images: agent-image agent-boringcrypto-image +.PHONY: images agent-image +images: agent-image agent-image: DOCKER_BUILDKIT=1 docker build $(DOCKER_FLAGS) -t $(AGENT_IMAGE) -f cmd/grafana-agent/Dockerfile . -agent-boringcrypto-image: - DOCKER_BUILDKIT=1 docker build $(DOCKER_FLAGS) --build-arg GOEXPERIMENT=boringcrypto -t $(AGENT_BORINGCRYPTO_IMAGE) -f cmd/grafana-agent/Dockerfile . # # Targets for generating assets diff --git a/tools/ci/docker-containers b/tools/ci/docker-containers index 44c14cb4c6..a712dba8cc 100755 --- a/tools/ci/docker-containers +++ b/tools/ci/docker-containers @@ -8,12 +8,9 @@ set -euxo pipefail RELEASE_AGENT_IMAGE=grafana/agent -RELEASE_AGENTBORINGCRYPTO_IMAGE=grafana/agent-boringcrypto DEVELOPMENT_AGENT_IMAGE=us-docker.pkg.dev/grafanalabs-dev/docker-alloy-dev/alloy -DEVELOPMENT_AGENTBORINGCRYPTO_IMAGE=us-docker.pkg.dev/grafanalabs-dev/docker-alloy-dev/alloy-boringcrypto DEFAULT_AGENT_IMAGE=${RELEASE_AGENT_IMAGE} -DEFAULT_AGENTBORINGCRYPTO_IMAGE=${RELEASE_AGENTBORINGCRYPTO_IMAGE} # Environment variables used throughout this script. These must be set # otherwise bash will fail with an "unbound variable" error because of the `set @@ -27,11 +24,9 @@ export DEVELOPMENT=${DEVELOPMENT:-} if [ -n "$DEVELOPMENT" ]; then DEFAULT_AGENT_IMAGE=${DEVELOPMENT_AGENT_IMAGE} - DEFAULT_AGENTBORINGCRYPTO_IMAGE=${DEVELOPMENT_AGENTBORINGCRYPTO_IMAGE} fi export AGENT_IMAGE=${DEFAULT_AGENT_IMAGE} -export AGENT_BORINGCRYPTO_IMAGE=${DEFAULT_AGENTBORINGCRYPTO_IMAGE} # We need to determine what version to assign to built binaries. If containers # are being built from a Drone tag trigger, we force the version to come from the @@ -65,7 +60,6 @@ fi # Build all of our images. export BUILD_PLATFORMS=linux/amd64,linux/arm64,linux/ppc64le,linux/s390x -export BUILD_PLATFORMS_BORINGCRYPTO=linux/amd64,linux/arm64 case "$TARGET_CONTAINER" in agent) @@ -79,20 +73,8 @@ case "$TARGET_CONTAINER" in . ;; - agent-boringcrypto) - docker buildx build --push \ - --platform $BUILD_PLATFORMS_BORINGCRYPTO \ - --build-arg RELEASE_BUILD=1 \ - --build-arg VERSION="$VERSION" \ - --build-arg GOEXPERIMENT=boringcrypto \ - -t "$AGENT_BORINGCRYPTO_IMAGE:$TAG_VERSION" \ - -t "$AGENT_BORINGCRYPTO_IMAGE:$BRANCH_TAG" \ - -f cmd/grafana-agent/Dockerfile \ - . - ;; - *) - echo "Usage: $0 agent|agent-boringcrypto" + echo "Usage: $0 agent" exit 1 ;; esac diff --git a/tools/make/packaging.mk b/tools/make/packaging.mk index 0c45f94eb1..bd372f8165 100644 --- a/tools/make/packaging.mk +++ b/tools/make/packaging.mk @@ -27,9 +27,7 @@ dist-agent-binaries: dist/grafana-agent-linux-amd64 \ dist/grafana-agent-darwin-amd64 \ dist/grafana-agent-darwin-arm64 \ dist/grafana-agent-windows-amd64.exe \ - dist/grafana-agent-windows-boringcrypto-amd64.exe \ - dist/grafana-agent-freebsd-amd64 \ - dist/grafana-agent-linux-arm64-boringcrypto + dist/grafana-agent-freebsd-amd64 dist/grafana-agent-linux-amd64: GO_TAGS += netgo builtinassets promtail_journal_enabled dist/grafana-agent-linux-amd64: GOOS := linux @@ -83,32 +81,12 @@ dist/grafana-agent-windows-amd64.exe: generate-ui # # TODO(rfratto): add netgo back to Windows builds if a version of Go is # released which natively supports resolving DNS short names on Windows. -dist/grafana-agent-windows-boringcrypto-amd64.exe: GO_TAGS += builtinassets -dist/grafana-agent-windows-boringcrypto-amd64.exe: GOOS := windows -dist/grafana-agent-windows-boringcrypto-amd64.exe: GOARCH := amd64 -dist/grafana-agent-windows-boringcrypto-amd64.exe: generate-ui - $(PACKAGING_VARS) AGENT_BINARY=$@ "$(MAKE)" -f $(PARENT_MAKEFILE) agent - dist/grafana-agent-freebsd-amd64: GO_TAGS += netgo builtinassets dist/grafana-agent-freebsd-amd64: GOOS := freebsd dist/grafana-agent-freebsd-amd64: GOARCH := amd64 dist/grafana-agent-freebsd-amd64: generate-ui $(PACKAGING_VARS) AGENT_BINARY=$@ "$(MAKE)" -f $(PARENT_MAKEFILE) agent -dist/grafana-agent-linux-amd64-boringcrypto: GO_TAGS += netgo builtinassets promtail_journal_enabled -dist/grafana-agent-linux-amd64-boringcrypto: GOOS := linux -dist/grafana-agent-linux-amd64-boringcrypto: GOARCH := amd64 -dist/grafana-agent-linux-amd64-boringcrypto: GOEXPERIMENT := boringcrypto -dist/grafana-agent-linux-amd64-boringcrypto: generate-ui - $(PACKAGING_VARS) AGENT_BINARY=$@ "$(MAKE)" -f $(PARENT_MAKEFILE) agent - -dist/grafana-agent-linux-arm64-boringcrypto: GO_TAGS += netgo builtinassets promtail_journal_enabled -dist/grafana-agent-linux-arm64-boringcrypto: GOOS := linux -dist/grafana-agent-linux-arm64-boringcrypto: GOARCH := arm64 -dist/grafana-agent-linux-arm64-boringcrypto: GOEXPERIMENT := boringcrypto -dist/grafana-agent-linux-arm64-boringcrypto: generate-ui - $(PACKAGING_VARS) AGENT_BINARY=$@ "$(MAKE)" -f $(PARENT_MAKEFILE) agent - # # agent-service release binaries. #