Skip to content

Commit

Permalink
build: temporarily remove boringcrypto (#63)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
rfratto authored Mar 22, 2024
1 parent b36ee4b commit 77fba86
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 161 deletions.
53 changes: 1 addition & 52 deletions .drone/drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -450,6 +399,6 @@ kind: secret
name: updater_private_key
---
kind: signature
hmac: eb4c87d4abc880513c7c2977c46910fa96041461aa2edea16a7970f5c145dd01
hmac: 2088d828b5aeec4f38008f932b1402a03745e941ba06c6c4d72a96d42dfb7f01

...
22 changes: 1 addition & 21 deletions .drone/pipelines/crosscompile.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -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]) {
Expand Down Expand Up @@ -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)
5 changes: 2 additions & 3 deletions .drone/pipelines/publish.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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) (
Expand Down
62 changes: 19 additions & 43 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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:
##
Expand Down Expand Up @@ -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)
Expand All @@ -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

#
Expand Down Expand Up @@ -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)
Expand All @@ -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)
Expand All @@ -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
Expand Down
20 changes: 1 addition & 19 deletions tools/ci/docker-containers
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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)
Expand All @@ -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
Expand Down
24 changes: 1 addition & 23 deletions tools/make/packaging.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.
#
Expand Down

0 comments on commit 77fba86

Please sign in to comment.