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 7479dfa
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 38 deletions.
3 changes: 0 additions & 3 deletions .buildkite/hooks/pre-command
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@ 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)
export AGENTBEAT_PATH
fi
Expand Down
12 changes: 5 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,17 +47,17 @@ def download_agentbeat(pattern, path) -> str:
try:
subprocess.run(
['buildkite-agent', 'artifact', 'download', pattern, '.',
'--build', '01924d2b-b061-45ae-a106-e885584ff26f',
'--build', '01928f69-b34c-4555-8383-1a686ca20ddc',
'--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],
Expand Down Expand Up @@ -89,8 +88,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 @@ -109,7 +109,5 @@ def get_path_to_executable(filepath) -> str:

artifact_pattern = get_artifact_pattern()
archive = download_agentbeat(artifact_pattern, PATH)
print("--- Extracting")
extract_agentbeat(archive)
print("--- Getting path to exec")
log(get_path_to_executable(archive))
56 changes: 28 additions & 28 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 @@ -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 7479dfa

Please sign in to comment.