-
Notifications
You must be signed in to change notification settings - Fork 4.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* Migrate xpack filebeat pipeline (#38420) * migrate x-pack/filebeat pipeline * add generate_xxx.sh script * add aws condition * add MODULE * change images * fix MODULE_DIR and add nmap * add AWS credentials * change instance config * test * revert test (cherry picked from commit 22af217) * Update pre-command * Update common.sh --------- Co-authored-by: sharbuz <[email protected]>
- Loading branch information
1 parent
845969b
commit d57e4d2
Showing
7 changed files
with
284 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,190 @@ | ||
#!/usr/bin/env bash | ||
|
||
source .buildkite/scripts/common.sh | ||
|
||
set -euo pipefail | ||
|
||
pipelineName="pipeline.xpack-filebeat-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" | ||
- label: ":go: Go Integration Tests" | ||
key: "mandatory-int-test" | ||
command: "cd $BEATS_PROJECT_NAME && mage goIntegTest" | ||
agents: | ||
provider: "gcp" | ||
image: "${IMAGE_UBUNTU_X86_64}" | ||
machineType: "${GCP_HI_PERF_MACHINE_TYPE}" | ||
artifact_paths: "${BEATS_PROJECT_NAME}/build/*.xml" | ||
- label: ":python: Python Integration Tests" | ||
key: "mandatory-python-int-test" | ||
command: "cd $BEATS_PROJECT_NAME && mage pythonIntegTest" | ||
agents: | ||
provider: "gcp" | ||
image: "${IMAGE_UBUNTU_X86_64}" | ||
machineType: "${GCP_HI_PERF_MACHINE_TYPE}" | ||
disk_size: 100 | ||
disk_type: "pd-ssd" | ||
artifact_paths: "${BEATS_PROJECT_NAME}/build/*.xml" | ||
- 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}}" | ||
machineType: "${GCP_WIN_MACHINE_TYPE}" | ||
disk_size: 100 | ||
disk_type: "pd-ssd" | ||
matrix: | ||
setup: | ||
image: | ||
- "${IMAGE_WIN_2016}" | ||
- "${IMAGE_WIN_2022}" | ||
artifact_paths: "${BEATS_PROJECT_NAME}/build/*.*" | ||
## 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 Unit Tests - {{matrix.image}}" | ||
command: ".buildkite/scripts/win_unit_tests.ps1" | ||
key: "extended-win-unit-tests" | ||
agents: | ||
provider: "gcp" | ||
image: "{{matrix.image}}" | ||
machineType: "${GCP_WIN_MACHINE_TYPE}" | ||
disk_size: 100 | ||
disk_type: "pd-ssd" | ||
matrix: | ||
setup: | ||
image: | ||
- "${IMAGE_WIN_10}" | ||
- "${IMAGE_WIN_11}" | ||
- "${IMAGE_WIN_2019}" | ||
artifact_paths: "${BEATS_PROJECT_NAME}/build/*.*" | ||
YAML | ||
else | ||
echo "The conditions don't match to requirements for generating pipeline steps." | ||
exit 0 | ||
fi | ||
|
||
if are_conditions_met_arm_tests || are_conditions_met_macos_tests || are_conditions_met_aws_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/*.*" | ||
YAML | ||
fi | ||
|
||
if are_conditions_met_arm_tests; then | ||
cat >> $pipelineName <<- YAML | ||
- label: ":linux: ARM Ubuntu Unit Tests" | ||
key: "extended-arm64-unit-test" | ||
command: "cd $BEATS_PROJECT_NAME && mage build unitTest" | ||
agents: | ||
provider: "aws" | ||
imagePrefix: "${IMAGE_UBUNTU_ARM_64}" | ||
instanceType: "${AWS_ARM_INSTANCE_TYPE}" | ||
artifact_paths: "${BEATS_PROJECT_NAME}/build/*.*" | ||
YAML | ||
fi | ||
|
||
if are_conditions_met_aws_tests; then | ||
cat >> $pipelineName <<- YAML | ||
- label: ":linux: Cloud Tests" | ||
key: "extended-cloud-test" | ||
command: ".buildkite/scripts/cloud_tests.sh" | ||
env: | ||
MODULE: $MODULE | ||
agents: | ||
provider: "gcp" | ||
image: "${DEFAULT_UBUNTU_X86_64_IMAGE}" | ||
machineType: "${GCP_HI_PERF_MACHINE_TYPE}" | ||
disk_size: 100 | ||
disk_type: "pd-ssd" | ||
artifact_paths: "${BEATS_PROJECT_NAME}/build/*.*" | ||
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}" | ||
- 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" | ||
YAML | ||
fi | ||
|
||
echo "--- Printing dynamic steps" #TODO: remove if the pipeline is public | ||
cat $pipelineName | ||
|
||
echo "--- Loading dynamic steps" | ||
buildkite-agent pipeline upload $pipelineName |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,69 @@ | ||
# yaml-language-server: $schema=https://raw.githubusercontent.com/buildkite/pipeline-schema/main/schema.json | ||
name: "beats-xpack-filebeat" | ||
|
||
env: | ||
IMAGE_UBUNTU_X86_64: "family/platform-ingest-beats-ubuntu-2204" | ||
IMAGE_UBUNTU_ARM_64: "platform-ingest-beats-ubuntu-2204-aarch64" | ||
DEFAULT_UBUNTU_X86_64_IMAGE: "family/core-ubuntu-2204" | ||
IMAGE_WIN_10: "family/general-windows-10" | ||
IMAGE_WIN_11: "family/general-windows-11" | ||
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" | ||
GCP_DEFAULT_MACHINE_TYPE: "c2d-highcpu-8" | ||
GCP_HI_PERF_MACHINE_TYPE: "c2d-highcpu-16" | ||
GCP_WIN_MACHINE_TYPE: "n2-standard-8" | ||
AWS_ARM_INSTANCE_TYPE: "t4g.xlarge" | ||
BEATS_PROJECT_NAME: "x-pack/filebeat" | ||
|
||
steps: | ||
- label: "Example test" | ||
command: echo "Hello!" | ||
|
||
- input: "Input Parameters" | ||
key: "force-run-stages" | ||
fields: | ||
- select: "Filebeat - run_xpack_filebeat" | ||
key: "run_xpack_filebeat" | ||
options: | ||
- label: "True" | ||
value: "true" | ||
- label: "False" | ||
value: "false" | ||
default: "false" | ||
- select: "Filebeat - run_xpack_filebeat_macos_tests" | ||
key: "run_xpack_filebeat_macos_tests" | ||
options: | ||
- label: "True" | ||
value: "true" | ||
- label: "False" | ||
value: "false" | ||
default: "false" | ||
- select: "Filebeat - run_xpack_filebeat_arm_tests" | ||
key: "run_xpack_filebeat_arm_tests" | ||
options: | ||
- label: "True" | ||
value: "true" | ||
- label: "False" | ||
value: "false" | ||
default: "false" | ||
- select: "Filebeat - run_xpack_filebeat_aws_tests" | ||
key: "run_xpack_filebeat_aws_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 x-pack filebeat pipeline" | ||
key: "xpack-filebeat-pipeline" | ||
command: ".buildkite/scripts/generate_xpack_filebeat_pipeline.sh" | ||
notify: | ||
- github_commit_status: | ||
context: "${BEATS_PROJECT_NAME}: Load dynamic pipeline's steps" |