diff --git a/.buildkite/hooks/pre-command b/.buildkite/hooks/pre-command index 8b84984a282..5718d97879e 100644 --- a/.buildkite/hooks/pre-command +++ b/.buildkite/hooks/pre-command @@ -35,11 +35,6 @@ if [[ "$BUILDKITE_PIPELINE_SLUG" == "auditbeat" || \ export BUILDKITE_ANALYTICS_TOKEN fi -if [[ "$BUILDKITE_PIPELINE_SLUG" == "beats-xpack-agentbeat" ]]; then - AGENTBEAT_PATH=$(.buildkite/scripts/agentbeat/setup_agentbeat.py) - export AGENTBEAT_PATH -fi - CPU_ARCH=$(uname -m) PLATFORM_TYPE=$(uname) diff --git a/.buildkite/x-pack/pipeline.xpack.agentbeat.yml b/.buildkite/x-pack/pipeline.xpack.agentbeat.yml index 57618c671e4..a806aaa86c6 100644 --- a/.buildkite/x-pack/pipeline.xpack.agentbeat.yml +++ b/.buildkite/x-pack/pipeline.xpack.agentbeat.yml @@ -89,6 +89,12 @@ steps: # - x-pack/agentbeat/build/distributions/**/* # - "x-pack/agentbeat/build/*.xml" # - "x-pack/agentbeat/build/*.json" +# plugins: +# - test-collector#v1.10.2: +# files: "x-pack/agentbeat/build/TEST-*.xml" +# format: "junit" +# branches: "main" +# debug: true # retry: # automatic: # - limit: 1 @@ -103,15 +109,17 @@ steps: # - github_commit_status: # context: "agentbeat: Integration tests" - - label: ":linux: Agentbeat/Integration tests Linux" + - label: ":linux: x-pack/agentbeat: Ubuntu x86_64 Spec tests" key: "agentbeat-it-linux" env: PLATFORM: "linux/amd64" # depends_on: # - agentbeat-package-linux command: | + set +euo pipefail + AGENTBEAT_PATH=$(.buildkite/scripts/agentbeat/setup_agentbeat.py) + export AGENTBEAT_PATH cd x-pack/agentbeat - ls -la ../../agentbeat-9.0.0-SNAPSHOT-linux-x86_64 mage -v testWithSpec agents: provider: "gcp" @@ -120,13 +128,15 @@ steps: disk_size: 100 disk_type: "pd-ssd" - - label: ":linux: Agentbeat/Integration tests Windows" + - label: ":windows: x-pack/agentbeat: Windows x86_64 Spec tests" key: "agentbeat-it-windows" env: PLATFORM: "windows/amd64" # depends_on: # - agentbeat-package-linux command: | + $cmdOutput = python .buildkite/scripts/agentbeat/setup_agentbeat.py + Set-Item "Env:AGENTBEAT_PATH" $cmdOutput cd x-pack/agentbeat mage -v testWithSpec agents: diff --git a/x-pack/agentbeat/magefile.go b/x-pack/agentbeat/magefile.go index 0b29c6c5d74..386644b89af 100644 --- a/x-pack/agentbeat/magefile.go +++ b/x-pack/agentbeat/magefile.go @@ -7,6 +7,7 @@ package main import ( + "bufio" "context" "fmt" "log" @@ -240,9 +241,10 @@ func TestWithSpec(ctx context.Context) { hasFailures := false for cmd, res := range cmdResults { - if !res { - fmt.Printf("~~~ Failed: [%s]\n", cmd) - fmt.Print(res) + if res { + fmt.Printf("--- :large_green_circle: Succeeded:[%s.10s...]\n", cmd)) + } else { + fmt.Printf("--- :bangbang: Failed: [%s.10s...]\n", cmd) hasFailures = true } } @@ -255,7 +257,12 @@ func TestWithSpec(ctx context.Context) { func agentbeatCmd(agentbeatPath string, command string) bool { cmd := exec.Command(agentbeatPath, command) - fmt.Printf("Running command: %v\n", cmd) + fmt.Printf("Executing: %s.10s...\n", cmd.String()) + + stdout, err := cmd.StdoutPipe() + if err != nil { + fmt.Printf("Error creating stdout pipe: %v\n", err) + } if err := cmd.Start(); err != nil { fmt.Printf("failed to start command: %v\n", err) @@ -279,6 +286,11 @@ func agentbeatCmd(agentbeatPath string, command string) bool { select { case err := <-done: fmt.Printf("command exited before %s: %v\n", timeout.String(), err) + fmt.Println("printing command stdout") + scanner := bufio.NewScanner(stdout) + for scanner.Scan() { + fmt.Println(scanner.Text()) + } return false case <-deadline: