From 26f77bed889cd11c0c4878ba7d1527267ba5cf9c Mon Sep 17 00:00:00 2001 From: "Thibault \"bui\" Koechlin" Date: Thu, 11 Jun 2020 15:03:43 +0200 Subject: [PATCH] CI: provide makefile for CI and fixe types.Event (#70) --- Makefile | 12 ++++++++++++ pkg/types/event.go | 4 ++-- scripts/install_all.sh | 7 +++++++ 3 files changed, 21 insertions(+), 2 deletions(-) create mode 100644 scripts/install_all.sh diff --git a/Makefile b/Makefile index 68ddca9d3..06a07fa78 100644 --- a/Makefile +++ b/Makefile @@ -39,6 +39,18 @@ goversion: CURRENT_GOVERSION="$(shell go version | cut -d " " -f3 | sed -r 's/[go]+//g')" RESPECT_VERSION="$(shell echo "$(CURRENT_GOVERSION),$(REQUIRE_GOVERSION)" | tr ',' '\n' | sort -V)" + +hubci: + @rm -rf crowdsec-xxx hub-tests + BUILD_VERSION=xxx make release + @git clone https://github.com/crowdsecurity/hub-tests.git + @cd hub-tests && make + @cd crowdsec-xxx && ./test_env.sh + @cd crowdsec-xxx/tests && bash ../../scripts/install_all.sh + @cp hub-tests/main ./crowdsec-xxx/tests/ + @cp -R hub-tests/tests ./crowdsec-xxx/tests/ + @cd ./crowdsec-xxx/tests/ && bash ../../hub-tests/run_tests.sh + clean: @make -C $(CROWDSEC_FOLDER) clean --no-print-directory @make -C $(CSCLI_FOLDER) clean --no-print-directory diff --git a/pkg/types/event.go b/pkg/types/event.go index e1a43d382..37202ef48 100644 --- a/pkg/types/event.go +++ b/pkg/types/event.go @@ -19,9 +19,9 @@ type Event struct { /* the current stage of the line being parsed */ Stage string `yaml:"Stage,omitempty"` /* original line (produced by acquisition) */ - Line Line `json:"-" yaml:"Line,omitempty"` + Line Line `json:"Line" yaml:"Line,omitempty"` /* output of groks */ - Parsed map[string]string `json:"-" yaml:"Parsed,omitempty"` + Parsed map[string]string `json:"Parsed,omitempty" yaml:"Parsed,omitempty"` /* output of enrichment */ Enriched map[string]string `json:"Enriched,omitempty" yaml:"Enriched,omitempty"` /* Overflow */ diff --git a/scripts/install_all.sh b/scripts/install_all.sh new file mode 100644 index 000000000..38e15991c --- /dev/null +++ b/scripts/install_all.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +./cscli -c dev.yaml list parsers -a -o json | jq -r ".[].name" > installed_parsers.txt +cat installed_parsers.txt | while read parser; do + echo "install ${parser}" ; + ./cscli -c dev.yaml install parser ${parser} ; +done