Skip to content

Commit

Permalink
Cherry-pick #15140 to 7.5: Fix mage package on generated beats (#15383)
Browse files Browse the repository at this point in the history
Mage package calls some targets by name (instead of by reference), and
then these targets need to be defined in the main magefile.

Add mage package to the test suite so we earlier detect these issues.

(cherry picked from commit 315837b)
  • Loading branch information
jsoriano committed Jan 11, 2020
1 parent 9f50314 commit e6be14f
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 2 deletions.
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -142,11 +142,11 @@ jobs:

# Generators
- os: linux
env: TARGETS="-C generator/metricbeat test"
env: TARGETS="-C generator/metricbeat test test-package"
go: $TRAVIS_GO_VERSION
stage: test
- os: linux
env: TARGETS="-C generator/beat test"
env: TARGETS="-C generator/beat test test-package"
go: $TRAVIS_GO_VERSION
stage: test

Expand Down
11 changes: 11 additions & 0 deletions generator/beat/{beat}/magefile.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,3 +77,14 @@ func Build() error {
func CrossBuild() error {
return build.CrossBuild()
}

// BuildGoDaemon builds the go-daemon binary (use crossBuildGoDaemon).
func BuildGoDaemon() error {
return build.BuildGoDaemon()
}

// GolangCrossBuild build the Beat binary inside of the golang-builder.
// Do not use directly, use crossBuild instead.
func GolangCrossBuild() error {
return build.GolangCrossBuild()
}
7 changes: 7 additions & 0 deletions generator/common/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,13 @@ test: prepare-test
$(MAKE) || exit 1 ; \
$(MAKE) unit

.PHONY: test-package
test-package: test
cd ${BEAT_PATH} ; \
export GOPATH=${PWD}/build ; \
export PATH=$${GOPATH}/bin:$${PATH}; \
mage package

.PHONY: prepare-test
prepare-test:: python-env
# Makes sure to use current version of beats for testing
Expand Down
11 changes: 11 additions & 0 deletions generator/metricbeat/{beat}/magefile.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,3 +112,14 @@ func Build() error {
func CrossBuild() error {
return build.CrossBuild()
}

// BuildGoDaemon builds the go-daemon binary (use crossBuildGoDaemon).
func BuildGoDaemon() error {
return build.BuildGoDaemon()
}

// GolangCrossBuild build the Beat binary inside of the golang-builder.
// Do not use directly, use crossBuild instead.
func GolangCrossBuild() error {
return build.GolangCrossBuild()
}

0 comments on commit e6be14f

Please sign in to comment.