Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

minor(ci): detect unused ansible variables #422

Merged
merged 3 commits into from
Oct 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions .github/scripts/discover_role_repos.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
)

Expand Down
7 changes: 7 additions & 0 deletions .github/workflows/ansible-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,13 @@ jobs:
- name: Lint arguments spec
run: ./.github/scripts/lint_arguments_spec.sh

check-unused-variables:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Run action
uses: hoo29/little-timmy@v1-action

discover-ansible-versions:
runs-on: ubuntu-latest
outputs:
Expand Down
1 change: 0 additions & 1 deletion roles/fail2ban_exporter/vars/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 0 additions & 1 deletion roles/smokeping_prober/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ smokeping_prober_checksums_url: "https://github.com/{{ _smokeping_prober_repo }}
smokeping_prober_skip_install: false

smokeping_prober_web_listen_address: "0.0.0.0:9374"
smokeping_prober_web_telemetry_path: "/metrics"

# List of smokeping_prober targets.
# See: https://github.com/SuperQ/smokeping_prober/#configuration
Expand Down
3 changes: 0 additions & 3 deletions roles/smokeping_prober/meta/argument_specs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,6 @@ argument_specs:
smokeping_prober_web_listen_address:
description: "Address on which Smokeping Prober will listen"
default: "0.0.0.0:9374"
smokeping_prober_web_telemetry_path:
description: "Path under which to expose metrics"
default: "/metrics"
smokeping_prober_config_dir:
description: "The directory of the smokeping_prober probes config files"
default: "/etc/smokeping_prober"
Expand Down
Loading