fix: remove the need for setting _repo_type variable

Signed-off-by: gardar <gardar@users.noreply.github.com>
This commit is contained in:
gardar 2024-09-30 15:42:03 +00:00
parent 62a115f4cf
commit 8f9e86a905
No known key found for this signature in database
GPG key ID: 75FAE37CBA8C13C2
2 changed files with 10 additions and 4 deletions

View file

@ -3,9 +3,16 @@
# Description: Discover the upstream repo from each role default vars.
result=$(
for defaults_file in roles/*/vars/main.yml ; do
role="$(echo "${defaults_file}" | cut -f2 -d'/')"
yq eval "[{\"repo\": ._${role}_repo, \"role\": \"${role}\", \"type\": ._${role}_repo_type // \"github\"}]" "${defaults_file}"
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
)

View file

@ -8,4 +8,3 @@ go_arch_map:
go_arch: "{{ go_arch_map[ansible_architecture] | default(ansible_architecture) }}"
_fail2ban_exporter_repo: 24199687
_fail2ban_exporter_repo_type: gitlab