From 3d20bf479514c5a406cedff8a4801d6c163fff6c Mon Sep 17 00:00:00 2001 From: Olga Naidjonoka Date: Mon, 14 Oct 2024 15:32:30 +0300 Subject: [PATCH] debug macos --- .buildkite/hooks/pre-command | 5 +- .../scripts/agentbeat/setup_agentbeat.py | 14 ++-- .../x-pack/pipeline.xpack.agentbeat.yml | 82 +++++++++---------- dev-tools/mage/spec.go | 1 + 4 files changed, 50 insertions(+), 52 deletions(-) diff --git a/.buildkite/hooks/pre-command b/.buildkite/hooks/pre-command index a6755d9df3c1..cb5bb51eb803 100644 --- a/.buildkite/hooks/pre-command +++ b/.buildkite/hooks/pre-command @@ -19,10 +19,7 @@ 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) + AGENTBEAT_PATH=$(.buildkite/scripts/agentbeat/setup_agentbeat.py | tail -n 1) export AGENTBEAT_PATH fi diff --git a/.buildkite/scripts/agentbeat/setup_agentbeat.py b/.buildkite/scripts/agentbeat/setup_agentbeat.py index 818e048b999d..d2badaeae48c 100755 --- a/.buildkite/scripts/agentbeat/setup_agentbeat.py +++ b/.buildkite/scripts/agentbeat/setup_agentbeat.py @@ -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' @@ -48,9 +47,10 @@ 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) @@ -58,11 +58,11 @@ def download_agentbeat(pattern, path) -> str: 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) @@ -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) @@ -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)) diff --git a/.buildkite/x-pack/pipeline.xpack.agentbeat.yml b/.buildkite/x-pack/pipeline.xpack.agentbeat.yml index 8873ffe29b8e..0ffd2b9bd6a4 100644 --- a/.buildkite/x-pack/pipeline.xpack.agentbeat.yml +++ b/.buildkite/x-pack/pipeline.xpack.agentbeat.yml @@ -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" @@ -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" @@ -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}" diff --git a/dev-tools/mage/spec.go b/dev-tools/mage/spec.go index af0527fd6196..03c733f1dd6d 100644 --- a/dev-tools/mage/spec.go +++ b/dev-tools/mage/spec.go @@ -19,6 +19,7 @@ package mage import ( "gopkg.in/yaml.v2" + "log" "os" "strings"