Skip to content

Commit

Permalink
fixup! WIP - package FIPS-compliant Beats
Browse files Browse the repository at this point in the history
  • Loading branch information
pchila committed Mar 5, 2025
1 parent d836b46 commit 77ace71
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
10 changes: 8 additions & 2 deletions dev-tools/mage/pkg.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (
"os"
"path/filepath"
"runtime"
"slices"
"strconv"
"strings"

Expand Down Expand Up @@ -88,8 +89,13 @@ func Package() error {
}

// TODO add filters on fips-enabled beats
if pkg.Spec.FIPS && !FIPSBuild {
log.Printf("Skipping creation for package type %v because spec.Fips=%b and fips=%b: %v", pkgType, pkg.Spec.FIPS, FIPSBuild)
if FIPSBuild && !slices.Contains(FIPSConfig.Beats, BeatName) {
log.Printf("Skipping creation for beat %v package type %v because beat is not listed as FIPS compliant %v", BeatName, pkgType, FIPSConfig.Beats)
continue
}

if pkg.Spec.FIPS != FIPSBuild {
log.Printf("Skipping creation for package type %v because spec.FIPS = %v and FIPSBuild = %v", pkgType, pkg.Spec.FIPS, FIPSBuild)
continue
}

Expand Down
12 changes: 6 additions & 6 deletions dev-tools/mage/pkgspecs.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,18 +45,18 @@ func UseElasticBeatXPackPackaging() {
MustUsePackaging("elastic_beat_xpack", packageSpecFile)
}

// UseElasticBeatXPackFIPSPackaging configures the package target to build Elastic
// licensed (X-Pack) FIPS compliant packages for agent use.
func UseElasticBeatXPackFIPSPackaging() {
MustUsePackaging("elastic_beat_xpack_fips", packageSpecFile)
}

// UseElasticBeatXPackReducedPackaging configures the package target to build Elastic
// licensed (X-Pack) packages for agent use.
func UseElasticBeatXPackReducedPackaging() {
MustUsePackaging("elastic_beat_xpack_reduced", packageSpecFile)
}

// UseElasticBeatXPackFIPSPackaging configures the package target to build Elastic
// licensed (X-Pack) packages for agent use.
func UseElasticBeatXPackFIPSPackaging() {
MustUsePackaging("elastic_beat_xpack_fips", packageSpecFile)
}

// MustUsePackaging will load a named spec from a named file, if any errors
// occurs when loading the specs it will panic.
//
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,7 @@ require (
golang.org/x/term v0.29.0
google.golang.org/genproto/googleapis/api v0.0.0-20241118233622-e639e219e697
gopkg.in/natefinch/lumberjack.v2 v2.2.1
gopkg.in/yaml.v3 v3.0.1
)

require (
Expand Down Expand Up @@ -464,7 +465,6 @@ require (
golang.org/x/xerrors v0.0.0-20240903120638-7835f813f4da // indirect
gonum.org/v1/gonum v0.15.1 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20241209162323-e6fa225c2576 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
k8s.io/klog/v2 v2.130.1 // indirect
k8s.io/kube-openapi v0.0.0-20240228011516-70dd3763d340 // indirect
k8s.io/utils v0.0.0-20230726121419-3b25d923346b // indirect
Expand Down

0 comments on commit 77ace71

Please sign in to comment.