Skip to content

Commit

Permalink
[8.13](backport #38924) migrate libbeat to static (#38973)
Browse files Browse the repository at this point in the history
* migrate libbeat to static (#38924)

* migrate libbeat to static

* remove dynamic pipeline

* Update pull-requests.json

* add paths and change the pre-command

* update pipeline.libbeat.yml

* Update .buildkite/libbeat/pipeline.libbeat.yml

Co-authored-by: Dimitrios Liappis <[email protected]>

* change commands and add notifications

* fix the pipeline

* fix the pipeline

* change paths

---------

Co-authored-by: Dimitrios Liappis <[email protected]>
(cherry picked from commit 74ddea2)

* Update pipeline.yml

* Update .buildkite/pipeline.yml

---------

Co-authored-by: Siarhei Harbuz <[email protected]>
Co-authored-by: Dimitrios Liappis <[email protected]>
  • Loading branch information
3 people authored Apr 17, 2024
1 parent 851159a commit 829f53e
Show file tree
Hide file tree
Showing 6 changed files with 132 additions and 177 deletions.
1 change: 0 additions & 1 deletion .buildkite/hooks/pre-command
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ fi
ENABLED_BEATS_PIPELINES_SLUGS=(
"auditbeat"
"filebeat"
"beats-libbeat"
"beats-metricbeat"
"beats-packetbeat"
"beats-winlogbeat"
Expand Down
143 changes: 105 additions & 38 deletions .buildkite/libbeat/pipeline.libbeat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,50 +4,117 @@ name: "beats-libbeat"
env:
AWS_ARM_INSTANCE_TYPE: "t4g.xlarge"
AWS_IMAGE_UBUNTU_ARM_64: "platform-ingest-beats-ubuntu-2004-aarch64"
BEATS_PROJECT_NAME: "libbeat"
GCP_DEFAULT_MACHINE_TYPE: "c2d-highcpu-8"
GCP_HI_PERF_MACHINE_TYPE: "c2d-highcpu-16"
IMAGE_UBUNTU_X86_64: "family/platform-ingest-beats-ubuntu-2204"

#Packaging
PACKAGING_ARM_PLATFORMS: "linux/arm64"
PACKAGING_PLATFORMS: "+all linux/amd64 linux/arm64 windows/amd64 darwin/amd64 darwin/arm64"

#Deps
ASDF_MAGE_VERSION: 1.15.0

steps:
- group: "Mandatory Tests"
key: "mandatory-tests"
steps:
- label: ":linux: Ubuntu Unit Tests"
key: "mandatory-linux-unit-test"
command: |
set -euo pipefail
cd libbeat
mage build unitTest
agents:
provider: "gcp"
image: "${IMAGE_UBUNTU_X86_64}"
machineType: "${GCP_DEFAULT_MACHINE_TYPE}"
artifact_paths:
- "libbeat/build/*.xml"
- "libbeat/build/*.json"
notify:
- github_commit_status:
context: "libbeat: Ununtu Unit Tests"

- label: ":go: Go Integration Tests"
key: "mandatory-int-test"
command: |
set -euo pipefail
cd libbeat
mage goIntegTest
agents:
provider: "gcp"
image: "${IMAGE_UBUNTU_X86_64}"
machineType: "${GCP_HI_PERF_MACHINE_TYPE}"
artifact_paths:
- "libbeat/build/*.xml"
- "libbeat/build/*.json"
notify:
- github_commit_status:
context: "libbeat: Go Integration Tests"

- label: ":python: Python Integration Tests"
key: "mandatory-python-int-test"
command: |
set -euo pipefail
cd libbeat
mage pythonIntegTest
agents:
provider: "gcp"
image: "${IMAGE_UBUNTU_X86_64}"
machineType: "${GCP_HI_PERF_MACHINE_TYPE}"
artifact_paths:
- "libbeat/build/*.xml"
- "libbeat/build/*.json"
notify:
- github_commit_status:
context: "libbeat: Python Integration Tests"

- label: ":negative_squared_cross_mark: Cross compile"
key: "mandatory-cross-compile"
command: |
set -euo pipefail
cd libbeat
make crosscompile
agents:
provider: "gcp"
image: "${IMAGE_UBUNTU_X86_64}"
machineType: "${GCP_HI_PERF_MACHINE_TYPE}"
artifact_paths:
- "libbeat/build/*.xml"
- "libbeat/build/*.json"
notify:
- github_commit_status:
context: "libbeat: Cross compile"

- label: ":testengine: Stress Tests"
key: "mandatory-stress-test"
command: |
set -euo pipefail
cd libbeat
make STRESS_TEST_OPTIONS='-timeout=20m -race -v -parallel 1' GOTEST_OUTPUT_OPTIONS=' | go-junit-report > libbeat-stress-test.xml' stress-tests
agents:
provider: "gcp"
image: "${IMAGE_UBUNTU_X86_64}"
machineType: "${GCP_DEFAULT_MACHINE_TYPE}"
artifact_paths: "libbeat/libbeat-stress-test.xml"
notify:
- github_commit_status:
context: "libbeat: Stress Tests"

- input: "Input Parameters"
key: "input-run-all-stages"
fields:
- select: "Libbeat - run_libbeat"
key: "run_libbeat"
options:
- label: "True"
value: "true"
- label: "False"
value: "false"
default: "false"
- select: "Libbeat - run_libbeat_arm_tests"
key: "run_libbeat_arm_tests"
options:
- label: "True"
value: "true"
- label: "False"
value: "false"
default: "false"
if: "build.source == 'ui'"

- wait: ~
if: "build.source == 'ui'"
allow_dependency_failure: false

- label: ":linux: Load dynamic Libbeat pipeline"
key: "libbeat-pipeline"
command: ".buildkite/scripts/generate_libbeat_pipeline.sh"
agents:
image: "docker.elastic.co/ci-agent-images/platform-ingest/buildkite-agent-beats-ci:latest"
notify:
- github_commit_status:
context: "${BEATS_PROJECT_NAME}: Load dynamic pipeline's steps"
- group: "Extended Tests"
key: "extended-tests"
if: build.env("BUILDKITE_PULL_REQUEST") == "false" || build.env("GITHUB_PR_LABELS") =~ /.*arm.*/
steps:
- label: ":linux: Ubuntu ARM64 Unit Tests"
key: "extended-arm64-unit-tests"
command: |
set -euo pipefail
cd libbeat
mage build unitTest
agents:
provider: "aws"
imagePrefix: "${AWS_IMAGE_UBUNTU_ARM_64}"
instanceType: "${AWS_ARM_INSTANCE_TYPE}"
artifact_paths:
- "libbeat/build/*.xml"
- "libbeat/build/*.json"
notify:
- github_commit_status:
context: "libbeat: Ubuntu ARM64 Unit Tests"
25 changes: 25 additions & 0 deletions .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -234,3 +234,28 @@ steps:
- BUILDKITE_PULL_REQUEST=${BUILDKITE_PULL_REQUEST}
- BUILDKITE_PULL_REQUEST_BASE_BRANCH=${BUILDKITE_PULL_REQUEST_BASE_BRANCH}
- GITHUB_PR_LABELS=${GITHUB_PR_LABELS}

- label: "Trigger Libbeat"
plugins:
- monorepo-diff#v1.0.1:
diff: "git diff --name-only origin/${GITHUB_PR_TARGET_BRANCH}...HEAD"
watch:
- path:
- libbeat/
- .buildkite/libbeat/pipeline.libbeat.yml
- .buildkite/scripts
- .buildkite/hooks
#OSS
- go.mod
- pytest.ini
- dev-tools/
- testing/
config:
trigger: "beats-libbeat"
build:
commit: "${BUILDKITE_COMMIT}"
branch: "${BUILDKITE_BRANCH}"
env:
- BUILDKITE_PULL_REQUEST=${BUILDKITE_PULL_REQUEST}
- BUILDKITE_PULL_REQUEST_BASE_BRANCH=${BUILDKITE_PULL_REQUEST_BASE_BRANCH}
- GITHUB_PR_LABELS=${GITHUB_PR_LABELS}
16 changes: 0 additions & 16 deletions .buildkite/pull-requests.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,6 @@
"skip_ci_on_only_changed": [ ],
"always_require_ci_on_changed": [ ]
},
{
"enabled": true,
"pipelineSlug": "beats-libbeat",
"allow_org_users": true,
"allowed_repo_permissions": ["admin", "write"],
"allowed_list": [ ],
"set_commit_status": true,
"build_on_commit": true,
"build_on_comment": true,
"trigger_comment_regex": "^/test libbeat$|^/test filebeat",
"always_trigger_comment_regex": "^/test libbeat$",
"skip_ci_labels": [ ],
"skip_target_branches": [ ],
"skip_ci_on_only_changed": [ ],
"always_require_ci_on_changed": ["^go.mod", "^pytest.ini", "^dev-tools/.*", "^libbeat/.*", "^testing/.*"]
},
{
"enabled": true,
"pipelineSlug": "beats-packetbeat",
Expand Down
4 changes: 2 additions & 2 deletions .buildkite/scripts/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ ONLY_DOCS=${ONLY_DOCS:-"true"}
OSS_MODULE_PATTERN="^[a-z0-9]+beat\\/module\\/([^\\/]+)\\/.*"
XPACK_MODULE_PATTERN="^x-pack\\/[a-z0-9]+beat\\/module\\/([^\\/]+)\\/.*"
# define if needed run the whole pipeline for the particular beat
[ -z "${run_libbeat+x}" ] && run_libbeat="$(buildkite-agent meta-data get run_libbeat --default "false")"
[ -z "${run_filebeat+x}" ] && run_filebeat="$(buildkite-agent meta-data get run_filebeat --default "false")"
[ -z "${run_packetbeat+x}" ] && run_packetbeat="$(buildkite-agent meta-data get run_packetbeat --default "false")"
[ -z "${run_winlogbeat+x}" ] && run_winlogbeat="$(buildkite-agent meta-data get run_winlogbeat --default "false")"
[ -z "${run_xpack_libbeat+x}" ] && run_xpack_libbeat="$(buildkite-agent meta-data get run_xpack_libbeat --default "false")"
Expand All @@ -23,7 +23,7 @@ XPACK_MODULE_PATTERN="^x-pack\\/[a-z0-9]+beat\\/module\\/([^\\/]+)\\/.*"
[ -z "${run_xpack_heartbeat+x}" ] && run_xpack_heartbeat="$(buildkite-agent meta-data get run_xpack_heartbeat --default "false")"

# define if needed run ARM platform-specific tests for the particular beat
[ -z "${run_libbeat_arm_tests+x}" ] && run_libbeat_arm_tests="$(buildkite-agent meta-data get run_libbeat_arm_tests --default "false")"
[ -z "${run_filebeat_arm_tests+x}" ] && run_filebeat_arm_tests="$(buildkite-agent meta-data get run_filebeat_arm_tests --default "false")"
[ -z "${run_packetbeat_arm_tests+x}" ] && run_packetbeat_arm_tests="$(buildkite-agent meta-data get run_packetbeat_arm_tests --default "false")"
[ -z "${run_xpack_auditbeat_arm_tests+x}" ] && run_xpack_auditbeat_arm_tests="$(buildkite-agent meta-data get run_xpack_auditbeat_arm_tests --default "false")"
[ -z "${run_xpack_filebeat_arm_tests+x}" ] && run_xpack_filebeat_arm_tests="$(buildkite-agent meta-data get run_xpack_filebeat_arm_tests --default "false")"
Expand Down
120 changes: 0 additions & 120 deletions .buildkite/scripts/generate_libbeat_pipeline.sh

This file was deleted.

0 comments on commit 829f53e

Please sign in to comment.