Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move to static BK pipeline for metricbeat #38827

Merged
merged 40 commits into from
Apr 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
8f3ef35
Move to static BK pipeline for metricbeat
dliappis Apr 10, 2024
4165994
test changeset
dliappis Apr 10, 2024
6502b2e
Revert "test changeset"
dliappis Apr 10, 2024
da68161
Dedicated script for detecting changesets on Buildkite
dliappis Apr 10, 2024
9dd981a
Merge branch 'bk-dedicated-changeset-functions' into metricbeat-stati…
dliappis Apr 10, 2024
cf560da
Remove beats-metricbeat from pull-requests.json
dliappis Apr 10, 2024
7bfaba3
add metricbeat to main pipeline + trigger
dliappis Apr 10, 2024
453bea7
remove metricbeat references from scripts
dliappis Apr 10, 2024
186183b
update static pipeline
dliappis Apr 10, 2024
e6f7722
Merge branch 'main' into metricbeat-static-pipeline
dliappis Apr 10, 2024
d925596
typo
dliappis Apr 10, 2024
f25c419
fix
dliappis Apr 10, 2024
cf08282
another fix
dliappis Apr 10, 2024
fbc37e3
more fixes
dliappis Apr 10, 2024
b420de4
fix bug
dliappis Apr 10, 2024
688749f
Merge branch 'main' into metricbeat-static-pipeline
dliappis Apr 10, 2024
8c10ddd
Various bug fixes and cleanups
dliappis Apr 10, 2024
a475ae5
More granular conditionals for Windows extended tests
dliappis Apr 10, 2024
0d83538
Fix extended windows conditionals
dliappis Apr 10, 2024
014a81b
add extended to notify groups
dliappis Apr 10, 2024
01bbba8
Trigger metricbeat when buildkite scripts change
dliappis Apr 10, 2024
f7871c8
fix macos tests
dliappis Apr 10, 2024
a6b9dd3
fix path to changesets
dliappis Apr 11, 2024
c4b616a
project name needed for orka install_tools?
dliappis Apr 11, 2024
ef2a9df
custom script to install macos install_macos_tools
dliappis Apr 11, 2024
e23f046
make script executable
dliappis Apr 11, 2024
291d329
remove macos tools
dliappis Apr 11, 2024
a7ff137
Merge branch 'main' into metricbeat-static-pipeline
dliappis Apr 11, 2024
5e0139c
Clean up precommand
dliappis Apr 11, 2024
feadbb8
test without custom script
dliappis Apr 11, 2024
abf1e80
fix path issues post merge
dliappis Apr 11, 2024
4911a22
fix step key so that precommand works
dliappis Apr 11, 2024
cc9f2d6
revert to standalone macos script
dliappis Apr 11, 2024
690727e
Merge branch 'main' into metricbeat-static-pipeline
dliappis Apr 11, 2024
5c1a493
PR comment move platform env vars to packaging
dliappis Apr 11, 2024
5e563f4
pr comment
dliappis Apr 11, 2024
9185c7d
remove packaging
dliappis Apr 11, 2024
5aaf2a9
fix bug with simplified ext-windows conditionals
dliappis Apr 11, 2024
80d61f3
Merge branch 'main' into metricbeat-static-pipeline
dliappis Apr 11, 2024
4d4a6ca
Update .buildkite/pipeline.yml
dliappis Apr 11, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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-metricbeat"
"beats-libbeat"
"beats-packetbeat"
"beats-winlogbeat"
Expand Down
283 changes: 247 additions & 36 deletions .buildkite/metricbeat/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@ name: "beats-metricbeat"

env:
AWS_ARM_INSTANCE_TYPE: "t4g.xlarge"
BEATS_PROJECT_NAME: "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_X86_64: "generic-13-ventura-x64"
IMAGE_UBUNTU_ARM_64: "platform-ingest-beats-ubuntu-2204-aarch64"
IMAGE_UBUNTU_X86_64: "family/platform-ingest-beats-ubuntu-2204"
Expand All @@ -16,44 +17,254 @@ 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"
# Integration Tests
K8S_VERSION: "v1.29.0"
ASDF_KIND_VERSION: "0.20.0"

