mirror of
https://github.com/prometheus-community/ansible
synced 2024-11-26 05:40:18 +00:00
8f9e86a905
Signed-off-by: gardar <gardar@users.noreply.github.com>
19 lines
528 B
Bash
Executable file
19 lines
528 B
Bash
Executable file
#!/usr/bin/env bash
|
|
#
|
|
# Description: Discover the upstream repo from each role default vars.
|
|
|
|
result=$(
|
|
for role_dir in roles/*/ ; do
|
|
role="$(basename "${role_dir}")"
|
|
|
|
role_repo=$(yq eval "._${role}_repo" "${role_dir}/vars/main.yml" 2>/dev/null)
|
|
|
|
yq eval "[{
|
|
\"repo\": \"${role_repo}\",
|
|
\"role\": \"${role}\",
|
|
\"type\": (.${role}_binary_url | split(\"/\")[2] | split(\".\")[0] // \"github\")
|
|
}]" "${role_dir}/defaults/main.yml" 2>/dev/null
|
|
done | yq -o json -I=0
|
|
)
|
|
|
|
echo "result=${result}"
|