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

migrate metricbeat pipeline to Buildkite #37592

Merged
merged 133 commits into from
Feb 2, 2024
Merged
Show file tree
Hide file tree
Changes from 120 commits
Commits
Show all changes
133 commits
Select commit Hold shift + click to select a range
dd1a305
migrate data from leo-ri:bk-metric
Jan 10, 2024
bbe02ae
change machine-type for unit-test step
Jan 10, 2024
e4ae39a
add SETUP_MAGE_VERRSION
Jan 10, 2024
5c43f05
add umask
Jan 11, 2024
247cf1c
refactor unit-tests
Jan 11, 2024
f4c5976
refactor unit-tests
Jan 11, 2024
dd21203
add macos unit-tests
Jan 11, 2024
a579e21
add macos unit-tests
Jan 11, 2024
ce90e94
fix env for macos unit-tests
Jan 11, 2024
ba29723
fix env for macos unit-tests
Jan 11, 2024
f1b360a
fix env for macos unit-tests
Jan 11, 2024
ced0b44
change with_mage func
Jan 11, 2024
39b8045
test
Jan 11, 2024
b91b0b1
test
Jan 11, 2024
460b9a2
refactor
Jan 11, 2024
2060518
sig GO and add debug for macOS
Jan 11, 2024
b35611d
add win-unit-tests
Jan 12, 2024
350dc9d
add win-unit-tests
Jan 12, 2024
18669a2
debug windows tests
Jan 12, 2024
d54bea2
debug windows tests
Jan 12, 2024
ab6e627
debug windows tests
Jan 12, 2024
84139af
debug windows tests
Jan 12, 2024
215a9ed
debug windows tests
Jan 12, 2024
884f61e
debug windows tests
Jan 12, 2024
39d2c92
add python to windows
Jan 12, 2024
79593aa
debug python on windows
Jan 12, 2024
1847863
fix CRLF on Windows
Jan 15, 2024
ef6efa9
add withMinGW
Jan 15, 2024
515233c
debug Windows
Jan 15, 2024
1014749
debug Windows
Jan 15, 2024
e0b566b
debug Windows
Jan 15, 2024
b03e5b0
debug Windows
Jan 15, 2024
39740ff
fix artifacts path for junit Windows
Jan 15, 2024
a536d97
add packaging
Jan 15, 2024
2aebc34
add packaging
Jan 15, 2024
b300804
add packaging
Jan 15, 2024
bb4e4ab
add packaging
Jan 15, 2024
e3f0ecc
debug packaging
Jan 16, 2024
869ae9b
debug packaging
Jan 16, 2024
0538c5d
debug packaging
Jan 16, 2024
d89b017
debug packaging
Jan 16, 2024
cbd2f25
full test
Jan 16, 2024
44ddf80
debug MacOS and Ubuntu unit tests
Jan 16, 2024
9d685ce
debug MacOS and Ubuntu unit tests
Jan 16, 2024
987b215
debug MacOS and Ubuntu unit tests
Jan 16, 2024
9e0e5b5
debug MacOS
Jan 16, 2024
7144f75
test changes fot triggering Jenkins pipeline to compare the output
Jan 17, 2024
a2d24a1
Merge branch 'main' into mirgate-metricbeat-pipeline
sharbuz Jan 17, 2024
56851fd
debug unit tests
Jan 18, 2024
d9720b4
debug unit tests
Jan 18, 2024
59d95d5
debug unit tests
Jan 18, 2024
600e4fc
debug unit tests
Jan 18, 2024
82dfdec
debug unit tests
Jan 18, 2024
558a9a8
debug MacOS unit tests
Jan 18, 2024
3b793dc
full test to compare the result with Jankins
Jan 18, 2024
1cbbd97
@ci full test
Jan 18, 2024
f9a1544
debug MacOs unit tests
Jan 18, 2024
73cde5d
debug MacOs unit tests
Jan 18, 2024
0748687
@ci debug MacOs unit tests
Jan 18, 2024
9664c5c
exlude MacOs filesystem check
Jan 22, 2024
5910a1b
full test
Jan 22, 2024
aed3554
full test
Jan 22, 2024
4fde0c6
test packaging
Jan 22, 2024
f52220f
test packaging
Jan 22, 2024
ab739eb
add DEBIAN_FRONTEND option to pre-command
Jan 23, 2024
f575912
add DEBIAN_FRONTEND option to pre-command
Jan 23, 2024
62fd99d
Merge branch 'main' into mirgate-metricbeat-pipeline
sharbuz Jan 23, 2024
7e24544
refactor packaging
Jan 23, 2024
1d29e06
add imagePrefix:
Jan 23, 2024
a884117
Merge branch 'main' into mirgate-metricbeat-pipeline
sharbuz Jan 24, 2024
39b6431
Merge branch 'main' of github.com:sharbuz/beats into mirgate-metricbe…
Jan 24, 2024
bcdc5c9
merge main
Jan 24, 2024
3de269f
Merge branch 'mirgate-metricbeat-pipeline' of github.com:sharbuz/beat…
Jan 24, 2024
0f229db
fix condition
Jan 24, 2024
f84fdcd
Merge branch 'main' into mirgate-metricbeat-pipeline
sharbuz Jan 24, 2024
db576b2
refactor scripts to common state
Jan 24, 2024
4f0044d
Merge branch 'mirgate-metricbeat-pipeline' of github.com:sharbuz/beat…
Jan 24, 2024
3b33584
add pipeline_name var
Jan 24, 2024
ac75afe
fix typos
Jan 24, 2024
5ab3f61
refactor packaging and conditions
Jan 29, 2024
1af5215
fix sudo
Jan 29, 2024
9d864c8
fix GO_VERSION
Jan 29, 2024
49db349
refactored evironments variabes
Jan 29, 2024
2fcc3cd
refactored evironments variabes
Jan 29, 2024
111816c
change pipeline conditions
Jan 29, 2024
d5a801e
fix pipeline conditions
Jan 29, 2024
5bce044
debug pipeline's conditions
Jan 29, 2024
c618197
debug conditions conditions
Jan 29, 2024
398948f
debug conditions conditions
Jan 29, 2024
f3c7922
debug pipelines
Jan 29, 2024
5acac67
debug pipelines
Jan 29, 2024
224becd
fix sudo issue
Jan 29, 2024
053c3de
debug
Jan 29, 2024
40810b9
debug
Jan 29, 2024
6eca90f
debug
Jan 29, 2024
d6347eb
full test
Jan 29, 2024
7b0ee3a
full test
Jan 29, 2024
0167d74
debug MacOS unit tests
Jan 29, 2024
60ab746
debug MacOS unit tests
Jan 29, 2024
b80b600
debug MacOS unit tests
Jan 29, 2024
c514ffe
debug MacOS unit tests
Jan 29, 2024
8396618
debug MacOS unit tests
Jan 29, 2024
8b25728
full test after refactoring
Jan 29, 2024
50271ed
full test
Jan 29, 2024
e150acd
full test
Jan 30, 2024
03cfcd5
full test
Jan 30, 2024
ebd926f
fix docker-compose for ARM, fix remarks
Jan 30, 2024
7236ab9
exclude the main pipeline's conditions
Jan 31, 2024
86dbc50
refactoring
Jan 31, 2024
5a0683b
sudo fix and add pre-command conditions
Jan 31, 2024
6036f6f
remove conditions and fir artifacts path
Jan 31, 2024
efd6714
revert scripts usage
Jan 31, 2024
1161b51
refactor pipelines
Jan 31, 2024
c5e2d0b
change the image because the k8s issue
Jan 31, 2024
c105098
add common to setenv and fix typo
Jan 31, 2024
f1fb5ea
fix loop
Jan 31, 2024
567d01e
fix dynamic pipeline
Jan 31, 2024
db57312
fix vars
Jan 31, 2024
748dbbc
fix beats_projec_name in the dynamic pipeline
Jan 31, 2024
09f3fcf
fix vars
Jan 31, 2024
f983e0b
Update .buildkite/metricbeat/pipeline.yml
sharbuz Feb 1, 2024
7ae6dba
change agens type remove setenv from common
Feb 1, 2024
2fd6907
change agens type remove setenv from common
Feb 1, 2024
e06369e
add with_dependencies
Feb 2, 2024
8d54c4a
fix remarks
Feb 2, 2024
fe456f9
Merge branch 'main' of github.com:sharbuz/beats into mirgate-metricbe…
Feb 2, 2024
4fc09d0
add Windows 10-11 tests
Feb 2, 2024
1d42045
added PLATFORN_TYPE
Feb 2, 2024
81a5274
update pre-command
Feb 2, 2024
82d46c8
update pre-command
Feb 2, 2024
1862066
add GOLANG for filebeat and change the main agent because of k8s GO-i…
Feb 2, 2024
a13e966
fix pre-command for filebeat and rollback setenv for metricbeat
Feb 2, 2024
561168d
disable windows 10 unit tests
Feb 2, 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
53 changes: 53 additions & 0 deletions .buildkite/hooks/post-checkout
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
#!/bin/bash
sharbuz marked this conversation as resolved.
Show resolved Hide resolved

