From 7730df259509699792774c918ca653e6be6ef00e Mon Sep 17 00:00:00 2001 From: Pier-Hugues Pellerin Date: Wed, 24 Oct 2018 10:16:14 -0400 Subject: [PATCH 1/2] Fix an issue where we were trying to get use a non existing directory when generating the fields.go Functionbeat doesn't have a OSS implementation. --- dev-tools/mage/fields.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/dev-tools/mage/fields.go b/dev-tools/mage/fields.go index a625465f52b..83158fbd0a4 100644 --- a/dev-tools/mage/fields.go +++ b/dev-tools/mage/fields.go @@ -18,6 +18,7 @@ package mage import ( + "os" "path/filepath" "github.com/magefile/mage/sh" @@ -40,7 +41,11 @@ func OSSBeatDir(path ...string) string { // Check if we need to correct ossDir because it's in x-pack. if parentDir := filepath.Base(filepath.Dir(ossDir)); parentDir == "x-pack" { - ossDir = filepath.Join(ossDir, "../..", BeatName) + // If the OSS version of the beat exists. + tmp := filepath.Join(ossDir, "../..", BeatName) + if _, err := os.Stat(tmp); !os.IsNotExist(err) { + ossDir = tmp + } } return filepath.Join(append([]string{ossDir}, path...)...) From 6da4d256ce0e924a78da3c48ccf10be3a8f32b58 Mon Sep 17 00:00:00 2001 From: Pier-Hugues Pellerin Date: Wed, 24 Oct 2018 13:15:16 -0400 Subject: [PATCH 2/2] Add an XPACK_ONLY flag so we can skip some commands in libbeat --- libbeat/scripts/Makefile | 3 ++- x-pack/functionbeat/Makefile | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/libbeat/scripts/Makefile b/libbeat/scripts/Makefile index 53148b66b78..f04ee8858c7 100755 --- a/libbeat/scripts/Makefile +++ b/libbeat/scripts/Makefile @@ -82,6 +82,7 @@ VIRTUALENV_PARAMS?= INTEGRATION_TESTS?= FIND=. ${PYTHON_ENV}/bin/activate; find . -type f -not -path "*/vendor/*" -not -path "*/build/*" -not -path "*/.git/*" PERM_EXEC?=$(shell [ `uname -s` = "Darwin" ] && echo "+111" || echo "/a+x") +XPACK_ONLY?=false ifeq ($(DOCKER_CACHE),0) DOCKER_NOCACHE=--no-cache @@ -210,7 +211,7 @@ system-tests-environment: prepare-tests build-image ${DOCKER_COMPOSE} run -e INTEGRATION_TESTS=1 -e TESTING_ENVIRONMENT=${TESTING_ENVIRONMENT} -e DOCKER_COMPOSE_PROJECT_NAME=${DOCKER_COMPOSE_PROJECT_NAME} beat make system-tests #This is a hack to run x-pack/filebeat module tests @XPACKBEAT="${ES_BEATS}/x-pack/${BEAT_NAME}" ; \ - if [ -e "$$XPACKBEAT/tests/system" ] ; then \ + if [ -e "$$XPACKBEAT/tests/system" ] && [ $(XPACK_ONLY) = false ]; then \ $(MAKE) -C ../x-pack/${BEAT_NAME} fields; \ ${DOCKER_COMPOSE} run -e INTEGRATION_TESTS=1 -e MODULES_PATH="../../x-pack/${BEAT_NAME}/module" -e TESTING_ENVIRONMENT=${TESTING_ENVIRONMENT} -e DOCKER_COMPOSE_PROJECT_NAME=${DOCKER_COMPOSE_PROJECT_NAME} beat make -C "$$XPACKBEAT" ${BEAT_NAME}.test system-tests ; \ $(MAKE) -C ../x-pack/${BEAT_NAME} fix-permissions; \ diff --git a/x-pack/functionbeat/Makefile b/x-pack/functionbeat/Makefile index 0fc8cf62923..876f451476c 100644 --- a/x-pack/functionbeat/Makefile +++ b/x-pack/functionbeat/Makefile @@ -7,6 +7,7 @@ TEST_ENVIRONMENT?=true GOX_FLAGS=-arch="amd64 386 arm ppc64 ppc64le" ES_BEATS?=../../ FIELDS_FILE_PATH=module +XPACK_ONLY?=true # Path to the libbeat Makefile include $(ES_BEATS)/libbeat/scripts/Makefile