diff --git a/Dockerfile.build b/Dockerfile.build index ea92b5082..db7f7d24c 100644 --- a/Dockerfile.build +++ b/Dockerfile.build @@ -1,5 +1,6 @@ ARG GO_VERSION -FROM docker.elastic.co/beats-dev/golang-crossbuild:${GO_VERSION}-main-debian11 +ARG SUFFIX # Should be main-debian11 or arm +FROM docker.elastic.co/beats-dev/golang-crossbuild:${GO_VERSION}-${SUFFIX} RUN \ apt-get update \ diff --git a/Makefile b/Makefile index fcd4a5576..6f863b5fd 100644 --- a/Makefile +++ b/Makefile @@ -13,7 +13,8 @@ BUILDMODE_windows_amd64=-buildmode=pie BUILDMODE_darwin_amd64=-buildmode=pie BUILDMODE_darwin_arm64=-buildmode=pie -BUILDER_IMAGE=docker.elastic.co/beats-dev/golang-crossbuild:${GO_VERSION}-main-debian11 +CROSSBUILD_SUFFIX=main-debian11 +BUILDER_IMAGE=docker.elastic.co/beats-dev/golang-crossbuild:${GO_VERSION}-${CROSSBUILD_SUFFIX} #Benchmark related targets BENCH_BASE ?= benchmark-$(COMMIT).out @@ -43,7 +44,6 @@ endif DOCKER_IMAGE_TAG?=${VERSION} DOCKER_IMAGE?=docker.elastic.co/fleet-server/fleet-server - PLATFORM_TARGETS=$(addprefix release-, $(PLATFORMS)) COVER_TARGETS=$(addprefix cover-, $(PLATFORMS)) COMMIT=$(shell git rev-parse --short HEAD) @@ -248,7 +248,12 @@ else endif build-releaser: ## - Build a Docker image to run make package including all build tools - docker build -t $(BUILDER_IMAGE) -f Dockerfile.build --build-arg GO_VERSION=$(GO_VERSION) . +ifeq ($(shell uname -p),arm) + $(eval SUFFIX := arm) +else + $(eval SUFFIX := ${CROSSBUILD_SUFFIX}) +endif + docker build -t $(BUILDER_IMAGE) -f Dockerfile.build --build-arg GO_VERSION=$(GO_VERSION) --build-arg SUFFIX=${SUFFIX} . .PHONY: docker-release docker-release: build-releaser ## - Builds a release for all platforms in a dockerised environment @@ -257,7 +262,7 @@ docker-release: build-releaser ## - Builds a release for all platforms in a dock .PHONY: docker-cover-e2e-binaries docker-cover-e2e-binaries: build-releaser ## Build for local architecture and for linux/amd64 for docker images. - docker run --rm -u $(shell id -u):$(shell id -g) --volume $(PWD):/go/src/github.com/elastic/fleet-server -e SNAPSHOT=true $(BUILDER_IMAGE) cover-linux/amd64 cover-$(shell go env GOOS)/$(shell go env GOARCH) + docker run --rm -u $(shell id -u):$(shell id -g) --volume $(PWD):/go/src/github.com/elastic/fleet-server -e SNAPSHOT=true $(BUILDER_IMAGE) cover-linux/$(shell go env GOARCH) cover-$(shell go env GOOS)/$(shell go env GOARCH) .PHONY: release release: $(PLATFORM_TARGETS) ## - Builds a release. Specify exact platform with PLATFORMS env. @@ -336,7 +341,7 @@ test-int-set: ## - Run integration tests without setup .PHONY: build-e2e-agent-image build-e2e-agent-image: docker-cover-e2e-binaries ## - Build a custom elastic-agent image with fleet-server binaries with coverage enabled injected @printf "${CMD_COLOR_ON} Creating test e2e agent image\n${CMD_COLOR_OFF}" - FLEET_VERSION=${DEFAULT_VERSION}-SNAPSHOT GOARCH=amd64 ./dev-tools/e2e/build.sh # force fleet version to be equal to VERSION-SNAPSHOT + FLEET_VERSION=${DEFAULT_VERSION}-SNAPSHOT ./dev-tools/e2e/build.sh # force fleet version to be equal to VERSION-SNAPSHOT .PHONY: e2e-certs e2e-certs: ## - Use openssl to create a CA, encrypted private key, and signed fleet-server cert testing purposes diff --git a/dev-tools/integration/docker-compose.yml b/dev-tools/integration/docker-compose.yml index 132526923..482fea5eb 100644 --- a/dev-tools/integration/docker-compose.yml +++ b/dev-tools/integration/docker-compose.yml @@ -84,11 +84,10 @@ services: - certs:/usr/share/elasticsearch/config/certs ports: - 127.0.0.1:9200:9200 - elasticsearch-remote: depends_on: setup: - condition: service_healthy + condition: service_completed_successfully image: "docker.elastic.co/elasticsearch/elasticsearch:${ELASTICSEARCH_VERSION}" container_name: elasticsearch-remote environment: @@ -127,4 +126,3 @@ services: - certs:/usr/share/elasticsearch/config/certs ports: - 127.0.0.1:9201:9200 -