From 9848cfea0213d0e150ec8bc7c9cb2a8ca13fd058 Mon Sep 17 00:00:00 2001 From: Mashhur Date: Wed, 9 Oct 2024 15:55:39 -0700 Subject: [PATCH 1/5] Check python script run on BK agent. --- .buildkite/scripts/health-report-tests/__init__.py | 0 .buildkite/scripts/health-report-tests/main.py | 11 +++++++++++ .buildkite/scripts/health-report-tests/main.sh | 8 ++------ .../scripts/health-report-tests/requirements.txt | 2 ++ 4 files changed, 15 insertions(+), 6 deletions(-) create mode 100644 .buildkite/scripts/health-report-tests/__init__.py create mode 100644 .buildkite/scripts/health-report-tests/main.py create mode 100644 .buildkite/scripts/health-report-tests/requirements.txt diff --git a/.buildkite/scripts/health-report-tests/__init__.py b/.buildkite/scripts/health-report-tests/__init__.py new file mode 100644 index 00000000000..e69de29bb2d diff --git a/.buildkite/scripts/health-report-tests/main.py b/.buildkite/scripts/health-report-tests/main.py new file mode 100644 index 00000000000..2df8ff4dd15 --- /dev/null +++ b/.buildkite/scripts/health-report-tests/main.py @@ -0,0 +1,11 @@ +""" + Main entry point of the LS health report API integration test suites +""" + + +def main(): + print(f"Hello World!") + + +if __name__ == "__main__": + main() diff --git a/.buildkite/scripts/health-report-tests/main.sh b/.buildkite/scripts/health-report-tests/main.sh index c31a4b120e3..f365a678fb6 100755 --- a/.buildkite/scripts/health-report-tests/main.sh +++ b/.buildkite/scripts/health-report-tests/main.sh @@ -1,9 +1,5 @@ #!/usr/bin/env bash set -eo pipefail -# TODO: -# if branch is specified with X.Y, pull branches from ACTIVE_BRANCHES_URL="https://raw.githubusercontent.com/elastic/logstash/main/ci/branches.json", parse and use -# build Logstash from specificed (ex: 8.x -> translates to 8.latest, 8.16) branch, defaults to main -# install requirements of the python package and run main.py - - +python3 -m pip install -r .buildkite/scripts/health-report-tests/requirements.txt +python3 .buildkite/scripts/health-report-tests/main.py \ No newline at end of file diff --git a/.buildkite/scripts/health-report-tests/requirements.txt b/.buildkite/scripts/health-report-tests/requirements.txt new file mode 100644 index 00000000000..c48e502117b --- /dev/null +++ b/.buildkite/scripts/health-report-tests/requirements.txt @@ -0,0 +1,2 @@ +requests==2.32.3 +pyyaml==6.0.2 \ No newline at end of file From b612ab3ffdf7963e3643c6eeb951bf2f3b26d010 Mon Sep 17 00:00:00 2001 From: Mashhur Date: Wed, 9 Oct 2024 16:07:00 -0700 Subject: [PATCH 2/5] Call python scripts directly from CI steps. --- .buildkite/health_report_tests_pipeline.yml | 6 ++++-- .buildkite/scripts/health-report-tests/main.sh | 5 ----- 2 files changed, 4 insertions(+), 7 deletions(-) delete mode 100755 .buildkite/scripts/health-report-tests/main.sh diff --git a/.buildkite/health_report_tests_pipeline.yml b/.buildkite/health_report_tests_pipeline.yml index 84d9bf9d4b1..40e1df775ba 100644 --- a/.buildkite/health_report_tests_pipeline.yml +++ b/.buildkite/health_report_tests_pipeline.yml @@ -10,8 +10,10 @@ steps: # todo: add a step for 8.latest when Health Report MVP is landed - label: ":logstash: Health Report Integration tests on main branch." command: | - source .buildkite/scripts/common/vm-agent.sh - ./.buildkite/scripts/health-report-tests/main.sh + echo "--- Installing dependencies" + python3 -m pip install -r .buildkite/scripts/health-report-tests/requirements.txt + echo "--- running tests" + python3 .buildkite/scripts/health-report-tests/main.py retry: automatic: - limit: 3 diff --git a/.buildkite/scripts/health-report-tests/main.sh b/.buildkite/scripts/health-report-tests/main.sh deleted file mode 100755 index f365a678fb6..00000000000 --- a/.buildkite/scripts/health-report-tests/main.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env bash -set -eo pipefail - -python3 -m pip install -r .buildkite/scripts/health-report-tests/requirements.txt -python3 .buildkite/scripts/health-report-tests/main.py \ No newline at end of file From fb5706ce3c170b95352cf013288ef7c8ea085e79 Mon Sep 17 00:00:00 2001 From: Mashhur Date: Wed, 9 Oct 2024 16:15:19 -0700 Subject: [PATCH 3/5] Align on a default BK agent. --- .buildkite/health_report_tests_pipeline.yml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/.buildkite/health_report_tests_pipeline.yml b/.buildkite/health_report_tests_pipeline.yml index 40e1df775ba..6a854644a30 100644 --- a/.buildkite/health_report_tests_pipeline.yml +++ b/.buildkite/health_report_tests_pipeline.yml @@ -1,11 +1,5 @@ # yaml-language-server: $schema=https://raw.githubusercontent.com/buildkite/pipeline-schema/main/schema.json -agents: - image: "docker.elastic.co/ci-agent-images/platform-ingest/buildkite-agent-logstash-ci" - cpu: "2" - memory: "4Gi" - ephemeralStorage: "64Gi" - steps: # todo: add a step for 8.latest when Health Report MVP is landed - label: ":logstash: Health Report Integration tests on main branch." From 1bdab40a66730003cf6aeb184a7e73c04a642cb9 Mon Sep 17 00:00:00 2001 From: Mashhur Date: Wed, 9 Oct 2024 16:29:38 -0700 Subject: [PATCH 4/5] Add CI step for 8.x branch --- .buildkite/health_report_tests_pipeline.yml | 36 +++++++++++++------ .../scripts/health-report-tests/main.py | 4 +++ 2 files changed, 30 insertions(+), 10 deletions(-) diff --git a/.buildkite/health_report_tests_pipeline.yml b/.buildkite/health_report_tests_pipeline.yml index 6a854644a30..76cb63473c6 100644 --- a/.buildkite/health_report_tests_pipeline.yml +++ b/.buildkite/health_report_tests_pipeline.yml @@ -1,13 +1,29 @@ # yaml-language-server: $schema=https://raw.githubusercontent.com/buildkite/pipeline-schema/main/schema.json steps: - # todo: add a step for 8.latest when Health Report MVP is landed - - label: ":logstash: Health Report Integration tests on main branch." - command: | - echo "--- Installing dependencies" - python3 -m pip install -r .buildkite/scripts/health-report-tests/requirements.txt - echo "--- running tests" - python3 .buildkite/scripts/health-report-tests/main.py - retry: - automatic: - - limit: 3 + - group: ":logstash: Health API integration tests" + key: "testing-phase" + steps: + - label: "main branch" + key: "integ-tests-on-main-branch" + command: | + echo "--- Installing dependencies" + python3 -m pip install -r .buildkite/scripts/health-report-tests/requirements.txt + echo "--- running tests" + python3 .buildkite/scripts/health-report-tests/main.py + retry: + automatic: + - limit: 3 + + - label: "8.latest branch" + key: "integ-tests-on-8.x-branch" + env: + LS_BRANCH: "8.x" + command: | + echo "--- Installing dependencies" + python3 -m pip install -r .buildkite/scripts/health-report-tests/requirements.txt + echo "--- running tests" + python3 .buildkite/scripts/health-report-tests/main.py + retry: + automatic: + - limit: 3 \ No newline at end of file diff --git a/.buildkite/scripts/health-report-tests/main.py b/.buildkite/scripts/health-report-tests/main.py index 2df8ff4dd15..951b389e8e7 100644 --- a/.buildkite/scripts/health-report-tests/main.py +++ b/.buildkite/scripts/health-report-tests/main.py @@ -1,10 +1,14 @@ """ Main entry point of the LS health report API integration test suites """ +import os def main(): print(f"Hello World!") + logstash_branch = os.environ.get("LS_BRANCH") + if logstash_branch is None: + print(f"LS_BRANCH is not specified, using main branch.") if __name__ == "__main__": From 4513041b9394fd3773bc9c3323350462157c04eb Mon Sep 17 00:00:00 2001 From: Mashhur Date: Wed, 9 Oct 2024 16:35:42 -0700 Subject: [PATCH 5/5] Fixing CI step key name convensions. --- .buildkite/health_report_tests_pipeline.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.buildkite/health_report_tests_pipeline.yml b/.buildkite/health_report_tests_pipeline.yml index 76cb63473c6..0ee856987d0 100644 --- a/.buildkite/health_report_tests_pipeline.yml +++ b/.buildkite/health_report_tests_pipeline.yml @@ -16,7 +16,7 @@ steps: - limit: 3 - label: "8.latest branch" - key: "integ-tests-on-8.x-branch" + key: "integ-tests-on-eight-latest-branch" env: LS_BRANCH: "8.x" command: |