diff --git a/.buildkite/scripts/common.sh b/.buildkite/scripts/common.sh index 548131ae3e4..ebb15c937dd 100755 --- a/.buildkite/scripts/common.sh +++ b/.buildkite/scripts/common.sh @@ -404,20 +404,31 @@ defineModuleFromTheChangeSet() { # For such, it's required to look for changes under the module folder and exclude anything else such as asciidoc and png files. # This method defines and exports the MODULE variable with a particular module name or '' if changeset doesn't affect a specific module local project_path=$1 + local project_path_transformed=$(echo "$project_path" | sed 's/\//\\\//g') + local project_path_exclussion="((?!^${project_path_transformed}\\/).)*\$" + local exclude=("^(${project_path_exclussion}|((?!\\/module\\/).)*\$|.*\\.asciidoc|.*\\.png)") + if [[ "$project_path" == *"x-pack/"* ]]; then local pattern=("$XPACK_MODULE_PATTERN") else local pattern=("$OSS_MODULE_PATTERN") fi - local module_name="${project_path#*module/}" - local project_path_transformed=$(echo "$project_path" | sed 's/\//\\\//g') - local project_path_exclussion="((?!^${project_path_transformed}\\/).)*\$" - local exclude=("^(${project_path_transformed}|((?!\\/module\\/).)*\$|.*\\.asciidoc|.*\\.png)") - if are_paths_changed "${pattern[@]}" && ! are_changed_only_paths "${exclude[@]}"; then - export MODULE=${module_name} - elif [ -d "${project_path}" ]; then - export MODULE="aws" # TODO: remove this line and uncomment the line below when the issue https://github.com/elastic/ingest-dev/issues/2993 is solved - # export MODULE='' # TODO: uncomment the line when the issue https://github.com/elastic/ingest-dev/issues/2993 is solved + local changed_modules="" + local module_dirs=$(find "$project_path/module" -mindepth 1 -maxdepth 1 -type d) + for module_dir in $module_dirs; do + if are_paths_changed $module_dir && ! are_changed_only_paths "${exclude[@]}"; then + if [[ -z "$changed_modules" ]]; then + changed_modules=$(basename "$module_dir") + else + changed_modules+=",$(basename "$module_dir")" + fi + fi + done + 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 + export MODULE="aws" + else + 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 + # export MODULE="${changed_modules}" # TODO: uncomment the line when the issue https://github.com/elastic/ingest-dev/issues/2993 is solved fi } diff --git a/x-pack/metricbeat/module/aws/usage/manifest.yml b/x-pack/metricbeat/module/aws/usage/manifest.yml index b47f43c2277..4ef64eee065 100644 --- a/x-pack/metricbeat/module/aws/usage/manifest.yml +++ b/x-pack/metricbeat/module/aws/usage/manifest.yml @@ -6,5 +6,3 @@ input: metrics: - namespace: AWS/Usage statistic: ["Sum"] - - namespace: AWS/Usage - statistic: ["Average"]