Browse Source

provide makefile target for ci, and don't strip line when serializing Event

Thibault bui Koechlin 5 years ago
parent
commit
f4ba5e4425
3 changed files with 20 additions and 1 deletions
  1. 12 0
      Makefile
  2. 1 1
      pkg/types/event.go
  3. 7 0
      scripts/install_all.sh

+ 12 - 0
Makefile

@@ -39,6 +39,18 @@ goversion:
 	CURRENT_GOVERSION="$(shell go version | cut -d " " -f3 | sed -r 's/[go]+//g')"
 	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)"
 	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:
 clean:
 	@make -C $(CROWDSEC_FOLDER) clean --no-print-directory
 	@make -C $(CROWDSEC_FOLDER) clean --no-print-directory
 	@make -C $(CSCLI_FOLDER) clean --no-print-directory
 	@make -C $(CSCLI_FOLDER) clean --no-print-directory

+ 1 - 1
pkg/types/event.go

@@ -19,7 +19,7 @@ type Event struct {
 	/* the current stage of the line being parsed */
 	/* the current stage of the line being parsed */
 	Stage string `yaml:"Stage,omitempty"`
 	Stage string `yaml:"Stage,omitempty"`
 	/* original line (produced by acquisition) */
 	/* original line (produced by acquisition) */
-	Line Line `json:"-" yaml:"Line,omitempty"`
+	Line Line `json:"Line" yaml:"Line,omitempty"`
 	/* output of groks */
 	/* output of groks */
 	Parsed map[string]string `json:"Parsed,omitempty" yaml:"Parsed,omitempty"`
 	Parsed map[string]string `json:"Parsed,omitempty" yaml:"Parsed,omitempty"`
 	/* output of enrichment */
 	/* output of enrichment */

+ 7 - 0
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