Skip to content

Commit

Permalink
full test
Browse files Browse the repository at this point in the history
  • Loading branch information
Siarhei Harbuz committed Feb 5, 2024
1 parent 6cd9880 commit a2c8826
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 51 deletions.
6 changes: 3 additions & 3 deletions .buildkite/metricbeat/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ env:
steps:

- input: "Input Parameters"
key: "input-run-all-stages"
key: "runMetricbeat"
fields:
- select: "Metricbeat - runAllStages"
key: "runAllStages"
- select: "Metricbeat - runMetricbeat"
key: "runMetricbeat"
options:
- label: "True"
value: "true"
Expand Down
52 changes: 14 additions & 38 deletions .buildkite/scripts/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -181,29 +181,20 @@ are_changed_only_paths() {
return 1
}

# are_conditions_met_mandatory_tests() {
# if [[ "${BUILDKITE_PULL_REQUEST}" == "" ]] || [[ "${runAllStages}" == "true" ]] || [[ "${ONLY_DOCS}" == "false" && "${BUILDKITE_PULL_REQUEST}" != "" ]]; then # from https://github.com/elastic/beats/blob/c5e79a25d05d5bdfa9da4d187fe89523faa42afc/Jenkinsfile#L107-L137
# if are_paths_changed "${metricbeat_changeset[@]}" || are_paths_changed "${oss_changeset[@]}" || are_paths_changed "${ci_changeset[@]}" ]]; then # from https://github.com/elastic/beats/blob/c5e79a25d05d5bdfa9da4d187fe89523faa42afc/metricbeat/Jenkinsfile.yml#L3-L12
# if [[ "$BUILDKITE_PIPELINE_SLUG" == "beats-metricbeat" ]]; then
# if [[ "${GITHUB_PR_TRIGGER_COMMENT}" == "/test metricbeat" ]] || [[ "${GITHUB_PR_LABELS}" =~ Metricbeat ]]; then
# return 0
# elif [[ "$BUILDKITE_PIPELINE_SLUG" == "beats-libbeat" ]]; then
# if [[ "${GITHUB_PR_TRIGGER_COMMENT}" == "/test libbeat" || "${GITHUB_PR_LABELS}" =~ libbeat || "${runLibbeat}" == "true" ]]; then
# return 0
# fi
# fi
# fi
# fi
# fi
# return 1
# }

# are_conditions_met_extended_tests() {
# if are_conditions_met_mandatory_tests; then #from https://github.com/elastic/beats/blob/c5e79a25d05d5bdfa9da4d187fe89523faa42afc/Jenkinsfile#L145-L171
# return 0
# fi
# return 1
# }
are_conditions_met_mandatory_tests() {
if are_paths_changed "${metricbeat_changeset[@]}" || are_paths_changed "${oss_changeset[@]}" || are_paths_changed "${ci_changeset[@]}" ]]; then # from https://github.com/elastic/beats/blob/c5e79a25d05d5bdfa9da4d187fe89523faa42afc/metricbeat/Jenkinsfile.yml#L3-L12
if [[ "$BUILDKITE_PIPELINE_SLUG" == "beats-metricbeat" ]]; then
if [[ "${GITHUB_PR_TRIGGER_COMMENT}" == "/test metricbeat" || "${GITHUB_PR_LABELS}" =~ Metricbeat || "${runMetricbeat}" == "true" ]]; then
return 0
fi
elif [[ "$BUILDKITE_PIPELINE_SLUG" == "beats-libbeat" ]]; then
if [[ "${GITHUB_PR_TRIGGER_COMMENT}" == "/test libbeat" || "${GITHUB_PR_LABELS}" =~ libbeat || "${runLibbeat}" == "true" ]]; then
return 0
fi
fi
fi
return 1
}

