Skip to content

Commit

Permalink
debug macos
Browse files Browse the repository at this point in the history
  • Loading branch information
oakrizan committed Oct 15, 2024
1 parent 4271ccf commit 6c1a1b0
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 52 deletions.
6 changes: 2 additions & 4 deletions .buildkite/hooks/pre-command
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,8 @@ if [[ "$BUILDKITE_PIPELINE_SLUG" == "beats-xpack-packetbeat" && "$BUILDKITE_STEP
fi

if [[ "$BUILDKITE_PIPELINE_SLUG" == "beats-xpack-agentbeat" && "$BUILDKITE_STEP_KEY" == *"agentbeat-it"* ]]; then
if [[ "$BUILDKITE_STEP_KEY" == *"macos"* ]]; then
ulimit -Sn 10000
fi
AGENTBEAT_PATH=$(.buildkite/scripts/agentbeat/setup_agentbeat.py)
.buildkite/scripts/agentbeat/setup_agentbeat.py
AGENTBEAT_PATH=$(.buildkite/scripts/agentbeat/setup_agentbeat.py | tail -n 1)
export AGENTBEAT_PATH
fi

Expand Down
14 changes: 7 additions & 7 deletions .buildkite/scripts/agentbeat/setup_agentbeat.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
#!/usr/bin/env python3

import platform
import re
import subprocess
import sys
import tarfile
import re

PATH = 'x-pack/agentbeat/build/distributions'

Expand Down Expand Up @@ -48,21 +47,22 @@ def download_agentbeat(pattern, path) -> str:
try:
subprocess.run(
['buildkite-agent', 'artifact', 'download', pattern, '.',
'--build', '01924d2b-b061-45ae-a106-e885584ff26f',
'--build', '01928f55-8452-41c6-89ba-fe21f019f53c',
'--step', 'agentbeat-package-linux'],
check=True, stdout=sys.stdout, stderr=sys.stderr, text=True)

except subprocess.CalledProcessError:
exit(1)

return get_filename(path)


def get_filename(path) -> str:
print("--- Getting filename")
try:
out = subprocess.run(
['ls', '-p', path],
check=True, capture_output=True, text=True)
print("--- Filename: " + str(out))
return out.stdout.strip()
except subprocess.CalledProcessError:
exit(1)
Expand All @@ -89,8 +89,9 @@ def unzip_agentbeat(filepath):

def untar_agentbeat(filepath):
try:
with tarfile.open(filepath, 'r:gz') as tar:
with tarfile.open(filepath) as tar:
tar.extractall()
tar.close()
except Exception as e:
log_err(e)
exit(1)
Expand All @@ -108,8 +109,7 @@ def get_path_to_executable(filepath) -> str:


artifact_pattern = get_artifact_pattern()
print("--- Artifact pattern: " + artifact_pattern)
archive = download_agentbeat(artifact_pattern, PATH)
print("--- Extracting")
extract_agentbeat(archive)
print("--- Getting path to exec")
log(get_path_to_executable(archive))
82 changes: 41 additions & 41 deletions .buildkite/x-pack/pipeline.xpack.agentbeat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,26 +15,26 @@ env:
AGENTBEAT_SPEC: "./agentbeat.spec.yml"

steps:
- group: "Check/Update"
key: "x-pack-agentbeat-check-update"

steps:
- label: "agentbeat: Run pre-commit"
command: "pre-commit run --all-files"
agents:
image: "${IMAGE_BEATS_WITH_HOOKS_LATEST}"
memory: "2Gi"
useCustomGlobalHooks: true
notify:
- github_commit_status:
context: "agentbeat: pre-commit"

- wait: ~
# with PRs, we want to run mandatory tests only if check/update step succeed
# for other cases, e.g. merge commits, we want to run mundatory test (and publish) independently of other tests
# this allows building DRA artifacts even if there is flakiness in check/update step
if: build.env("BUILDKITE_PULL_REQUEST") != "false"
depends_on: "x-pack-agentbeat-check-update"
# - group: "Check/Update"
# key: "x-pack-agentbeat-check-update"
#
# steps:
# - label: "agentbeat: Run pre-commit"
# command: "pre-commit run --all-files"
# agents:
# image: "${IMAGE_BEATS_WITH_HOOKS_LATEST}"
# memory: "2Gi"
# useCustomGlobalHooks: true
# notify:
# - github_commit_status:
# context: "agentbeat: pre-commit"
#
# - wait: ~
# # with PRs, we want to run mandatory tests only if check/update step succeed
# # for other cases, e.g. merge commits, we want to run mundatory test (and publish) independently of other tests
# # this allows building DRA artifacts even if there is flakiness in check/update step
# if: build.env("BUILDKITE_PULL_REQUEST") != "false"
# depends_on: "x-pack-agentbeat-check-update"

- group: "Agentbeat tests"
key: "agentbeat-mandatory-tests"
Expand Down Expand Up @@ -109,21 +109,21 @@ steps:
# - github_commit_status:
# context: "agentbeat: Integration tests"

# - label: ":linux: x-pack/agentbeat: Ubuntu x86_64 Spec tests"
# key: "agentbeat-it-linux"
# env:
# PLATFORM: "linux/amd64"
- label: ":linux: x-pack/agentbeat: Ubuntu x86_64 Spec tests"
key: "agentbeat-it-linux"
env:
PLATFORM: "linux/amd64"
# depends_on:
# - agentbeat-package-linux
# command: |
# cd x-pack/agentbeat
# mage -v testWithSpec
# agents:
# provider: "gcp"
# image: "${IMAGE_UBUNTU_X86_64}"
# machineType: "${GCP_HI_PERF_MACHINE_TYPE}"
# disk_size: 100
# disk_type: "pd-ssd"
command: |
cd x-pack/agentbeat
mage -v testWithSpec
agents:
provider: "gcp"
image: "${IMAGE_UBUNTU_X86_64}"
machineType: "${GCP_HI_PERF_MACHINE_TYPE}"
disk_size: 100
disk_type: "pd-ssd"
#
# - label: ":windows: x-pack/agentbeat: Windows x86_64 Spec tests"
# key: "agentbeat-it-windows"
Expand Down Expand Up @@ -152,13 +152,13 @@ steps:
provider: "orka"
imagePrefix: "${IMAGE_MACOS_X86_64}"

- label: ":linux: Agentbeat/Integration tests macOS arm64"
key: "agentbeat-it-macos-arm"
# - label: ":linux: Agentbeat/Integration tests macOS arm64"
# key: "agentbeat-it-macos-arm"
# depends_on:
# - agentbeat-package-linux
command: |
cd x-pack/agentbeat
mage -v testWithSpec
agents:
provider: "orka"
imagePrefix: "${IMAGE_MACOS_ARM}"
# command: |
# cd x-pack/agentbeat
# mage -v testWithSpec
# agents:
# provider: "orka"
# imagePrefix: "${IMAGE_MACOS_ARM}"
1 change: 1 addition & 0 deletions dev-tools/mage/spec.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package mage

import (
"gopkg.in/yaml.v2"

"log"
"os"
"strings"
Expand Down

0 comments on commit 6c1a1b0

Please sign in to comment.