-
Notifications
You must be signed in to change notification settings - Fork 4.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Converting generator.py to mage (#13610)
Converting generator.py to mage
- Loading branch information
1 parent
6f9dcd9
commit 3d93735
Showing
18 changed files
with
527 additions
and
258 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,45 +1,36 @@ | ||
BUILD_DIR?=build | ||
PWD=$(shell pwd) | ||
PYTHON_ENV?=${BUILD_DIR}/python-env | ||
BEAT_TYPE?=beat | ||
BEAT_PATH=${BUILD_DIR}/src/beatpath/testbeat | ||
BEAT_NAME?=beatpath/test${BEAT_TYPE} | ||
BEAT_PATH=${GOPATH}/src/${BEAT_NAME} | ||
ES_BEATS=${GOPATH}/src/github.com/elastic/beats | ||
PREPARE_COMMAND?= | ||
|
||
# Runs test build for mock beat | ||
.PHONY: test | ||
test: prepare-test | ||
. ${PYTHON_ENV}/bin/activate; \ | ||
export GOPATH=${PWD}/build ; \ | ||
export PATH=$${GOPATH}/bin:${PATH}; \ | ||
cd ${BEAT_PATH} ; \ | ||
$(MAKE) copy-vendor || exit 1 ; \ | ||
${PREPARE_COMMAND} \ | ||
$(MAKE) git-init || exit 1 ; \ | ||
$(MAKE) update fmt || exit 1 ; \ | ||
export PATH=$${GOPATH}/bin:$${PATH}; \ | ||
git config user.email "[email protected]" || exit 1 ; \ | ||
git config user.name "beats-jenkins" || exit 1 ; \ | ||
$(MAKE) git-add || exit 1 ; \ | ||
$(MAKE) check CHECK_HEADERS_DISABLED=y || exit 1 ; \ | ||
$(MAKE) || exit 1 ; \ | ||
$(MAKE) unit | ||
|
||
.PHONY: prepare-test | ||
prepare-test:: python-env | ||
# Makes sure to use current version of beats for testing | ||
rm -fr ${BUILD_DIR}/src/github.com/elastic/beats/ | ||
git clone -s ${PWD}/../../ ${BUILD_DIR}/src/github.com/elastic/beats/ | ||
|
||
prepare-test:: ${GOPATH}/bin/mage | ||
rm -fr ${BEAT_PATH} | ||
mkdir -p ${BEAT_PATH} | ||
export GOPATH=${PWD}/build ; \ | ||
. ${PYTHON_ENV}/bin/activate && \ | ||
python ${PWD}/build/src/github.com/elastic/beats/script/generate.py \ | ||
--type=${BEAT_TYPE} \ | ||
--project_name=Testbeat \ | ||
--github_name=ruflin \ | ||
--beat_path=beatpath/testbeat \ | ||
--full_name="Nicolas Ruflin" | ||
cd ${GOPATH}/src/github.com/elastic/beats/ ; \ | ||
export MODULE=elastic ; \ | ||
export METRICSET=test ; \ | ||
export GO111MODULE=off; \ | ||
export NEWBEAT_PROJECT_NAME=Testbeat ; \ | ||
export NEWBEAT_GITHUB_NAME=ruflin ; \ | ||
export NEWBEAT_BEAT_PATH=${BEAT_NAME} ; \ | ||
export NEWBEAT_FULL_NAME="Nicolas Ruflin" ; \ | ||
export NEWBEAT_TYPE=${BEAT_TYPE} ; \ | ||
export NEWBEAT_DEV=1 ; \ | ||
mage GenerateCustomBeat | ||
|
||
# Runs test build for the created beat | ||
.PHONY: test-build | ||
|
@@ -51,15 +42,12 @@ test-build: test | |
$(MAKE) deps ; \ | ||
$(MAKE) images | ||
|
||
# Sets up the virtual python environment | ||
.PHONY: python-env | ||
python-env: | ||
@test -d ${PYTHON_ENV} || virtualenv ${PYTHON_ENV} | ||
@${PYTHON_ENV}/bin/pip install --upgrade pip PyYAML | ||
@# Work around pip bug. See: https://github.com/pypa/pip/issues/4464 | ||
@find $(PYTHON_ENV) -type d -name dist-packages -exec sh -c "echo dist-packages > {}.pth" ';' | ||
${GOPATH}/bin/mage: | ||
go get -u -d github.com/magefile/mage | ||
cd $${GOPATH}/src/github.com/magefile/mage; \ | ||
go run bootstrap.go | ||
|
||
# Cleans up environment | ||
.PHONY: clean | ||
clean: | ||
@rm -rf build | ||
rm -rf ${BEAT_PATH} |
Oops, something went wrong.