Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make functionbeat build process depends on linux/amd64 #8889

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG-developer.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,4 @@ The list below covers the major changes between 6.3.0 and master only.
- Add `mage.GenerateFieldsGo` for generating fields.go files. {pull}8615[8615]
- Add `mage.KibanaDashboards` for collecting Kibana dashboards and generating index patterns. {pull}8615[8615]
- Allow to disable config resolver using the `Settings.DisableConfigResolver` field when initializing libbeat. {pull}8769[8769]
- Add `mage.AddPlatforms` to allow to specify dependent platforms when building a beat. {pull}8889[8889]
11 changes: 11 additions & 0 deletions dev-tools/mage/crossbuild.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,17 @@ func ImageSelector(f ImageSelectorFunc) func(params *crossBuildParams) {
}
}

// AddPlatforms sets dependencies on others platforms.
func AddPlatforms(expressions ...string) func(params *crossBuildParams) {
return func(params *crossBuildParams) {
var list BuildPlatformList
for _, expr := range expressions {
list = NewPlatformList(expr)
params.Platforms = params.Platforms.Merge(list)
}
}
}

type crossBuildParams struct {
Platforms BuildPlatformList
Target string
Expand Down
8 changes: 8 additions & 0 deletions dev-tools/mage/platforms.go
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,14 @@ func (list BuildPlatformList) Filter(expr string) BuildPlatformList {
return out.deduplicate()
}

// Merge creates a new list with the two list merged.
ph marked this conversation as resolved.
Show resolved Hide resolved
func (list BuildPlatformList) Merge(with BuildPlatformList) BuildPlatformList {
out := make(BuildPlatformList, 0, len(list)+len(with))
out = append(list, with...)
out = append(out, with...)
return out.deduplicate()
}

// deduplicate removes duplicate platforms and sorts the list.
func (list BuildPlatformList) deduplicate() BuildPlatformList {
set := map[string]BuildPlatform{}
Expand Down
2 changes: 1 addition & 1 deletion x-pack/functionbeat/magefile.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func BuildGoDaemon() error {

// CrossBuild cross-builds the beat for all target platforms.
func CrossBuild() error {
return mage.CrossBuild()
return mage.CrossBuild(mage.AddPlatforms("linux/amd64"))
}

// CrossBuildGoDaemon cross-builds the go-daemon binary using Docker.
Expand Down