#Deps
# Other deps
ASDF_MAGE_VERSION: 1.15.0

steps:
- input: "Input Parameters"
key: "run_metricbeat"
fields:
- select: "Metricbeat - run_metricbeat"
key: "run_metricbeat"
options:
- label: "True"
value: "true"
- label: "False"
value: "false"
default: "false"
- select: "Metricbeat - run_metricbeat_macos_tests"
key: "run_metricbeat_macos_tests"
options:
- label: "True"
value: "true"
- label: "False"
value: "false"
default: "false"
if: "build.source == 'ui'"
- group: "Metricbeat Mandatory Tests"
key: "metricbeat-mandatory-tests"
steps:
- label: ":linux: Ubuntu Unit Tests"
key: "mandatory-linux-unit-test"
command: "cd metricbeat && mage build unitTest"
agents:
provider: "gcp"
image: "${IMAGE_UBUNTU_X86_64}"
machineType: "${GCP_DEFAULT_MACHINE_TYPE}"
artifact_paths:
- "metricbeat/build/*.xml"
- "metricbeat/build/*.json"
notify:
- github_commit_status:
context: "metricbeat: Ubuntu Unit Tests"

- label: ":go: Go 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 metricbeat
echo "~~~ Will run tests with env var MODULE=$$MODULE"

# TODO move this section to base image / pre-command hook
echo "~~~ Installing kind"
asdf plugin add kind
asdf install kind $ASDF_KIND_VERSION

.buildkite/deploy/kubernetes/scripts/kind-setup.sh

echo "~~~ Running tests"
export KUBECONFIG="$$PWD/kubecfg"
cd metricbeat && mage goIntegTest
agents:
provider: "gcp"
image: "${IMAGE_UBUNTU_X86_64}"
machineType: "${GCP_HI_PERF_MACHINE_TYPE}"
artifact_paths:
- "metricbeat/build/*.xml"
- "metricbeat/build/*.json"
notify:
- github_commit_status:
context: "metricbeat: Go Integration Tests"

- label: ":python: Python 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 metricbeat
echo "~~~ Running tests with env var MODULE=$$MODULE"

# TODO move this section to base image / pre-command hook
echo "~~~ Installing kind"
asdf plugin add kind
asdf install kind $ASDF_KIND_VERSION

.buildkite/deploy/kubernetes/scripts/kind-setup.sh

echo "~~~ Running tests"
export KUBECONFIG="$$PWD/kubecfg"
cd metricbeat && mage pythonIntegTest
agents:
provider: "gcp"
image: "${IMAGE_UBUNTU_X86_64}"
machineType: "${GCP_HI_PERF_MACHINE_TYPE}"
artifact_paths:
- "metricbeat/build/*.xml"
- "metricbeat/build/*.json"
notify:
- github_commit_status:
context: "metricbeat: Python Integration Tests"

- label: ":negative_squared_cross_mark: Cross compile"
key: "mandatory-cross-compile"
command: "make -C metricbeat crosscompile"
agents:
provider: "gcp"
image: "${IMAGE_UBUNTU_X86_64}"
machineType: "${GCP_DEFAULT_MACHINE_TYPE}"
artifact_paths:
- "metricbeat/build/*.xml"
- "metricbeat/build/*.json"
notify:
- github_commit_status:
context: "metricbeat: Cross compile"

- label: ":windows: Windows 2016 Unit Tests"
command: |
Set-Location -Path 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:
- "metricbeat/build/*.xml"
- "metricbeat/build/*.json"
notify:
- github_commit_status:
context: "metricbeat: Windows 2016 Unit Tests"

