You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
if [[ "$BUILDKITE_PIPELINE_SLUG"=="beats-metricbeat"||"$BUILDKITE_PIPELINE_SLUG"=="beats-libbeat"||"$BUILDKITE_PIPELINE_SLUG"=="beats-packetbeat"||"$BUILDKITE_PIPELINE_SLUG"=="beats-winlogbeat"||"$BUILDKITE_PIPELINE_SLUG"=="beats-xpack-libbeat" ]];then
36
+
if [[ "$BUILDKITE_PIPELINE_SLUG"=="beats-metricbeat"||"$BUILDKITE_PIPELINE_SLUG"=="beats-libbeat"||"$BUILDKITE_PIPELINE_SLUG"=="beats-packetbeat"||"$BUILDKITE_PIPELINE_SLUG"=="beats-winlogbeat"||"$BUILDKITE_PIPELINE_SLUG"=="beats-xpack-libbeat"||"$BUILDKITE_PIPELINE_SLUG"=="beats-xpack-metricbeat"]];then
16
37
source .buildkite/scripts/setenv.sh
17
38
if [[ "${BUILDKITE_COMMAND}"=~ ^buildkite-agent ]];then
18
39
echo"Skipped pre-command when running the Upload pipeline"
19
40
exit 0
20
41
fi
21
42
fi
43
+
44
+
if [[ "$BUILDKITE_PIPELINE_SLUG"=="beats-xpack-metricbeat"&&"$BUILDKITE_STEP_KEY"=="extended-cloud-test" ]];then
45
+
BEATS_AWS_SECRET_KEY=$(retry 5 vault kv get -field secret_key ${AWS_SERVICE_ACCOUNT_SECRET_PATH})
46
+
export BEATS_AWS_SECRET_KEY
47
+
BEATS_AWS_ACCESS_KEY=$(retry 5 vault kv get -field access_key ${AWS_SERVICE_ACCOUNT_SECRET_PATH})
if are_conditions_met_mandatory_tests;then#from https://github.com/elastic/beats/blob/c5e79a25d05d5bdfa9da4d187fe89523faa42afc/Jenkinsfile#L145-L171
303
355
if [[ "$BUILDKITE_PIPELINE_SLUG"=="beats-libbeat"||"$BUILDKITE_PIPELINE_SLUG"=="beats-packetbeat" ]];then
304
-
if [[ "${GITHUB_PR_TRIGGER_COMMENT}"=="${BEATS_GH_ARM_COMMENT}"||"${GITHUB_PR_LABELS}"=~"${BAETS_GH_ARM_LABEL}"||"${!TRIGGER_SPECIFIC_ARM_TESTS}"=="true" ]];then
356
+
if [[ "${GITHUB_PR_TRIGGER_COMMENT}"=="${BEATS_GH_ARM_COMMENT}"||"${GITHUB_PR_LABELS}"=~${BEATS_GH_ARM_LABEL}||"${!TRIGGER_SPECIFIC_ARM_TESTS}"=="true" ]];then
if are_conditions_met_mandatory_tests;then#from https://github.com/elastic/beats/blob/c5e79a25d05d5bdfa9da4d187fe89523faa42afc/Jenkinsfile#L145-L171
314
-
if [[ "$BUILDKITE_PIPELINE_SLUG"=="beats-metricbeat"||"$BUILDKITE_PIPELINE_SLUG"=="beats-packetbeat" ]];then
315
-
if [[ "${GITHUB_PR_TRIGGER_COMMENT}"=="${BEATS_GH_MACOS_COMMENT}"||"${GITHUB_PR_LABELS}"=~"${BAETS_GH_MACOS_LABEL}"||"${!TRIGGER_SPECIFIC_MACOS_TESTS}"=="true" ]];then# from https://github.com/elastic/beats/blob/c5e79a25d05d5bdfa9da4d187fe89523faa42afc/metricbeat/Jenkinsfile.yml#L3-L12
366
+
if [[ "$BUILDKITE_PIPELINE_SLUG"=="beats-metricbeat"||"$BUILDKITE_PIPELINE_SLUG"=="beats-packetbeat"||"$BUILDKITE_PIPELINE_SLUG"=="beats-xpack-metricbeat" ]];then
367
+
if [[ "${GITHUB_PR_TRIGGER_COMMENT}"=="${BEATS_GH_MACOS_COMMENT}"||"${GITHUB_PR_LABELS}"=~${BEATS_GH_MACOS_LABEL}||"${!TRIGGER_SPECIFIC_MACOS_TESTS}"=="true" ]];then# from https://github.com/elastic/beats/blob/c5e79a25d05d5bdfa9da4d187fe89523faa42afc/metricbeat/Jenkinsfile.yml#L3-L12
368
+
return 0
369
+
fi
370
+
fi
371
+
fi
372
+
return 1
373
+
}
374
+
375
+
are_conditions_met_aws_tests() {
376
+
if are_conditions_met_mandatory_tests;then#from https://github.com/elastic/beats/blob/c5e79a25d05d5bdfa9da4d187fe89523faa42afc/Jenkinsfile#L145-L171
377
+
if [[ "$BUILDKITE_PIPELINE_SLUG"=="beats-xpack-metricbeat" ]];then
378
+
if [[ "${GITHUB_PR_TRIGGER_COMMENT}"=="${BEATS_GH_AWS_COMMENT}"||"${GITHUB_PR_LABELS}"=~${BEATS_GH_AWS_LABEL}||"${!TRIGGER_SPECIFIC_AWS_TESTS}"=="true" ]];then# from https://github.com/elastic/beats/blob/c5e79a25d05d5bdfa9da4d187fe89523faa42afc/metricbeat/Jenkinsfile.yml#L3-L12
316
379
return 0
317
380
fi
318
381
fi
@@ -336,19 +399,101 @@ config_git() {
336
399
fi
337
400
}
338
401
402
+
defineModuleFromTheChangeSet() {
403
+
# This method gathers the module name, if required, in order to run the ITs only if the changeset affects a specific module.
404
+
# For such, it's required to look for changes under the module folder and exclude anything else such as asciidoc and png files.
405
+
# This method defines and exports the MODULE variable with a particular module name or '' if changeset doesn't affect a specific module
406
+
local project_path=$1
407
+
local project_path_transformed=$(echo "$project_path"| sed 's/\//\\\//g')
408
+
local project_path_exclussion="((?!^${project_path_transformed}\\/).)*\$"
409
+
local exclude=("^(${project_path_exclussion}|((?!\\/module\\/).)*\$|.*\\.asciidoc|.*\\.png)")
410
+
411
+
if [[ "$project_path"==*"x-pack/"* ]];then
412
+
local pattern=("$XPACK_MODULE_PATTERN")
413
+
else
414
+
local pattern=("$OSS_MODULE_PATTERN")
415
+
fi
416
+
local changed_modules=""
417
+
local module_dirs=$(find "$project_path/module" -mindepth 1 -maxdepth 1 -type d)
418
+
formodule_dirin$module_dirs;do
419
+
if are_paths_changed $module_dir&&! are_changed_only_paths "${exclude[@]}";then
420
+
if [[ -z"$changed_modules" ]];then
421
+
changed_modules=$(basename "$module_dir")
422
+
else
423
+
changed_modules+=",$(basename "$module_dir")"
424
+
fi
425
+
fi
426
+
done
427
+
if [[ -z"$changed_modules" ]];then# TODO: remove this condition and uncomment the line below when the issue https://github.com/elastic/ingest-dev/issues/2993 is solved
428
+
export MODULE="aws"
429
+
else
430
+
export MODULE="${changed_modules}"# TODO: remove this line and uncomment the line below when the issue https://github.com/elastic/ingest-dev/issues/2993 is solved
431
+
# export MODULE="${changed_modules}" # TODO: uncomment the line when the issue https://github.com/elastic/ingest-dev/issues/2993 is solved
432
+
fi
433
+
}
434
+
435
+
terraformInit() {
436
+
local dir=$1
437
+
echo"Terraform Init on $dir"
438
+
pushd"${dir}"> /dev/null
439
+
terraform init
440
+
popd> /dev/null
441
+
}
442
+
443
+
withAWS() {
444
+
# This method gathers the masked AWS credentials from pre-command hook and sets the right AWS variable names.
0 commit comments