diff --git a/.buildkite/hooks/pre-command b/.buildkite/hooks/pre-command index 6843a8ed5408..f3e74714e947 100644 --- a/.buildkite/hooks/pre-command +++ b/.buildkite/hooks/pre-command @@ -62,7 +62,6 @@ ENABLED_BEATS_PIPELINES_SLUGS=( "beats-winlogbeat" "beats-winlogbeat" "beats-xpack-libbeat" - "beats-xpack-metricbeat" "beats-xpack-packetbeat" "beats-xpack-winlogbeat" "beats-xpack-dockerlogbeat" @@ -80,8 +79,8 @@ for slug in "${ENABLED_BEATS_PIPELINES_SLUGS[@]}"; do fi done -if [[ "$BUILDKITE_PIPELINE_SLUG" == "beats-xpack-metricbeat" || "$BUILDKITE_PIPELINE_SLUG" == "beats-xpack-filebeat" ]]; then - if [[ "$BUILDKITE_STEP_KEY" == "extended-cloud-test" ]]; then +if [[ "$BUILDKITE_PIPELINE_SLUG" == *"xpack-metricbeat"* || "$BUILDKITE_PIPELINE_SLUG" == "beats-xpack-filebeat" ]]; then + if [[ "$BUILDKITE_STEP_KEY" == *"extended-cloud-test"* ]]; then BEATS_AWS_SECRET_KEY=$(retry_with_count 5 vault kv get -field secret_key ${AWS_SERVICE_ACCOUNT_SECRET_PATH}) export BEATS_AWS_SECRET_KEY BEATS_AWS_ACCESS_KEY=$(retry_with_count 5 vault kv get -field access_key ${AWS_SERVICE_ACCOUNT_SECRET_PATH}) diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml index 369812c4ac9b..978949b51d0f 100644 --- a/.buildkite/pipeline.yml +++ b/.buildkite/pipeline.yml @@ -102,6 +102,33 @@ steps: - BUILDKITE_PULL_REQUEST_BASE_BRANCH=${BUILDKITE_PULL_REQUEST_BASE_BRANCH} - GITHUB_PR_LABELS=${GITHUB_PR_LABELS} + - label: "Trigger x-pack/metricbeat" + plugins: + - monorepo-diff#v1.0.1: + diff: "git diff --name-only origin/${GITHUB_PR_TARGET_BRANCH}...HEAD" + watch: + - path: + - x-pack/metricbeat/ + - x-pack/libbeat/common/aws + - .buildkite/x-pack/pipeline.xpack.metricbeat.yml + - .buildkite/scripts + - .buildkite/hooks/ + #OSS + - go.mod + - pytest.ini + - dev-tools/ + - libbeat/** + - testing/** + config: + trigger: "beats-xpack-metricbeat" + 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} + - label: "Trigger Xpack/Winlogbeat" plugins: - monorepo-diff#v1.0.1: diff --git a/.buildkite/pull-requests.json b/.buildkite/pull-requests.json index 2d63d9b7fcb3..d787efb5a693 100644 --- a/.buildkite/pull-requests.json +++ b/.buildkite/pull-requests.json @@ -112,22 +112,6 @@ "skip_ci_on_only_changed": [ ], "always_require_ci_on_changed": ["^x-pack/libbeat/.*", "^.buildkite/.*", "^go.mod", "^pytest.ini", "^dev-tools/.*", "^libbeat/.*", "^testing/.*", "^x-pack/libbeat/.*"] }, - { - "enabled": true, - "pipelineSlug": "beats-xpack-metricbeat", - "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 x-pack/metricbeat$", - "always_trigger_comment_regex": "^/test x-pack/metricbeat$", - "skip_ci_labels": [ ], - "skip_target_branches": [ ], - "skip_ci_on_only_changed": [ ], - "always_require_ci_on_changed": ["^x-pack/metricbeat/.*", "^.buildkite/.*", "^go.mod", "^pytest.ini", "^dev-tools/.*", "^libbeat/.*", "^testing/.*", "^x-pack/libbeat/.*"] - }, { "enabled": true, "pipelineSlug": "beats-xpack-auditbeat", diff --git a/.buildkite/scripts/cloud_tests.sh b/.buildkite/scripts/cloud_tests.sh index 3ca52305188b..3deeb89671f8 100755 --- a/.buildkite/scripts/cloud_tests.sh +++ b/.buildkite/scripts/cloud_tests.sh @@ -2,9 +2,7 @@ set -euo pipefail # What Terraform Module will run -if [[ "$BUILDKITE_PIPELINE_SLUG" == "beats-xpack-metricbeat" ]]; then - export MODULE_DIR="x-pack/metricbeat/module/aws" -elif [[ "$BUILDKITE_PIPELINE_SLUG" == "beats-xpack-filebeat" ]]; then +if [[ "$BUILDKITE_PIPELINE_SLUG" == "beats-xpack-filebeat" ]]; then export MODULE_DIR="x-pack/filebeat/input/awss3/_meta/terraform" fi diff --git a/.buildkite/scripts/common.sh b/.buildkite/scripts/common.sh index c1c009141c7f..386bc5aaf427 100755 --- a/.buildkite/scripts/common.sh +++ b/.buildkite/scripts/common.sh @@ -87,10 +87,6 @@ xpack_libbeat_changeset=( "^x-pack/libbeat/.*" ) -xpack_metricbeat_changeset=( - "^x-pack/metricbeat/.*" - ) - xpack_osquerybeat_changeset=( "^x-pack/osquerybeat/.*" ) diff --git a/.buildkite/scripts/generate_xpack_metricbeat_pipeline.sh b/.buildkite/scripts/generate_xpack_metricbeat_pipeline.sh deleted file mode 100755 index 788cfba1e542..000000000000 --- a/.buildkite/scripts/generate_xpack_metricbeat_pipeline.sh +++ /dev/null @@ -1,271 +0,0 @@ -#!/usr/bin/env bash - -source .buildkite/scripts/common.sh - -set -euo pipefail - -pipelineName="pipeline.xpack-metricbeat-dynamic.yml" - -echo "Add the mandatory and extended tests without additional conditions into the pipeline" -if are_conditions_met_mandatory_tests; then - cat > $pipelineName <<- YAML - -steps: - - - group: "Mandatory Tests" - key: "mandatory-tests" - steps: - - label: ":linux: Ubuntu Unit Tests" - key: "mandatory-linux-unit-test" - command: | - cd $BEATS_PROJECT_NAME - mage build unitTest - agents: - provider: "gcp" - image: "${IMAGE_UBUNTU_X86_64}" - machineType: "${GCP_DEFAULT_MACHINE_TYPE}" - artifact_paths: - - "$BEATS_PROJECT_NAME/build/*.xml" - - "$BEATS_PROJECT_NAME/build/*.json" - notify: - - github_commit_status: - context: "$BEATS_PROJECT_NAME: Ubuntu Unit Tests" - - - label: ":go: Go (MODULE) Integration Tests" - key: "mandatory-int-test" - command: | - cd $BEATS_PROJECT_NAME - mage goIntegTest - env: - MODULE: $MODULE - agents: - provider: "gcp" - image: "${IMAGE_UBUNTU_X86_64}" - machineType: "${GCP_DEFAULT_MACHINE_TYPE}" - artifact_paths: - - "$BEATS_PROJECT_NAME/build/*.xml" - - "$BEATS_PROJECT_NAME/build/*.json" - notify: - - github_commit_status: - context: "$BEATS_PROJECT_NAME: Go (MODULE) Integration Tests" - - - label: ":python: Python (MODULE) Integration Tests" - key: "mandatory-python-int-test" - command: | - cd $BEATS_PROJECT_NAME - mage pythonIntegTest - env: - MODULE: $MODULE - agents: - provider: "gcp" - image: "${IMAGE_UBUNTU_X86_64}" - machineType: "${GCP_DEFAULT_MACHINE_TYPE}" - artifact_paths: - - "$BEATS_PROJECT_NAME/build/*.xml" - - "$BEATS_PROJECT_NAME/build/*.json" - notify: - - github_commit_status: - context: "$BEATS_PROJECT_NAME: Python (MODULE) Integration Tests" - - - label: ":windows: Windows 2016 Unit Tests" - command: | - Set-Location -Path $BEATS_PROJECT_NAME - mage build unitTest - key: "mandatory-win-2016-unit-tests" - agents: - provider: "gcp" - image: "${IMAGE_WIN_2016}" - machine_type: "${GCP_WIN_MACHINE_TYPE}" - disk_size: 100 - disk_type: "pd-ssd" - artifact_paths: - - "$BEATS_PROJECT_NAME/build/*.xml" - - "$BEATS_PROJECT_NAME/build/*.json" - notify: - - github_commit_status: - context: "$BEATS_PROJECT_NAME: Windows 2016 Unit Tests" - - - label: ":windows: Windows 2022 Unit Tests" - command: | - Set-Location -Path $BEATS_PROJECT_NAME - mage build unitTest - key: "mandatory-win-2022-unit-tests" - agents: - provider: "gcp" - image: "${IMAGE_WIN_2022}" - machine_type: "${GCP_WIN_MACHINE_TYPE}" - disk_size: 100 - disk_type: "pd-ssd" - artifact_paths: - - "$BEATS_PROJECT_NAME/build/*.xml" - - "$BEATS_PROJECT_NAME/build/*.json" - notify: - - github_commit_status: - context: "$BEATS_PROJECT_NAME: Windows 2022 Unit Tests" - -## TODO: this condition will be changed in the Phase 3 of the Migration Plan https://docs.google.com/document/d/1IPNprVtcnHlem-uyGZM0zGzhfUuFAh4LeSl9JFHMSZQ/edit#heading=h.sltz78yy249h - - group: "Extended Windows Tests" - key: "extended-win-tests" - steps: - - label: ":windows: Windows 10 Unit Tests" - command: | - Set-Location -Path $BEATS_PROJECT_NAME - mage build unitTest - key: "extended-win-10-unit-tests" - agents: - provider: "gcp" - image: "${IMAGE_WIN_10}" - machineType: "${GCP_WIN_MACHINE_TYPE}" - disk_size: 100 - disk_type: "pd-ssd" - artifact_paths: - - "$BEATS_PROJECT_NAME/build/*.xml" - - "$BEATS_PROJECT_NAME/build/*.json" - notify: - - github_commit_status: - context: "$BEATS_PROJECT_NAME: Windows 10 Unit Tests" - - - label: ":windows: Windows 11 Unit Tests" - command: | - Set-Location -Path $BEATS_PROJECT_NAME - mage build unitTest - key: "extended-win-11-unit-tests" - agents: - provider: "gcp" - image: "${IMAGE_WIN_11}" - machineType: "${GCP_WIN_MACHINE_TYPE}" - disk_size: 100 - disk_type: "pd-ssd" - artifact_paths: - - "$BEATS_PROJECT_NAME/build/*.xml" - - "$BEATS_PROJECT_NAME/build/*.json" - notify: - - github_commit_status: - context: "$BEATS_PROJECT_NAME: Windows 11 Unit Tests" - - - label: ":windows: Windows 2019 Unit Tests" - command: | - Set-Location -Path $BEATS_PROJECT_NAME - mage build unitTest - key: "extended-win-2019-unit-tests" - agents: - provider: "gcp" - image: "${IMAGE_WIN_2019}" - machineType: "${GCP_WIN_MACHINE_TYPE}" - disk_size: 100 - disk_type: "pd-ssd" - artifact_paths: - - "$BEATS_PROJECT_NAME/build/*.xml" - - "$BEATS_PROJECT_NAME/build/*.json" - notify: - - github_commit_status: - context: "$BEATS_PROJECT_NAME: Windows 2019 Unit Tests" - -YAML -else - echo "The conditions don't match to requirements for generating pipeline steps." - exit 0 -fi - -#TODO: replace by commented-out below condition when issues mentioned in the PR https://github.com/elastic/beats/pull/38081 are resolved -if are_conditions_met_aws_tests || are_conditions_met_macos_tests ; then - cat >> $pipelineName <<- YAML - - - group: "Extended Tests" - key: "extended-tests" - steps: - -YAML -fi - -if are_conditions_met_macos_tests; then - cat >> $pipelineName <<- YAML - - - label: ":mac: MacOS Unit Tests" - key: "extended-macos-unit-tests" - command: ".buildkite/scripts/unit_tests.sh" - agents: - provider: "orka" - imagePrefix: "${IMAGE_MACOS_X86_64}" - artifact_paths: - - "$BEATS_PROJECT_NAME/build/*.xml" - - "$BEATS_PROJECT_NAME/build/*.json" - notify: - - github_commit_status: - context: "$BEATS_PROJECT_NAME: MacOS Unit Tests" - -YAML -fi - -if are_conditions_met_aws_tests; then - cat >> $pipelineName <<- YAML - - label: ":linux: Cloud (MODULE) Tests" - key: "extended-cloud-test" - command: ".buildkite/scripts/cloud_tests.sh" - skip: "Does not belong to a stage, exists but not run" - env: - MODULE: $MODULE - ASDF_TERRAFORM_VERSION: 1.0.2 - agents: - provider: "gcp" - image: "${IMAGE_UBUNTU_X86_64}" - machineType: "${GCP_DEFAULT_MACHINE_TYPE}" - artifact_paths: - - "$BEATS_PROJECT_NAME/build/*.xml" - - "$BEATS_PROJECT_NAME/build/*.json" - notify: - - github_commit_status: - context: "$BEATS_PROJECT_NAME: Cloud (MODULE) Tests" - -YAML -fi - -echo "Check and add the Packaging into the pipeline" -if are_conditions_met_packaging; then - cat >> $pipelineName <<- YAML - - - wait: ~ - depends_on: - - step: "mandatory-tests" - allow_failure: false - - - group: "Packaging" # TODO: check conditions for future the main pipeline migration: https://github.com/elastic/beats/pull/28589 - key: "packaging" - steps: - - label: ":linux: Packaging Linux" - key: "packaging-linux" - command: "cd $BEATS_PROJECT_NAME && mage package" - agents: - provider: "gcp" - image: "${IMAGE_UBUNTU_X86_64}" - machineType: "${GCP_HI_PERF_MACHINE_TYPE}" - disk_size: 100 - disk_type: "pd-ssd" - env: - PLATFORMS: "${PACKAGING_PLATFORMS}" - notify: - - github_commit_status: - context: "$BEATS_PROJECT_NAME: Packaging Linux" - - - label: ":linux: Packaging ARM" - key: "packaging-arm" - command: "cd $BEATS_PROJECT_NAME && mage package" - agents: - provider: "aws" - imagePrefix: "${IMAGE_UBUNTU_ARM_64}" - instanceType: "${AWS_ARM_INSTANCE_TYPE}" - env: - PLATFORMS: "${PACKAGING_ARM_PLATFORMS}" - PACKAGES: "docker" - notify: - - github_commit_status: - context: "$BEATS_PROJECT_NAME: Packaging Linux ARM" - -YAML -fi - -echo "+++ Printing dynamic steps" -cat $pipelineName | yq . -P - -echo "~~~ Loading dynamic steps" -buildkite-agent pipeline upload $pipelineName diff --git a/.buildkite/x-pack/pipeline.xpack.metricbeat.yml b/.buildkite/x-pack/pipeline.xpack.metricbeat.yml index 855c59b8bac2..3b79117e46b2 100644 --- a/.buildkite/x-pack/pipeline.xpack.metricbeat.yml +++ b/.buildkite/x-pack/pipeline.xpack.metricbeat.yml @@ -3,13 +3,13 @@ name: "beats-xpack-metricbeat" env: AWS_ARM_INSTANCE_TYPE: "t4g.xlarge" - BEATS_PROJECT_NAME: "x-pack/metricbeat" + GCP_DEFAULT_MACHINE_TYPE: "c2d-highcpu-8" GCP_HI_PERF_MACHINE_TYPE: "c2d-highcpu-16" GCP_WIN_MACHINE_TYPE: "n2-standard-8" + IMAGE_MACOS_ARM: "generic-13-ventura-arm" IMAGE_MACOS_X86_64: "generic-13-ventura-x64" - IMAGE_RHEL9_X86_64: "family/platform-ingest-beats-rhel-9" IMAGE_UBUNTU_ARM_64: "platform-ingest-beats-ubuntu-2204-aarch64" IMAGE_UBUNTU_X86_64: "family/platform-ingest-beats-ubuntu-2204" IMAGE_WIN_10: "family/platform-ingest-beats-windows-10" @@ -18,54 +18,300 @@ env: IMAGE_WIN_2019: "family/platform-ingest-beats-windows-2019" IMAGE_WIN_2022: "family/platform-ingest-beats-windows-2022" - #Packaging - PACKAGING_ARM_PLATFORMS: "linux/arm64" - PACKAGING_PLATFORMS: "+all linux/amd64 linux/arm64 windows/amd64 darwin/amd64 darwin/arm64" - - #Deps + # Other deps ASDF_MAGE_VERSION: 1.15.0 steps: + - group: "x-pack/metricbeat Mandatory Tests" + key: "x-pack-metricbeat-mandatory-tests" + steps: + - label: ":linux: Ubuntu Unit Tests" + key: "mandatory-linux-unit-test" + command: | + cd x-pack/metricbeat + mage build unitTest + agents: + provider: "gcp" + image: "${IMAGE_UBUNTU_X86_64}" + machineType: "${GCP_DEFAULT_MACHINE_TYPE}" + artifact_paths: + - "x-pack/metricbeat/build/*.xml" + - "x-pack/metricbeat/build/*.json" + notify: + - github_commit_status: + context: "x-pack/metricbeat: Ubuntu Unit Tests" + + - label: ":go: Go (MODULE) Integration Tests" + key: "mandatory-int-test" + command: | + set -euo pipefail + # defines the MODULE env var based on what's changed in a PR + source .buildkite/scripts/changesets.sh + defineModuleFromTheChangeSet x-pack/metricbeat + echo "~~~ Will run tests with env var MODULE=$$MODULE" + cd x-pack/metricbeat && mage goIntegTest + agents: + provider: "gcp" + image: "${IMAGE_UBUNTU_X86_64}" + machineType: "${GCP_DEFAULT_MACHINE_TYPE}" + artifact_paths: + - "x-pack/metricbeat/build/*.xml" + - "x-pack/metricbeat/build/*.json" + notify: + - github_commit_status: + context: "x-pack/metricbeat: Go (MODULE) Integration Tests" + + - label: ":python: Python (MODULE) Integration Tests" + key: "mandatory-python-int-test" + command: | + set -euo pipefail + # defines the MODULE env var based on what's changed in a PR + source .buildkite/scripts/changesets.sh + defineModuleFromTheChangeSet x-pack/metricbeat + echo "~~~ Running tests with env var MODULE=$$MODULE" + cd x-pack/metricbeat && mage pythonIntegTest + agents: + provider: "gcp" + image: "${IMAGE_UBUNTU_X86_64}" + machineType: "${GCP_DEFAULT_MACHINE_TYPE}" + artifact_paths: + - "x-pack/metricbeat/build/*.xml" + - "x-pack/metricbeat/build/*.json" + notify: + - github_commit_status: + context: "x-pack/metricbeat: Python (MODULE) Integration Tests" + + - label: ":windows: Windows 2016 Unit Tests" + command: | + Set-Location -Path x-pack/metricbeat + mage build unitTest + key: "mandatory-win-2016-unit-tests" + agents: + provider: "gcp" + image: "${IMAGE_WIN_2016}" + machine_type: "${GCP_WIN_MACHINE_TYPE}" + disk_size: 100 + disk_type: "pd-ssd" + artifact_paths: + - "x-pack/metricbeat/build/*.xml" + - "x-pack/metricbeat/build/*.json" + notify: + - github_commit_status: + context: "x-pack/metricbeat: Windows 2016 Unit Tests" + + - label: ":windows: Windows 2022 Unit Tests" + command: | + Set-Location -Path x-pack/metricbeat + mage build unitTest + key: "mandatory-win-2022-unit-tests" + agents: + provider: "gcp" + image: "${IMAGE_WIN_2022}" + machine_type: "${GCP_WIN_MACHINE_TYPE}" + disk_size: 100 + disk_type: "pd-ssd" + artifact_paths: + - "x-pack/metricbeat/build/*.xml" + - "x-pack/metricbeat/build/*.json" + notify: + - github_commit_status: + context: "x-pack/metricbeat: Windows 2022 Unit Tests" + + - group: "x-pack/metricbeat Extended Windows Tests" + key: "x-pack-metricbeat-extended-win-tests" + if: build.env("BUILDKITE_PULL_REQUEST") == "false" || build.env("GITHUB_PR_LABELS") =~ /.*[Ww]indows.*/ + steps: + - label: ":windows: Windows 10 Unit Tests" + command: | + Set-Location -Path x-pack/metricbeat + mage build unitTest + key: "extended-win-10-unit-tests" + agents: + provider: "gcp" + image: "${IMAGE_WIN_10}" + machineType: "${GCP_WIN_MACHINE_TYPE}" + disk_size: 100 + disk_type: "pd-ssd" + artifact_paths: + - "x-pack/metricbeat/build/*.xml" + - "x-pack/metricbeat/build/*.json" + notify: + - github_commit_status: + context: "x-pack/metricbeat: Windows 10 Unit Tests" - - input: "Input Parameters" - key: "force-run-stages" - fields: - - select: "Metricbeat - run_xpack_metricbeat" - key: "run_xpack_metricbeat" - options: - - label: "True" - value: "true" - - label: "False" - value: "false" - default: "false" - - select: "Metricbeat - run_xpack_metricbeat_macos_tests" - key: "run_xpack_metricbeat_macos_tests" - options: - - label: "True" - value: "true" - - label: "False" - value: "false" - default: "false" - - select: "Metricbeat - run_xpack_metricbeat_aws_tests" - key: "run_xpack_metricbeat_aws_tests" - options: - - label: "True" - value: "true" - - label: "False" - value: "false" - default: "false" - - if: "build.source == 'ui'" + - label: ":windows: Windows 11 Unit Tests" + command: | + Set-Location -Path x-pack/metricbeat + mage build unitTest + key: "extended-win-11-unit-tests" + agents: + provider: "gcp" + image: "${IMAGE_WIN_11}" + machineType: "${GCP_WIN_MACHINE_TYPE}" + disk_size: 100 + disk_type: "pd-ssd" + artifact_paths: + - "x-pack/metricbeat/build/*.xml" + - "x-pack/metricbeat/build/*.json" + notify: + - github_commit_status: + context: "x-pack/metricbeat: Windows 11 Unit Tests" + + - label: ":windows: Windows 2019 Unit Tests" + command: | + Set-Location -Path x-pack/metricbeat + mage build unitTest + key: "extended-win-2019-unit-tests" + agents: + provider: "gcp" + image: "${IMAGE_WIN_2019}" + machineType: "${GCP_WIN_MACHINE_TYPE}" + disk_size: 100 + disk_type: "pd-ssd" + artifact_paths: + - "x-pack/metricbeat/build/*.xml" + - "x-pack/metricbeat/build/*.json" + notify: + - github_commit_status: + context: "x-pack/metricbeat: Windows 2019 Unit Tests" + + - group: "x-pack/metricbeat Extended Tests" + key: "x-pack-metricbeat-extended-tests" + if: build.env("BUILDKITE_PULL_REQUEST") == "false" || build.env("GITHUB_PR_LABELS") =~ /.*(macOS|aws).*/ + steps: + - label: ":mac: MacOS x86_64 Unit Tests" + if: build.env("GITHUB_PR_LABELS") =~ /.*macOS.*/ + command: | + set -euo pipefail + source .buildkite/scripts/install_macos_tools.sh + cd x-pack/metricbeat && mage build unitTest + agents: + provider: "orka" + imagePrefix: "${IMAGE_MACOS_X86_64}" + artifact_paths: + - "x-pack/metricbeat/build/*.xml" + - "x-pack/metricbeat/build/*.json" + notify: + - github_commit_status: + context: "x-pack/metricbeat: MacOS x86_64 Unit Tests" + + - label: ":mac: MacOS arm64 Unit Tests" + skip: "https://github.com/elastic/beats/issues/33036" + if: build.env("GITHUB_PR_LABELS") =~ /.*macOS.*/ + command: | + set -euo pipefail + source .buildkite/scripts/install_macos_tools.sh + cd x-pack/metricbeat && mage build unitTest + agents: + provider: "orka" + imagePrefix: "${IMAGE_MACOS_ARM}" + artifact_paths: + - "x-pack/metricbeat/build/*.xml" + - "x-pack/metricbeat/build/*.json" + notify: + - github_commit_status: + context: "x-pack/metricbeat: MacOS arm64 Unit Tests" + + - label: ":linux: Cloud (MODULE) Tests" + key: "x-pack-metricbeat-extended-cloud-test" + skip: "doesn't belong in a stage in Jenkins, thus skipped" + # see link in Jenkins: https://github.com/elastic/beats/blob/ccd7b135df70358f8a02393d9bd8b716428b8048/x-pack/metricbeat/Jenkinsfile.yml#L39 + # additionally skipping due to https://github.com/elastic/ingest-dev/issues/3170 + command: | + set -euo pipefail + # defines the MODULE env var based on what's changed in a PR + source .buildkite/scripts/changesets.sh + defineModuleFromTheChangeSet x-pack/metricbeat + echo "~~~ Running tests with env var MODULE=$$MODULE" + + .buildkite/scripts/cloud_tests.sh + env: + ASDF_TERRAFORM_VERSION: 1.0.2 + AWS_REGION: "eu-central-1" + BEATS_PROJECT_NAME: x-pack/metricbeat + MODULE_DIR: x-pack/metricbeat/module/aws + REPO: beats + agents: + provider: "gcp" + image: "${IMAGE_UBUNTU_X86_64}" + machineType: "${GCP_DEFAULT_MACHINE_TYPE}" + artifact_paths: + - "x-pack/metricbeat/build/*.xml" + - "x-pack/metricbeat/build/*.json" + notify: + - github_commit_status: + context: "x-pack/metricbeat: Cloud (MODULE) Tests" + + - label: ":linux: Cloud AWS (MODULE) Tests" + key: "x-pack-metricbeat-extended-cloud-test-aws" + if: build.env("GITHUB_PR_LABELS") =~ /.*aws.*/ + skip: "https://github.com/elastic/beats/issues/36425" + # see commented out section in Jenkins: https://github.com/elastic/beats/blob/main/x-pack/metricbeat/Jenkinsfile.yml#L41-L52 + # additionally skipping due to https://github.com/elastic/ingest-dev/issues/3170 + command: | + set -euo pipefail + # defines the MODULE env var based on what's changed in a PR + source .buildkite/scripts/changesets.sh + defineModuleFromTheChangeSet x-pack/metricbeat + echo "~~~ Running tests with env var MODULE=$$MODULE" + .buildkite/scripts/cloud_tests.sh + env: + ASDF_TERRAFORM_VERSION: 1.0.2 + AWS_REGION: "eu-central-1" + BEATS_PROJECT_NAME: x-pack/metricbeat + MODULE_DIR: x-pack/metricbeat/module/aws + REPO: beats + agents: + provider: "aws" + imagePrefix: "${IMAGE_UBUNTU_ARM_64}" + instanceType: "${AWS_ARM_INSTANCE_TYPE}" + artifact_paths: + - "x-pack/metricbeat/build/*.xml" + - "x-pack/metricbeat/build/*.json" + notify: + - github_commit_status: + context: "x-pack/metricbeat: Cloud AWS (MODULE) Tests" - wait: ~ - if: "build.source == 'ui'" - allow_dependency_failure: false - - - label: ":linux: Load dynamic x-pack metricbeat pipeline" - key: "xpack-metricbeat-pipeline" - command: ".buildkite/scripts/generate_xpack_metricbeat_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" + # with PRs, we want to run packaging only if mandatory tests succeed + # for other cases, e.g. merge commits, we want to run packaging (and publish) independently of other tests + # this allows building DRA artifacts even if there is flakiness in mandatory tests + if: build.env("BUILDKITE_PULL_REQUEST") != "false" + depends_on: + - step: "x-pack-metricbeat-mandatory-tests" + + - group: "x-pack/metricbeat Packaging" + key: "x-pack-metricbeat-packaging" + steps: + - label: ":linux: Packaging Linux" + key: "packaging-linux" + command: | + cd x-pack/metricbeat + mage package + agents: + provider: "gcp" + image: "${IMAGE_UBUNTU_X86_64}" + machineType: "${GCP_HI_PERF_MACHINE_TYPE}" + disk_size: 100 + disk_type: "pd-ssd" + env: + PLATFORMS: "+all linux/amd64 linux/arm64 windows/amd64 darwin/amd64 darwin/arm64" + notify: + - github_commit_status: + context: "x-pack/metricbeat: Packaging Linux" + + - label: ":linux: Packaging ARM" + key: "packaging-arm" + command: | + cd x-pack/metricbeat + mage package + agents: + provider: "aws" + imagePrefix: "${IMAGE_UBUNTU_ARM_64}" + instanceType: "${AWS_ARM_INSTANCE_TYPE}" + env: + PLATFORMS: "linux/arm64" + PACKAGES: "docker" + notify: + - github_commit_status: + context: "x-pack/metricbeat: Packaging Linux ARM"