- label: ":windows: Windows 2022 Unit Tests"
command: |
Set-Location -Path 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:
- "metricbeat/build/*.xml"
- "metricbeat/build/*.json"
notify:
- github_commit_status:
context: "metricbeat: Windows 2022 Unit Tests"

- group: "Metricbeat Extended Windows Tests"
key: "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 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:
- "metricbeat/build/*.xml"
- "metricbeat/build/*.json"
notify:
- github_commit_status:
context: "metricbeat: Extended Windows 10 Unit Tests"

- label: ":windows: Windows 11 Unit Tests"
command: |
Set-Location -Path 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:
- "metricbeat/build/*.xml"
- "metricbeat/build/*.json"
notify:
- github_commit_status:
context: "metricbeat: Extended Windows 11 Unit Tests"

- label: ":windows: Windows 2019 Unit Tests"
command: |
Set-Location -Path 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:
- "metricbeat/build/*.xml"
- "metricbeat/build/*.json"
notify:
- github_commit_status:
context: "metricbeat: Extended Windows 2019 Unit Tests"

- group: "Metricbeat Extended MacOS Tests"
key: "metricbeat-extended-macos-tests"
if: build.env("BUILDKITE_PULL_REQUEST") == "false" || build.env("GITHUB_PR_LABELS") =~ /.*macOS.*/
steps:
- label: ":mac: MacOS Unit Tests"
key: "extended-macos-unit-tests"
command: |
set -euo pipefail
source .buildkite/scripts/install_macos_tools.sh
cd metricbeat && mage build unitTest
agents:
provider: "orka"
imagePrefix: "${IMAGE_MACOS_X86_64}"
artifact_paths:
- "metricbeat/build/*.xml"
- "metricbeat/build/*.json"
notify:
- github_commit_status:
context: "metricbeat: Extended MacOS Unit Tests"

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

- label: ":linux: Load dynamic metricbeat pipeline"
key: "metricbeat-pipeline"
command: ".buildkite/scripts/generate_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: "metricbeat-mandatory-tests"

- group: "Metricbeat Packaging"
key: "metricbeat-packaging"
steps:
- label: ":linux: Packaging Linux"
key: "packaging-linux"
command: "cd 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: "metricbeat: Packaging Linux"

- label: ":linux: Packaging ARM"
key: "packaging-arm"
command: "cd 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: "metricbeat: Packaging Linux ARM"
24 changes: 24 additions & 0 deletions .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,30 @@ steps:
- BUILDKITE_PULL_REQUEST=${BUILDKITE_PULL_REQUEST}
- GITHUB_PR_LABELS=${GITHUB_PR_LABELS}

- label: "Trigger Metricbeat"
plugins:
- monorepo-diff#v1.0.1:
diff: "git diff --name-only ${GITHUB_PR_TARGET_BRANCH}...HEAD"
watch:
- path:
- metricbeat/
- .buildkite/metricbeat/
- .buildkite/scripts
#OSS
- go.mod
- pytest.ini
- dev-tools/
- libbeat/**
- testing/**
config:
trigger: "beats-metricbeat"
build:
commit: "${BUILDKITE_COMMIT}"
branch: "${BUILDKITE_BRANCH}"
env:
- BUILDKITE_PULL_REQUEST=${BUILDKITE_PULL_REQUEST}
- GITHUB_PR_LABELS=${GITHUB_PR_LABELS}

- label: "Trigger Deploy/K8S"
plugins:
- monorepo-diff#v1.0.1:
Expand Down
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-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 metricbeat$",
"always_trigger_comment_regex": "^/test metricbeat$",
"skip_ci_labels": [ ],
"skip_target_branches": [ ],
"skip_ci_on_only_changed": [ ],
"always_require_ci_on_changed": [ "^metricbeat/.*", ".buildkite/metricbeat/.*", "^go.mod", "^pytest.ini", "^dev-tools/.*", "^libbeat/.*", "^testing/.*"]
},
{
"enabled": true,
"pipelineSlug": "beats-libbeat",
Expand Down
Loading
Loading