are_conditions_met_libbeat_arm_tests() {
if are_conditions_met_mandatory_tests; then #from https://github.com/elastic/beats/blob/c5e79a25d05d5bdfa9da4d187fe89523faa42afc/Jenkinsfile#L145-L171
Expand All @@ -217,31 +208,16 @@ are_conditions_met_libbeat_arm_tests() {
}

are_conditions_met_metricbeat_macos_tests() {
# if are_conditions_met_mandatory_tests; then #from https://github.com/elastic/beats/blob/c5e79a25d05d5bdfa9da4d187fe89523faa42afc/Jenkinsfile#L145-L171
# if [[ "$BUILDKITE_PIPELINE_SLUG" == "beats-metricbeat" ]]; then
if [[ "${UI_MACOS_TESTS}" == true ]] || [[ "${GITHUB_PR_TRIGGER_COMMENT}" == "/test metricbeat for macos" ]] || [[ "${GITHUB_PR_LABELS}" =~ macOS ]]; then # from https://github.com/elastic/beats/blob/c5e79a25d05d5bdfa9da4d187fe89523faa42afc/metricbeat/Jenkinsfile.yml#L3-L12
return 0
fi
return 1
# fi
# return 1
}

are_conditions_met_metricbeat_extended_windows_tests() {
if [[ "${ONLY_DOCS}" == "false" && "${BUILDKITE_PULL_REQUEST}" != "" ]] || [[ "${runAllStages}" == "true" ]]; then #from https://github.com/elastic/beats/blob/c5e79a25d05d5bdfa9da4d187fe89523faa42afc/Jenkinsfile#L145-L171
if are_paths_changed "${metricbeat_changeset[@]}" || are_paths_changed "${oss_changeset[@]}" || are_paths_changed "${ci_changeset[@]}" || [[ "${GITHUB_PR_TRIGGER_COMMENT}" == "/test metricbeat" ]] || [[ "${GITHUB_PR_LABELS}" =~ Metricbeat ]]; then # from https://github.com/elastic/beats/blob/c5e79a25d05d5bdfa9da4d187fe89523faa42afc/metricbeat/Jenkinsfile.yml#L3-L12
return 0
fi
fi
return 1
}

are_conditions_met_packaging() {
# if are_conditions_met_metricbeat_extended_windows_tests; then #from https://github.com/elastic/beats/blob/c5e79a25d05d5bdfa9da4d187fe89523faa42afc/Jenkinsfile#L145-L171
if are_paths_changed "${metricbeat_changeset[@]}" || are_paths_changed "${oss_changeset[@]}" || [[ "${BUILDKITE_TAG}" == "" ]] || [[ "${BUILDKITE_PULL_REQUEST}" != "" ]]; then # from https://github.com/elastic/beats/blob/c5e79a25d05d5bdfa9da4d187fe89523faa42afc/metricbeat/Jenkinsfile.yml#L101-L103
return 0
fi
# fi
return 1
}

Expand Down
8 changes: 5 additions & 3 deletions .buildkite/scripts/generate_libbeat_pipeline.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ set -euo pipefail

pipelineName="pipeline.libbeat-dynamic.yml"

echo "Adding the mandatory tests into the pipeline"
cat > $pipelineName <<- YAML
echo "Add the mandatory and extended tests without additional conditions into the pipeline"
if are_conditions_met_mandatory_tests; then
cat > $pipelineName <<- YAML
steps:
Expand Down Expand Up @@ -60,8 +61,9 @@ steps:
artifact_paths: "${BEATS_PROJECT_NAME}/libbeat-stress-test.xml"
YAML
fi

echo "Adding the additional tests into the pipeline"
echo "Check and add the Extended Tests into the pipeline"
if are_conditions_met_libbeat_arm_tests; then
cat >> $pipelineName <<- YAML
Expand Down
15 changes: 8 additions & 7 deletions .buildkite/scripts/generate_metricbeat_pipeline.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ set -euo pipefail

pipelineName="pipeline.metricbeat-dynamic.yml"

echo "Adding the mandatory tests into the pipeline"
cat > $pipelineName <<- YAML
echo "Add the mandatory and extended tests without additional conditions into the pipeline"
if are_conditions_met_mandatory_tests; then
cat > $pipelineName <<- YAML
steps:
Expand Down Expand Up @@ -66,11 +67,8 @@ steps:
- "${IMAGE_WIN_2022}"
artifact_paths: "${BEATS_PROJECT_NAME}/build/*.*"
YAML

echo "Adding the extended windows tests into the pipeline"
#TODO: ADD conditions from the main pipeline
cat >> $pipelineName <<- YAML
# echo "Add the extended windows tests into the pipeline"
# TODO: ADD conditions from the main pipeline
- group: "Extended Windowds Tests"
key: "extended-win-tests"
Expand Down Expand Up @@ -109,7 +107,9 @@ cat >> $pipelineName <<- YAML
disk_type: "pd-ssd"
artifact_paths: "${BEATS_PROJECT_NAME}/build/*.*"
YAML
fi

echo "Check and add the Extended Tests into the pipeline"
if are_conditions_met_metricbeat_macos_tests; then
cat >> $pipelineName <<- YAML
Expand All @@ -127,6 +127,7 @@ YAML

fi

echo "Check and add the Packaging into the pipeline"
if are_conditions_met_packaging; then
cat >> $pipelineName <<- YAML
Expand Down

0 comments on commit a2c8826

Please sign in to comment.