set -euo pipefail

checkout_merge() {
local target_branch=$1
local pr_commit=$2
local merge_branch=$3

if [[ -z "${target_branch}" ]]; then
echo "No pull request target branch"
exit 1
fi

git fetch -v origin "${target_branch}"
git checkout FETCH_HEAD
echo "Current branch: $(git rev-parse --abbrev-ref HEAD)"

# create temporal branch to merge the PR with the target branch
git checkout -b ${merge_branch}
echo "New branch created: $(git rev-parse --abbrev-ref HEAD)"

# set author identity so it can be run git merge
git config user.name "github-merged-pr-post-checkout"
git config user.email "auto-merge@buildkite"

git merge --no-edit "${BUILDKITE_COMMIT}" || {
local merge_result=$?
echo "Merge failed: ${merge_result}"
git merge --abort
exit ${merge_result}
}
}

pull_request="${BUILDKITE_PULL_REQUEST:-false}"

if [[ "${pull_request}" == "false" ]]; then
echo "Not a pull request, skipping"
exit 0
fi

TARGET_BRANCH="${BUILDKITE_PULL_REQUEST_BASE_BRANCH:-master}"
PR_COMMIT="${BUILDKITE_COMMIT}"
PR_ID=${BUILDKITE_PULL_REQUEST}
MERGE_BRANCH="pr_merge_${PR_ID}"

