Skip to content

Commit ace1936

Browse files
michel-latermanmergify[bot]
authored andcommitted
Fix docker image build for FIPS variants (#4472)
Fix multiple -tags= flags occurances. Correct the resulting docker image that's created when FIPS is used. Add fips e2e test that verifies a binary. (cherry picked from commit c83472b)
1 parent 47785e3 commit ace1936

14 files changed

+196
-40
lines changed

.buildkite/pipeline.yml

+17
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,23 @@ steps:
115115
- build/*.xml
116116
- build/e2e-coverage.out
117117

118+
- label: "FIPS E2E Test"
119+
key: "fips-e2e-test"
120+
env:
121+
FIPS: true
122+
command: ".buildkite/scripts/e2e_test.sh"
123+
agents:
124+
provider: "gcp"
125+
artifact_paths:
126+
- build/*.xml
127+
- build/e2e-coverage.out
128+
plugins:
129+
- test-collector#v1.10.2:
130+
files: "build/test-*.xml"
131+
format: "junit"
132+
branches: "main"
133+
debug: true
134+
118135
- label: ":junit: Junit annotate"
119136
plugins:
120137
- junit-annotate#v2.4.1:

.github/workflows/golangci-lint.yml

+2-4
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ permissions:
1010
contents: read
1111
# Optional: allow read access to pull request. Use with `only-new-issues` option.
1212
pull-requests: read
13+
checks: write
1314
jobs:
1415
golangci:
1516
strategy:
@@ -38,7 +39,7 @@ jobs:
3839
uses: golangci/golangci-lint-action@v2
3940
with:
4041
# Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version
41-
version: v1.61.0
42+
version: v1.64.5
4243

4344
# Give the job more time to execute.
4445
# Regarding `--whole-files`, the linter is supposed to support linting of changed a patch only but,
@@ -49,8 +50,5 @@ jobs:
4950
# into fixing all linting issues in the whole file instead.
5051
args: --timeout=30m --whole-files
5152

52-
# Optional: if set to true then the action will use pre-installed Go.
53-
skip-go-installation: true
54-
5553
# Optional: show only new issues if it's a pull request. The default value is `false`.
5654
only-new-issues: true

.golangci.yml

+5-6
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
run:
33
# timeout for analysis, e.g. 30s, 5m, default is 1m
44
timeout: 1m
5-
build-tags: integration
5+
build-tags:
6+
- integration
67
go: "1.23.6"
78

89
issues:
@@ -52,7 +53,6 @@ linters:
5253
- asciicheck # simple linter to check that your code does not contain non-ASCII identifiers
5354
- bodyclose # checks whether HTTP response body is closed successfully
5455
- durationcheck # check for two durations multiplied together
55-
- exportloopref # checks for pointers to enclosing loop variables
5656
- goimports # Goimports does everything that gofmt does. Additionally it checks unused imports
5757
- gosec # inspects source code for security problems
5858
- importas # enforces consistent import aliases
@@ -64,7 +64,8 @@ linters:
6464
- asasalint
6565
- bidichk
6666
- gocheckcompilerdirectives
67-
- tenv
67+
- copyloopvar
68+
- usetesting
6869

6970

7071
# all available settings of specific linters
@@ -97,7 +98,7 @@ linters-settings:
9798
forbid:
9899
- fmt.Print.* # too much log noise
99100
# Exclude godoc examples from forbidigo checks. Default is true.
100-
exclude_godoc_examples: true
101+
exclude-godoc-examples: true
101102

102103
gomoddirectives:
103104
# Allow local `replace` directives. Default is false.
@@ -119,8 +120,6 @@ linters-settings:
119120
nolintlint:
120121
# Enable to ensure that nolint directives are all used. Default is true.
121122
allow-unused: false
122-
# Disable to ensure that nolint directives don't have a leading space. Default is true.
123-
allow-leading-space: true
124123
# Exclude following linters from requiring an explanation. Default is [].
125124
allow-no-explanation: []
126125
# Enable to require an explanation of nonzero length after each nolint directive. Default is false.

Dockerfile.fips

+5-5
Original file line numberDiff line numberDiff line change
@@ -27,19 +27,19 @@ ARG TARGETPLATFORM
2727

2828
RUN FIPS=true CGO_ENABLED=1 GCFLAGS="${GCFLAGS}" LDFLAGS="${LDFLAGS}" DEV="${DEV}" make release-${TARGETPLATFORM}
2929

30-
FROM docker.elastic.co/wolfi/glibc-openssl-fips:latest
30+
FROM docker.elastic.co/wolfi/chainguard-base-fips:latest
3131
ARG VERSION
3232
ARG TARGETOS
3333
ARG TARGETARCH
3434

35-
RUN groupadd --gid 1000 fleet-server && \
36-
useradd -M --uid 1000 --gid 1000 fleet-server
35+
RUN addgroup --gid 1000 fleet-server && \
36+
adduser -H -D -u 1000 -G fleet-server fleet-server
3737

3838
USER fleet-server
3939

4040
COPY --chown=fleet-server:fleet-server --chmod=644 fleet-server.yml /etc/fleet-server.yml
41-
COPY --chown=fleet-server:fleet-server --chmod=755 --from=builder /usr/src/fleet-server/build/binaries/fleet-server-${VERSION}-${TARGETOS:-linux}-*/fleet-server /usr/bin/fleet-server
41+
COPY --chown=fleet-server:fleet-server --chmod=555 --from=builder /go/src/github.com/elastic/fleet-server/build/binaries/fleet-server-${VERSION}-${TARGETOS:-linux}-*-fips/fleet-server /usr/bin/fleet-server
4242

4343
ENV GOFIPS=1
4444

45-
CMD /usr/bin/fleet-server -c /etc/fleet-server.yml
45+
CMD [ "/usr/bin/fleet-server", "-c", "/etc/fleet-server.yml" ]

Makefile

+58-15
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
# Makefile for fleet-server
2+
# Many of the targets can change behaviour based on the following flags:
3+
# - SNAPSHOT - true/false (default false); Make a SNAPSHOT build; fleet-server will allow agents on the next minor version to connect
4+
# - DEV - true/false (default false); Make a dev build, compiler inlining and optimizations are disabled and the symbols table is kept
5+
# - FIPS - true/false (default false); Make a FIPS build.
6+
#
7+
# Additionally the PLATFORMS env var can be used to deterimine outputs for specific targets, such as release.
8+
19
SHELL=/usr/bin/env bash
210
GO_VERSION=$(shell cat '.go-version')
311
DEFAULT_VERSION=$(shell awk '/const DefaultVersion/{print $$NF}' version/version.go | tr -d '"')
@@ -11,6 +19,7 @@ BUILDMODE_darwin_amd64=-buildmode=pie
1119
BUILDMODE_darwin_arm64=-buildmode=pie
1220

1321
CROSSBUILD_SUFFIX=main-debian11
22+
STANDALONE_DOCKERFILE=Dockerfile
1423
BUILDER_IMAGE=fleet-server-builder:${GO_VERSION}
1524

1625
#Benchmark related targets
@@ -32,14 +41,29 @@ ifdef VERSION_QUALIFIER
3241
DEFAULT_VERSION:=${DEFAULT_VERSION}-${VERSION_QUALIFIER}
3342
endif
3443

44+
# gobuildtags is an intermediate variable that is used to properly assemble GOBUILDTAGS, a comma seperated list of tags to use with go build
45+
gobuildtags=
3546
ifeq ($(SNAPSHOT),true)
3647
VERSION=${DEFAULT_VERSION}-SNAPSHOT
48+
gobuildtags=snapshot
3749
else
3850
VERSION=${DEFAULT_VERSION}
3951
endif
4052

4153
DOCKER_PLATFORMS ?= linux/amd64 linux/arm64
54+
# defing the docker image tag used for stand-alone fleet-server images
55+
# only want to define the tag if none is specified, this allows an invocation like
56+
# FIPS=true make test-e2e
57+
# to use a tag like X.Y.Z-fips and not X.Y.Z-fips-fips as the test-e2e target calls into make
58+
ifndef DOCKER_IMAGE_TAG
4259
DOCKER_IMAGE_TAG?=${VERSION}
60+
ifeq "${DEV}" "true"
61+
DOCKER_IMAGE_TAG:=${DOCKER_IMAGE_TAG}-dev
62+
endif
63+
ifeq "${FIPS}" "true"
64+
DOCKER_IMAGE_TAG:=${DOCKER_IMAGE_TAG}-fips
65+
endif
66+
endif
4367
DOCKER_IMAGE?=docker.elastic.co/fleet-server/fleet-server
4468

4569
PLATFORM_TARGETS=$(addprefix release-, $(PLATFORMS))
@@ -64,11 +88,24 @@ OS_NAME:=$(shell uname -s)
6488

6589
# Set FIPS=true to force FIPS compliance when building
6690
FIPS?=
91+
# NOTE: We are assuming that the only GOEXPIREMENT flag will be associated with FIPS
92+
GOFIPSEXPERIMENT?=
93+
FIPSSUFFIX=
6794
ifeq "${FIPS}" "true"
6895
BUILDER_IMAGE=fleet-server-fips-builder:${GO_VERSION}
96+
STANDALONE_DOCKERFILE=Dockerfile.fips
6997
PLATFORMS = linux/amd64 linux/arm64
98+
gobuildtags += requirefips
99+
GOFIPSEXPERIMENT=GOEXPERIMENT=systemcrypto
100+
FIPSSUFFIX=-fips
70101
endif
71102

103+
# Assemble GOBUILDTAGS with some Makefile trickery as we need to avoid sending multiple -tags flags
104+
# the character of a comma needs a variable so it can be used as a value in a subst call
105+
comma=,
106+
# transform the space-seperated values in gobuildtags to a comma seperated string
107+
GOBUILDTAGS=$(subst $() $(),$(comma),$(gobuildtags))
108+
72109
.EXPORT_ALL_VARIABLES:
73110
FIPS=${FIPS}
74111

@@ -100,7 +137,7 @@ list-platforms: ## - Show the possible PLATFORMS
100137
.PHONY: local
101138
local: ## - Build local binary for local environment (bin/fleet-server)
102139
@printf "${CMD_COLOR_ON} Build binaries using local go installation\n${CMD_COLOR_OFF}"
103-
$(if $(FIPS),GOEXPERIMENT=systemcrypto) go build $(if $(SNAPSHOT),-tags="snapshot",) $(if $(FIPS),-tags="requirefips",) -gcflags="${GCFLAGS}" -ldflags="${LDFLAGS}" -o ./bin/fleet-server .
140+
${GOFIPSEXPERIMENT} go build -tags=${GOBUILDTAGS} -gcflags="${GCFLAGS}" -ldflags="${LDFLAGS}" -o ./bin/fleet-server .
104141
@printf "${CMD_COLOR_ON} Binaries in ./bin/\n${CMD_COLOR_OFF}"
105142

106143
.PHONY: $(COVER_TARGETS)
@@ -110,7 +147,7 @@ $(COVER_TARGETS): cover-%: ## - Build a binary with the -cover flag for integrat
110147
$(eval $@_GO_ARCH := $(lastword $(subst /, ,$(lastword $(subst cover-, ,$@)))))
111148
$(eval $@_ARCH := $(TARGET_ARCH_$($@_GO_ARCH)))
112149
$(eval $@_BUILDMODE:= $(BUILDMODE_$($@_OS)_$($@_GO_ARCH)))
113-
GOOS=$($@_OS) GOARCH=$($@_GO_ARCH) $(if $(FIPS),GOEXPERIMENT=systemcrypto) go build $(if $(SNAPSHOT),-tags="snapshot",) $(if $(FIPS),-tags="requirefips",) -cover -coverpkg=./... -gcflags="${GCFLAGS}" -ldflags="${LDFLAGS}" $($@_BUILDMODE) -o build/cover/fleet-server-$(VERSION)-$($@_OS)-$($@_ARCH)/fleet-server$(if $(filter windows,$($@_OS)),.exe,) .
150+
GOOS=$($@_OS) GOARCH=$($@_GO_ARCH) ${GOFIPSEXPERIMENT} go build -tags=${GOBUILDTAGS} -cover -coverpkg=./... -gcflags="${GCFLAGS}" -ldflags="${LDFLAGS}" $($@_BUILDMODE) -o build/cover/fleet-server-$(VERSION)-$($@_OS)-$($@_ARCH)$(FIPSSUFFIX)/fleet-server$(if $(filter windows,$($@_OS)),.exe,) .
114151

115152
.PHONY: clean
116153
clean: ## - Clean up build artifacts
@@ -146,7 +183,7 @@ check-headers: ## - Check copyright headers
146183

147184
.PHONY: check-go
148185
check-go: ## - Run golangci-lint
149-
@curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/d58dbde584c801091e74a00940e11ff18c6c68bd/install.sh | sh -s v1.61.0
186+
@curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/d58dbde584c801091e74a00940e11ff18c6c68bd/install.sh | sh -s v1.64.5
150187
@./bin/golangci-lint run -v
151188

152189
.PHONY: notice
@@ -185,11 +222,11 @@ test-release: ## - Check that all release binaries are created
185222

186223
.PHONY: test-unit
187224
test-unit: prepare-test-context ## - Run unit tests only
188-
set -o pipefail; go test ${GO_TEST_FLAG} $(if $(FIPS),-tags="requirefips",) -v -race -coverprofile=build/coverage-${OS_NAME}.out ./... | tee build/test-unit-${OS_NAME}.out
225+
set -o pipefail; go test ${GO_TEST_FLAG} -tags=$(GOBUILDTAGS) -v -race -coverprofile=build/coverage-${OS_NAME}.out ./... | tee build/test-unit-${OS_NAME}.out
189226

190227
.PHONY: benchmark
191228
benchmark: prepare-test-context install-benchstat ## - Run benchmark tests only
192-
set -o pipefail; go test -bench=$(BENCHMARK_FILTER) $(if $(FIPS),-tags="requirefips",) -run=$(BENCHMARK_FILTER) $(BENCHMARK_ARGS) $(BENCHMARK_PACKAGE) | tee "build/$(BENCH_BASE)"
229+
set -o pipefail; go test -bench=$(BENCHMARK_FILTER) -tags=$(GOBUILDTAGS) -run=$(BENCHMARK_FILTER) $(BENCHMARK_ARGS) $(BENCHMARK_PACKAGE) | tee "build/$(BENCH_BASE)"
193230

194231
.PHONY: install-benchstat
195232
install-benchstat: ## - Install the benchstat package
@@ -225,7 +262,7 @@ $(PLATFORM_TARGETS): release-%:
225262
$(eval $@_GO_ARCH := $(lastword $(subst /, ,$(lastword $(subst release-, ,$@)))))
226263
$(eval $@_ARCH := $(TARGET_ARCH_$($@_GO_ARCH)))
227264
$(eval $@_BUILDMODE:= $(BUILDMODE_$($@_OS)_$($@_GO_ARCH)))
228-
GOOS=$($@_OS) GOARCH=$($@_GO_ARCH) $(if $(FIPS),GOEXPERIMENT=systemcrypto) go build $(if $(SNAPSHOT),-tags="snapshot",) $(if $(FIPS),-tags="requirefips",) -gcflags="${GCFLAGS}" -ldflags="${LDFLAGS}" $($@_BUILDMODE) -o build/binaries/fleet-server-$(VERSION)-$($@_OS)-$($@_ARCH)$(if $(FIPS),-fips,)/fleet-server .
265+
GOOS=$($@_OS) GOARCH=$($@_GO_ARCH) ${GOFIPSEXPERIMENT} go build -tags=${GOBUILDTAGS} -gcflags="${GCFLAGS}" -ldflags="${LDFLAGS}" $($@_BUILDMODE) -o build/binaries/fleet-server-$(VERSION)-$($@_OS)-$($@_ARCH)$(FIPSSUFFIX)/fleet-server .
229266
@$(MAKE) OS=$($@_OS) ARCH=$($@_ARCH) package-target
230267

231268
.PHONY: build-docker
@@ -237,7 +274,8 @@ build-docker:
237274
--build-arg=DEV="$(DEV)" \
238275
--build-arg=SNAPSHOT="$(SNAPSHOT)" \
239276
--build-arg=VERSION="$(VERSION)" \
240-
-t $(DOCKER_IMAGE):$(DOCKER_IMAGE_TAG)$(if $(DEV),-dev,) .
277+
-f $(STANDALONE_DOCKERFILE) \
278+
-t $(DOCKER_IMAGE):$(DOCKER_IMAGE_TAG) .
241279

242280
.PHONY: build-and-push-docker
243281
build-and-push-docker:
@@ -250,12 +288,12 @@ build-and-push-docker:
250288
--build-arg=DEV="$(DEV)" \
251289
--build-arg=SNAPSHOT="$(SNAPSHOT)" \
252290
--build-arg=VERSION="$(VERSION)" \
253-
-t $(DOCKER_IMAGE):$(DOCKER_IMAGE_TAG)$(if $(DEV),-dev,) .
291+
-t $(DOCKER_IMAGE):$(DOCKER_IMAGE_TAG) .
254292

255293
.PHONY: release-docker
256294
release-docker:
257295
docker push \
258-
$(DOCKER_IMAGE):$(DOCKER_IMAGE_TAG)$(if $(DEV),-dev,)
296+
$(DOCKER_IMAGE):$(DOCKER_IMAGE_TAG)
259297

260298
.PHONY: package-target
261299
package-target: build/distributions
@@ -268,8 +306,8 @@ else ifeq ($(OS)-$(ARCH),darwin-arm64)
268306
@tar -C build/binaries -zcf build/distributions/fleet-server-$(VERSION)-$(OS)-aarch64.tar.gz fleet-server-$(VERSION)-$(OS)-aarch64
269307
@cd build/distributions && sha512sum fleet-server-$(VERSION)-$(OS)-aarch64.tar.gz > fleet-server-$(VERSION)-$(OS)-aarch64.tar.gz.sha512
270308
else
271-
@tar -C build/binaries -zcf build/distributions/fleet-server-$(VERSION)-$(OS)-$(ARCH)$(if $(FIPS),-fips,).tar.gz fleet-server-$(VERSION)-$(OS)-$(ARCH)$(if $(FIPS),-fips,)
272-
@cd build/distributions && sha512sum fleet-server-$(VERSION)-$(OS)-$(ARCH)$(if $(FIPS),-fips,).tar.gz > fleet-server-$(VERSION)-$(OS)-$(ARCH)$(if $(FIPS),-fips,).tar.gz.sha512
309+
@tar -C build/binaries -zcf build/distributions/fleet-server-$(VERSION)-$(OS)-$(ARCH)$(FIPSSUFFIX).tar.gz fleet-server-$(VERSION)-$(OS)-$(ARCH)$(FIPSSUFFIX)
310+
@cd build/distributions && sha512sum fleet-server-$(VERSION)-$(OS)-$(ARCH)$(FIPSSUFFIX).tar.gz > fleet-server-$(VERSION)-$(OS)-$(ARCH)$(FIPSSUFFIX).tar.gz.sha512
273311
endif
274312

275313
build-releaser: ## - Build a Docker image to run make package including all build tools
@@ -290,8 +328,13 @@ docker-release: build-releaser ## - Builds a release for all platforms in a dock
290328

291329
.PHONY: docker-cover-e2e-binaries
292330
docker-cover-e2e-binaries: build-releaser
331+
ifeq "${FIPS}" "true"
332+
## non-linux is currently unsupported for FIPS
333+
docker run --rm -u $(shell id -u):$(shell id -g) --volume $(PWD):/go/src/github.com/elastic/fleet-server -e SNAPSHOT=true -e DEV=$(DEV) -e FIPS=$(FIPS) $(BUILDER_IMAGE) cover-linux/$(shell go env GOARCH)
334+
else
293335
## Build for local architecture and for linux/$ARCH for docker images.
294-
docker run --rm -u $(shell id -u):$(shell id -g) --volume $(PWD):/go/src/github.com/elastic/fleet-server -e SNAPSHOT=true $(if $(FIPS),-e FIPS=true) $(BUILDER_IMAGE) cover-linux/$(shell go env GOARCH) cover-$(shell go env GOOS)/$(shell go env GOARCH)
336+
docker run --rm -u $(shell id -u):$(shell id -g) --volume $(PWD):/go/src/github.com/elastic/fleet-server -e SNAPSHOT=true -e DEV=$(DEV) -e FIPS=$(FIPS) $(BUILDER_IMAGE) cover-linux/$(shell go env GOARCH) cover-$(shell go env GOOS)/$(shell go env GOARCH)
337+
endif
295338

296339
.PHONY: release
297340
release: $(PLATFORM_TARGETS) ## - Builds a release. Specify exact platform with PLATFORMS env.
@@ -370,7 +413,7 @@ test-int-set: ## - Run integration tests without setup
370413
.PHONY: build-e2e-agent-image
371414
build-e2e-agent-image: docker-cover-e2e-binaries ## - Build a custom elastic-agent image with fleet-server binaries with coverage enabled injected
372415
@printf "${CMD_COLOR_ON} Creating test e2e agent image\n${CMD_COLOR_OFF}"
373-
FLEET_VERSION=${DEFAULT_VERSION}-SNAPSHOT ./dev-tools/e2e/build.sh # force fleet version to be equal to VERSION-SNAPSHOT
416+
FIPS=${FIPS} FLEET_VERSION=${DEFAULT_VERSION}-SNAPSHOT ./dev-tools/e2e/build.sh # force fleet version to be equal to VERSION-SNAPSHOT
374417

375418
.PHONY: e2e-certs
376419
e2e-certs: ## - Use openssl to create a CA, encrypted private key, and signed fleet-server cert testing purposes
@@ -404,9 +447,9 @@ test-e2e-set: ## - Run the blackbox end to end tests without setup.
404447
ELASTICSEARCH_SERVICE_TOKEN=$(shell ./dev-tools/integration/get-elasticsearch-servicetoken.sh ${ELASTICSEARCH_USERNAME}:${ELASTICSEARCH_PASSWORD}@${TEST_ELASTICSEARCH_HOSTS} "fleet-server") \
405448
ELASTICSEARCH_HOSTS=${TEST_ELASTICSEARCH_HOSTS} ELASTICSEARCH_USERNAME=${ELASTICSEARCH_USERNAME} ELASTICSEARCH_PASSWORD=${ELASTICSEARCH_PASSWORD} \
406449
AGENT_E2E_IMAGE=$(shell cat "build/e2e-image") \
407-
STANDALONE_E2E_IMAGE=$(DOCKER_IMAGE):$(DOCKER_IMAGE_TAG)$(if $(DEV),-dev,) \
450+
STANDALONE_E2E_IMAGE=$(DOCKER_IMAGE):$(DOCKER_IMAGE_TAG) \
408451
CGO_ENABLED=1 \
409-
go test -v -timeout 30m -tags=e2e -count=1 -race -p 1 ./...
452+
go test -v -timeout 30m -tags=e2e,$(GOBUILDTAGS) -count=1 -race -p 1 ./...
410453

411454
##################################################
412455
# Cloud testing targets

dev-tools/e2e/Dockerfile

+4-2
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,16 @@ ARG ELASTIC_AGENT_IMAGE # e.g. docker.elastic.co/cloud-release/elastic-agent-clo
22

33
FROM --platform=linux/amd64 ${ELASTIC_AGENT_IMAGE} as elastic_agent_amd64
44
ARG STACK_VERSION # e.g. 8.5.0-SNAPSHOT
5+
ARG FLEET_SUFFIX # e.g. -linux-x86_64
56
ARG VCS_REF_SHORT # e.g. abc123
6-
ONBUILD COPY --chmod=0755 --chown=elastic-agent cover/fleet-server-${STACK_VERSION}-linux-x86_64/fleet-server \
7+
ONBUILD COPY --chmod=0755 --chown=elastic-agent cover/fleet-server-${STACK_VERSION}${FLEET_SUFFIX}/fleet-server \
78
./data/elastic-agent-${VCS_REF_SHORT}/components/fleet-server
89

910
FROM --platform=linux/arm64 ${ELASTIC_AGENT_IMAGE} as elastic_agent_arm64
1011
ARG STACK_VERSION # e.g. 8.5.0-SNAPSHOT
12+
ARG FLEET_SUFFIX # e.g. -linux-x86_64
1113
ARG VCS_REF_SHORT # e.g. abc123
12-
ONBUILD COPY --chmod=0755 --chown=elastic-agent cover/fleet-server-${STACK_VERSION}-linux-arm64/fleet-server \
14+
ONBUILD COPY --chmod=0755 --chown=elastic-agent cover/fleet-server-${STACK_VERSION}${FLEET_SUFFIX}/fleet-server \
1315
./data/elastic-agent-${VCS_REF_SHORT}/components/fleet-server
1416

1517
FROM elastic_agent_${TARGETARCH}

dev-tools/e2e/build.sh

+9
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,19 @@ VCS_REF=$(docker inspect -f '{{index .Config.Labels "org.label-schema.vcs-ref"}}
2424

2525
CUSTOM_IMAGE_TAG=${STACK_VERSION}-e2e-${COMMIT}-$(date +%s)
2626

27+
FLEET_SUFFIX="-linux-x86_64"
28+
if [[ "$GOARCH" == "arm64" ]]; then
29+
FLEET_SUFFIX="-linux-arm64"
30+
fi
31+
if [[ "$FIPS" == "true" ]]; then
32+
FLEET_SUFFIX="${FLEET_SUFFIX}-fips"
33+
fi
34+
2735
docker build \
2836
-f $REPO_ROOT/dev-tools/e2e/Dockerfile \
2937
--build-arg ELASTIC_AGENT_IMAGE=$BASE_IMAGE \
3038
--build-arg STACK_VERSION=${FLEET_VERSION} \
39+
--build-arg FLEET_SUFFIX=${FLEET_SUFFIX} \
3140
--build-arg VCS_REF_SHORT=${VCS_REF:0:6} \
3241
--platform linux/$GOARCH \
3342
-t ${CI_ELASTIC_AGENT_DOCKER_IMAGE}:${CUSTOM_IMAGE_TAG} \

testing/e2e/agent_container_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// or more contributor license agreements. Licensed under the Elastic License;
33
// you may not use this file except in compliance with the Elastic License.
44

5-
//go:build e2e
5+
//go:build e2e && !requirefips
66

77
package e2e
88

testing/e2e/agent_install_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// or more contributor license agreements. Licensed under the Elastic License;
33
// you may not use this file except in compliance with the Elastic License.
44

5-
//go:build e2e
5+
//go:build e2e && !requirefips
66

77
package e2e
88

0 commit comments

Comments
 (0)