Skip to content

Commit bd69dfc

Browse files
mergify[bot]pchila
authored andcommitted
[8.x](backport #7690) Fips packaging (#7790)
* Make components in packages configurable (#7602) * Redefine ExpectedBinaries as YAML config * Move ExpectedBinaries closer to package spec file * Fix error formatting in downloadDRAArtifacts * add packageName template to ExpectedPackages * use a relaxed dependencies version for IAR releases * Remove FIPS hack introduced in PR #7486 * Allow for a looser match on relaxing dependencies versions * Add debug logging when packaging with EXTERNAL=true * move package tests to dedicated package * Fips packaging (#7690) * Add component list to specs * extract component dependencies from the packages to be built * Refactor component extraction from package specs * Fix package tests error handling * Inject dependencies and remove references to ExpectedBinaries * Remove ExpectedBinaries global * Add rootdir to components * Extract actual version matched on the package file and use it to render RootDir * Package elastic-agent FIPS specs when FIPS=true is specified * refactor ResolveManifestPackage * Move FIPS compile settings in packages.yml * Add more FIPS components * Properly handle dependenciesVersion when calling mage package * Refactor ChecksumsWithoutManifest to use list of dependencies instead of globbing files * Rework useDRAAgentBinaryForPackage for repackaging agent Define elastic-agent-core components (both FIPS and non-FIPS variants) and define package name and root dir templates. Implement some filtering on component list to extract the correct component definition according to the FIPSBuild flag. Refactor code that downloads pre-compiled elastic-agent binaries and places them in the golangCrossBuild directory to make use of the new component definition. * Write spec FIPS flag into manifest.yaml when packaging * Add FIPS elastic agent basic and cloud docker images * Build FIPS docker images in CI packaging * Fix FIPS .tar.gz package tests * Restructure package tests * Extend FIPS check to all binaries in components directory * Create FIPS elastic-agent-core artifacts in elastic-agent-binary-dra pipeline * Cleanup ChecksumsWithManifest and improve godoc * Improve godoc for BinarySpec * Correctly inject dependency list when packaging using DROP_PATH (#7795) * Restore qualifier=core for elastic-agent-core packaging specs (#7805) Restore qualifier for elastic-agent-core packaging specs to avoid changing the rootDir name of the archives. The qualifier had been removed in PR #7690 trying to use the spec name: this worked to get the desired file name but changed the root Dir name which uses '{{.BeatName}}{{if .Qualifier}}-{{.Qualifier}}{{end}}' in the template definition instead of '{{.Name}}' which would render the spec name. * Modify fips core spec qualifier and name (#7818) * Reintroduce cloud-defend component * Filter components by package-type --------- Co-authored-by: Paolo Chilà <[email protected]>
1 parent 00bcb5e commit bd69dfc

File tree

17 files changed

+1127
-766
lines changed

17 files changed

+1127
-766
lines changed

.buildkite/integration.pipeline.yml

Lines changed: 0 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -34,23 +34,6 @@ steps:
3434
machineType: "n2-standard-8"
3535
image: "${IMAGE_UBUNTU_2204_X86_64}"
3636

37-
- label: "Packaging: Ubuntu x86_64 FIPS"
38-
key: "packaging-ubuntu-x86-64-fips"
39-
env:
40-
PACKAGES: "tar.gz"
41-
PLATFORMS: "linux/amd64"
42-
FIPS: "true"
43-
command: ".buildkite/scripts/steps/integration-package.sh"
44-
artifact_paths:
45-
- build/distributions/**
46-
retry:
47-
automatic:
48-
limit: 1
49-
agents:
50-
provider: "gcp"
51-
machineType: "n2-standard-4"
52-
image: "${IMAGE_UBUNTU_2204_X86_64}"
53-
5437
# Packaging linux/arm64
5538
- label: "Packaging: linux/arm64 tar.gz"
5639
key: packaging-ubuntu-arm64
@@ -68,23 +51,6 @@ steps:
6851
instanceType: "c6g.4xlarge"
6952
image: "${IMAGE_UBUNTU_2204_ARM_64}"
7053

71-
- label: "Packaging: Ubuntu arm64 FIPS"
72-
key: "packaging-ubuntu-arm64-fips"
73-
env:
74-
PACKAGES: "tar.gz"
75-
PLATFORMS: "linux/arm64"
76-
FIPS: "true"
77-
command: ".buildkite/scripts/steps/integration-package.sh"
78-
artifact_paths:
79-
- build/distributions/**
80-
retry:
81-
automatic:
82-
limit: 1
83-
agents:
84-
provider: "aws"
85-
instanceType: "c6g.4xlarge"
86-
image: "${IMAGE_UBUNTU_2204_ARM_64}"
87-
8854
- label: "Packaging: windows/amd64 zip"
8955
key: packaging-windows
9056
env:
@@ -106,13 +72,8 @@ steps:
10672
env:
10773
PACKAGES: "docker"
10874
PLATFORMS: "linux/amd64"
109-
<<<<<<< HEAD
110-
command: ".buildkite/scripts/steps/integration-package.sh"
111-
=======
11275
command: |
11376
.buildkite/scripts/steps/integration-package.sh
114-
.buildkite/scripts/steps/integration-cloud-image-push.sh
115-
>>>>>>> a155660c4 (ci: build agent from snapshot DRA (#9048))
11677
artifact_paths:
11778
- build/distributions/**
11879
agents:
@@ -136,44 +97,6 @@ steps:
13697
diskSizeGb: 200
13798
image: "${IMAGE_UBUNTU_2204_ARM_64}"
13899

139-
<<<<<<< HEAD
140-
=======
141-
- label: "Packaging: Containers linux/amd64 FIPS"
142-
key: packaging-containers-x86-64-fips
143-
env:
144-
PACKAGES: "docker"
145-
PLATFORMS: "linux/amd64"
146-
FIPS: "true"
147-
command: |
148-
.buildkite/scripts/steps/integration-package.sh
149-
.buildkite/scripts/steps/integration-cloud-image-push.sh
150-
artifact_paths:
151-
- build/distributions/**
152-
agents:
153-
provider: "gcp"
154-
machineType: "n2-standard-8"
155-
diskSizeGb: 200
156-
image: "${IMAGE_UBUNTU_2204_X86_64}"
157-
plugins:
158-
- *vault_docker_login
159-
160-
- label: "Packaging: Containers linux/arm64 FIPS"
161-
key: packaging-containers-arm64-fips
162-
env:
163-
PACKAGES: "docker"
164-
PLATFORMS: "linux/arm64"
165-
FIPS: "true"
166-
command: |
167-
.buildkite/scripts/steps/integration-package.sh
168-
artifact_paths:
169-
- build/distributions/**
170-
agents:
171-
provider: "aws"
172-
instanceType: "c6g.4xlarge"
173-
diskSizeGb: 200
174-
image: "${IMAGE_UBUNTU_2204_ARM_64}"
175-
176-
>>>>>>> a155660c4 (ci: build agent from snapshot DRA (#9048))
177100
- label: "Triggering Integration tests"
178101
depends_on:
179102
- int-packaging

dev-tools/mage/build.go

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ func DefaultBuildArgs() BuildArgs {
7373
args := BuildArgs{
7474
Name: BeatName,
7575
CGO: build.Default.CgoEnabled,
76+
Env: map[string]string{},
7677
Vars: map[string]string{
7778
elasticAgentModulePath + "/version.buildTime": "{{ date }}",
7879
elasticAgentModulePath + "/version.commit": "{{ commit }}",
@@ -87,11 +88,6 @@ func DefaultBuildArgs() BuildArgs {
8788
args.ExtraFlags = append(args.ExtraFlags, "-buildmode", "pie")
8889
}
8990

90-
if FIPSBuild {
91-
args.ExtraFlags = append(args.ExtraFlags, "-tags=requirefips")
92-
args.CGO = true
93-
}
94-
9591
if DevBuild {
9692
// Disable optimizations (-N) and inlining (-l) for debugging.
9793
args.ExtraFlags = append(args.ExtraFlags, `-gcflags=all=-N -l`)
@@ -191,11 +187,6 @@ func Build(params BuildArgs) error {
191187
cgoEnabled = "1"
192188
}
193189

194-
if FIPSBuild {
195-
cgoEnabled = "1"
196-
env["GOEXPERIMENT"] = "systemcrypto"
197-
}
198-
199190
env["CGO_ENABLED"] = cgoEnabled
200191

201192
// Spec

0 commit comments

Comments
 (0)