checkout_merge "${TARGET_BRANCH}" "${PR_COMMIT}" "${MERGE_BRANCH}"

echo "Commit information"
git --no-pager log --format=%B -n 1

# Ensure buildkite groups are rendered
echo ""
5 changes: 5 additions & 0 deletions .buildkite/hooks/pre-command
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash

source .buildkite/scripts/setenv.sh

set -euo pipefail
43 changes: 41 additions & 2 deletions .buildkite/metricbeat/pipeline.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,44 @@
# yaml-language-server: $schema=https://raw.githubusercontent.com/buildkite/pipeline-schema/main/schema.json
env:
IMAGE_UBUNTU_X86_64: "family/core-ubuntu-2204"
IMAGE_UBUNTU_ARM_64: "core-ubuntu-2004-aarch64"
IMAGE_WIN_2016: "family/core-windows-2016"
IMAGE_WIN_2019: "family/core-windows-2019"
IMAGE_WIN_2022: "family/core-windows-2022"
IMAGE_MACOS_X86_64: "generic-13-ventura-x64"
BEATS_PROJECT_NAME: "metricbeat"

steps:
- label: "Example test"
command: echo "Hello!"

sharbuz marked this conversation as resolved.
Show resolved Hide resolved
- input: "Input Parameters"
key: "input-run-all-stages"
fields:
- select: "Metricbeat - runAllStages"
key: "runAllStages"
options:
- label: "True"
value: "true"
- label: "False"
value: "false"
default: "false"
- select: "Metricbeat - runMacOsTests"
key: "UI_MACOS_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: Check steps conditions"
key: "check-steps-conditions"
command: ".buildkite/scripts/check_conditions.sh"
sharbuz marked this conversation as resolved.
Show resolved Hide resolved
agents:
provider: "gcp"
image: "${IMAGE_UBUNTU_X86_64}"
machineType: "c2-standard-16"
sharbuz marked this conversation as resolved.
Show resolved Hide resolved
153 changes: 153 additions & 0 deletions .buildkite/scripts/check_conditions.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,153 @@
#!/bin/bash

