-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Packaging of journalbeat #8702
Packaging of journalbeat #8702
Changes from 3 commits
d355ef8
bccfee3
9197714
f606389
6068254
d717e15
9924045
27ae222
2a4ef65
8d2181f
49126c0
a6892e3
4c936c9
88fcfc9
fcb2fd9
6072520
329428d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,7 +33,7 @@ import ( | |
func init() { | ||
mage.BeatDescription = "Journalbeat ships systemd journal entries to Elasticsearch or Logstash." | ||
|
||
// TODO filter platforms | ||
mage.Platforms = mage.Platforms.Filter("linux") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Given then ppc64 and mips64 can't be build at , I'm wondering if we should filter them like |
||
} | ||
|
||
// Build builds the Beat binary. | ||
|
@@ -44,9 +44,18 @@ func Build() error { | |
// GolangCrossBuild build the Beat binary inside of the golang-builder. | ||
// Do not use directly, use crossBuild instead. | ||
func GolangCrossBuild() error { | ||
mg.Deps(installDependencies) | ||
return mage.GolangCrossBuild(mage.DefaultGolangCrossBuildArgs()) | ||
} | ||
|
||
func installDependencies() error { | ||
if err := sh.Run("apt-get", "update"); err != nil { | ||
return err | ||
} | ||
|
||
return sh.Run("apt-get", "install", "-y", "--no-install-recommends", "libsystemd-dev") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does this work for linux/386? I'd assume that you need to run specific commands for each architecture like Then for armv7 and all other architectures you'd need something like |
||
} | ||
|
||
// BuildGoDaemon builds the go-daemon binary (use crossBuildGoDaemon). | ||
func BuildGoDaemon() error { | ||
return mage.BuildGoDaemon() | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -106,9 +106,11 @@ ${BEAT_NAME}.test: $(GOFILES_ALL) | |
.PHONY: crosscompile | ||
crosscompile: ## @build Cross-compile beat for the OS'es specified in GOX_OS variable. The binaries are placed in the build/bin directory. | ||
crosscompile: $(GOFILES) | ||
ifneq ($(shell [[ $(BEAT_NAME) == journalbeat ]] && echo true ),true) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we need this? How about removing the thing that's invoking crosscompile for journalbeat (I assume this can just be dropped from the travis config). There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
go get github.com/mitchellh/gox | ||
mkdir -p ${BUILD_DIR}/bin | ||
gox -output="${BUILD_DIR}/bin/{{.Dir}}-{{.OS}}-{{.Arch}}" -os="$(strip $(GOX_OS))" -osarch="$(strip $(GOX_OSARCH))" ${GOX_FLAGS} | ||
endif | ||
|
||
.PHONY: check | ||
check: check-headers python-env prepare-tests ## @build Checks project and source code if everything is according to standard | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
// or more contributor license agreements. Licensed under the Elastic License; | ||
// you may not use this file except in compliance with the Elastic License. | ||
|
||
package cmd | ||
|
||
import ( | ||
"github.com/elastic/beats/journalbeat/cmd" | ||
xpackcmd "github.com/elastic/beats/x-pack/libbeat/cmd" | ||
) | ||
|
||
// RootCmd to handle beats cli | ||
var RootCmd = cmd.RootCmd | ||
|
||
func init() { | ||
xpackcmd.AddXPack(RootCmd, cmd.Name) | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
// or more contributor license agreements. Licensed under the Elastic License; | ||
// you may not use this file except in compliance with the Elastic License. | ||
|
||
package main | ||
|
||
import ( | ||
"os" | ||
|
||
"github.com/elastic/beats/x-pack/journalbeat/cmd" | ||
|
||
_ "github.com/elastic/beats/journalbeat/include" | ||
) | ||
|
||
func main() { | ||
if err := cmd.RootCmd.Execute(); err != nil { | ||
os.Exit(1) | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nearly all logic in the mage package is agnostic of the beat names. I think you keep this logic in the journalbeat magefile if you add a new
CrossBuildOption
that allows you to pass in your own "ImageSelector" func. If none is set then it should default to usingmage.crossBuildImage
.