Skip to content

Commit

Permalink
debug linux
Browse files Browse the repository at this point in the history
  • Loading branch information
oakrizan committed Oct 10, 2024
1 parent 32053ac commit 651768e
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 12 deletions.
5 changes: 0 additions & 5 deletions .buildkite/hooks/pre-command
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
15 changes: 12 additions & 3 deletions .buildkite/x-pack/pipeline.xpack.agentbeat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"
Expand All @@ -120,13 +128,14 @@ 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: |
Set-Item "Env:AGENTBEAT_PATH" python .buildkite/scripts/agentbeat/setup_agentbeat.py
cd x-pack/agentbeat
mage -v testWithSpec
agents:
Expand Down
20 changes: 16 additions & 4 deletions x-pack/agentbeat/magefile.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
package main

import (
"bufio"
"context"
"fmt"
"log"
Expand Down Expand Up @@ -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
}
}
Expand All @@ -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)
Expand All @@ -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:
Expand Down

0 comments on commit 651768e

Please sign in to comment.