source .buildkite/scripts/common.sh

set -euo pipefail

pipelineName="pipeline.metricbeat-dynamic.yml"

cat > $pipelineName <<- YAML

steps:

YAML

if are_conditions_met_mandatory_tests; then
cat >> $pipelineName <<- YAML

- group: "Mandatory Tests"
key: "mandatory-tests"
steps:
- label: ":linux: Ubuntu Unit Tests"
key: "mandatory-linux-unit-test"
command: ".buildkite/scripts/unit_tests.sh"
agents:
provider: "gcp"
image: "${IMAGE_UBUNTU_X86_64}"
machineType: "c2-standard-16"
artifact_paths: "${BEATS_PROJECT_NAME}/build/*.*"

- label: ":go: Go Intergration Tests"
key: "mandatory-int-test"
command: ".buildkite/scripts/go_int_tests.sh"
agents:
provider: "gcp"
image: "${IMAGE_UBUNTU_X86_64}"
machineType: "c2-standard-16"
artifact_paths: "${BEATS_PROJECT_NAME}/build/*.*"

- label: ":python: Python Integration Tests"
key: "mandatory-python-int-test"
command: ".buildkite/scripts/py_int_tests.sh"
agents:
provider: "gcp"
image: "${IMAGE_UBUNTU_X86_64}"
machineType: "c2-standard-16"
artifact_paths: "${BEATS_PROJECT_NAME}/build/*.*"

- label: ":negative_squared_cross_mark: Cross compile"
key: "mandatory-cross-compile"
command: ".buildkite/scripts/crosscompile.sh"
agents:
provider: "gcp"
image: "${IMAGE_UBUNTU_X86_64}"
machineType: "c2-standard-16"
artifact_paths: "${BEATS_PROJECT_NAME}/build/*.*"

- label: ":windows: Windows Unit Tests - {{matrix.image}}"
command: ".buildkite/scripts/win_unit_tests.ps1"
key: "mandatory-win-unit-tests"
agents:
provider: "gcp"
image: "{{matrix.image}}"
machine_type: "n2-standard-8"
disk_size: 100
disk_type: "pd-ssd"
matrix:
setup:
image:
- "${IMAGE_WIN_2016}"
- "${IMAGE_WIN_2022}"
artifact_paths: "${BEATS_PROJECT_NAME}/build/*.*"

YAML
fi

if are_conditions_met_extended_tests && are_conditions_met_macos_tests; then
cat >> $pipelineName <<- YAML

- group: "Extended Tests"
key: "extended-tests"
steps:
- 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/*.*"

YAML
fi

if are_conditions_met_extended_windows_tests; then
cat >> $pipelineName <<- YAML

- group: "Extended Windowds Tests"
key: "extended-win-tests"
steps:
- label: ":windows: Win 2019 Unit Tests"
key: "extended-win-2019-unit-tests"
command: ".buildkite/scripts/win_unit_tests.ps1"
agents:
provider: "gcp"
image: "${IMAGE_WIN_2019}"
machine_type: "n2-standard-8"
disk_size: 100
disk_type: "pd-ssd"
artifact_paths: "${BEATS_PROJECT_NAME}/build/*.*"

YAML
fi

if are_conditions_met_extended_windows_tests; then
cat >> $pipelineName <<- YAML

- 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: ".buildkite/scripts/packaging.sh"
agents:
provider: "gcp"
image: "${IMAGE_UBUNTU_X86_64}"
machineType: "c2-standard-16"
env:
PLATFORMS: "+all linux/amd64 linux/arm64 windows/amd64 darwin/amd64 darwin/arm64"

- label: ":linux: Packaging ARM"
key: "packaging-arm"
command: ".buildkite/scripts/packaging.sh"
agents:
provider: "aws"
imagePrefix: "${IMAGE_UBUNTU_ARM_64}"
instanceType: "t4g.xlarge"
env:
PLATFORMS: "linux/arm64"
PACKAGES: "docker"

depends_on:
- step: "mandatory-tests"
allow_failure: false
- step: "extended-tests"
allow_failure: true
- step: "extended-win-tests"
allow_failure: true

YAML
fi

cat $pipelineName #remove after tests

buildkite-agent pipeline upload $pipelineName
Loading
Loading