From 7522f150ae7e1c52a91403a59741c3d47d951d03 Mon Sep 17 00:00:00 2001 From: prombot Date: Sun, 12 Mar 2023 16:48:29 +0100 Subject: [PATCH] Fixup version bumper job Move role repo discovery to a script to avoid shell escaping issues. * Fix up argument_specs.yml. Signed-off-by: prombot --- .github/scripts/discover_role_repos.sh | 6 ++++++ .../scripts/version_updater.sh | 0 .github/workflows/version_bumper.yml | 12 ++++-------- roles/alertmanager/defaults/main.yml | 5 ++--- roles/alertmanager/meta/argument_specs.yml | 4 ++-- roles/alertmanager/vars/main.yml | 1 + roles/blackbox_exporter/defaults/main.yml | 3 +-- roles/blackbox_exporter/meta/argument_specs.yml | 3 +++ roles/blackbox_exporter/vars/main.yml | 1 + roles/node_exporter/defaults/main.yml | 5 ++--- roles/node_exporter/meta/argument_specs.yml | 4 ++-- roles/node_exporter/vars/main.yml | 1 + roles/prometheus/defaults/main.yml | 5 ++--- roles/prometheus/meta/argument_specs.yml | 4 ++-- roles/prometheus/vars/main.yml | 1 + roles/snmp_exporter/defaults/main.yml | 5 ++--- roles/snmp_exporter/meta/argument_specs.yml | 4 ++-- roles/snmp_exporter/vars/main.yml | 1 + roles/systemd_exporter/defaults/main.yml | 5 ++--- roles/systemd_exporter/meta/argument_specs.yml | 4 ++-- roles/systemd_exporter/vars/main.yml | 1 + 21 files changed, 40 insertions(+), 35 deletions(-) create mode 100755 .github/scripts/discover_role_repos.sh rename version_updater.sh => .github/scripts/version_updater.sh (100%) diff --git a/.github/scripts/discover_role_repos.sh b/.github/scripts/discover_role_repos.sh new file mode 100755 index 00000000..726518ac --- /dev/null +++ b/.github/scripts/discover_role_repos.sh @@ -0,0 +1,6 @@ +#!/usr/bin/env bash + +for defaults_file in roles/*/vars/main.yml ; do + role="$(echo "${defaults_file}" | cut -f2 -d'/')" + yq eval "[{\"repo\": ._${role}_repo, \"role\": \"${role}\"}]" "${defaults_file}" +done | yq -o json -I=0 diff --git a/version_updater.sh b/.github/scripts/version_updater.sh similarity index 100% rename from version_updater.sh rename to .github/scripts/version_updater.sh diff --git a/.github/workflows/version_bumper.yml b/.github/workflows/version_bumper.yml index af2c9fae..60e3b959 100644 --- a/.github/workflows/version_bumper.yml +++ b/.github/workflows/version_bumper.yml @@ -1,5 +1,5 @@ --- -name: Sync repo files +name: Check for new upstream releases on: schedule: - cron: '21 14 * * *' @@ -20,13 +20,9 @@ jobs: id: discovered-role-repos uses: mikefarah/yq@master with: - cmd: | - for defaults_file in roles/*/defaults/main.yml ; do - role="$(echo "${defaults_file}" | cut -f2 -d'/')" - yq eval "[{\"repo\": .${role}_repo, \"role\": \"${role}\"}]" "${defaults_file}" - done | yq -o json -I=0 + cmd: ./.github/scripts/discover_role_repos.sh - repo_sync: + check_for_new_versions: runs-on: ubuntu-latest needs: discover-role-repos permissions: @@ -43,4 +39,4 @@ jobs: with: fetch-depth: 0 - - run: ./version_bumper.sh ${{ matrix.repo }} ${{ matrix.role }} + - run: ./.github/scripts/version_bumper.sh ${{ matrix.repo }} ${{ matrix.role }} diff --git a/roles/alertmanager/defaults/main.yml b/roles/alertmanager/defaults/main.yml index 1453b4e2..18cd7118 100644 --- a/roles/alertmanager/defaults/main.yml +++ b/roles/alertmanager/defaults/main.yml @@ -1,10 +1,9 @@ --- alertmanager_version: 0.21.0 alertmanager_binary_local_dir: '' -alertmanager_repo: "prometheus/alertmanager" -alertmanager_binary_url: "https://github.com/{{ alertmanager_repo }}/releases/download/v{{ alertmanager_version }}/\ +alertmanager_binary_url: "https://github.com/{{ _alertmanager_repo }}/releases/download/v{{ alertmanager_version }}/\ alertmanager-{{ alertmanager_version }}.linux-{{ go_arch }}.tar.gz" -alertmanager_checksums_url: "https://github.com/{{ alertmanager_repo }}/releases/download/v{{ alertmanager_version }}/sha256sums.txt" +alertmanager_checksums_url: "https://github.com/{{ _alertmanager_repo }}/releases/download/v{{ alertmanager_version }}/sha256sums.txt" alertmanager_config_dir: /etc/alertmanager alertmanager_db_dir: /var/lib/alertmanager diff --git a/roles/alertmanager/meta/argument_specs.yml b/roles/alertmanager/meta/argument_specs.yml index ab4e2587..b5889acb 100644 --- a/roles/alertmanager/meta/argument_specs.yml +++ b/roles/alertmanager/meta/argument_specs.yml @@ -18,10 +18,10 @@ argument_specs: - "This overrides I(alertmanager_version) parameter" alertmanager_binary_url: description: "URL of the alertmanager binaries .tar.gz file" - default: "https://github.com/prometheus/alertmanager/releases/download/v{{ alertmanager_version }}/alertmanager-{{ alertmanager_version }}.linux-{{ go_arch }}.tar.gz" + default: "https://github.com/{{ _alertmanager_repo }}/releases/download/v{{ alertmanager_version }}/alertmanager-{{ alertmanager_version }}.linux-{{ go_arch }}.tar.gz" alertmanager_checksums_url: description: "URL of the alertmanager checksums file" - default: "https://github.com/prometheus/alertmanager/releases/download/v{{ alertmanager_version }}/sha256sums.txt" + default: "https://github.com/{{ _alertmanager_repo }}/releases/download/v{{ alertmanager_version }}/sha256sums.txt" alertmanager_web_listen_address: description: "Address on which alertmanager will be listening" default: "0.0.0.0:9093" diff --git a/roles/alertmanager/vars/main.yml b/roles/alertmanager/vars/main.yml index ad87dc87..832597ef 100644 --- a/roles/alertmanager/vars/main.yml +++ b/roles/alertmanager/vars/main.yml @@ -11,3 +11,4 @@ _alertmanager_binary_install_dir: '/usr/local/bin' # The expected location of the amtool configuration file _alertmanager_amtool_config_dir: '/etc/amtool' +_alertmanager_repo: "prometheus/alertmanager" diff --git a/roles/blackbox_exporter/defaults/main.yml b/roles/blackbox_exporter/defaults/main.yml index 9385c3cb..added85f 100644 --- a/roles/blackbox_exporter/defaults/main.yml +++ b/roles/blackbox_exporter/defaults/main.yml @@ -1,7 +1,6 @@ --- blackbox_exporter_version: 0.18.0 -blackbox_exporter_repo: "prometheus/blackbox_exporter" -blackbox_exporter_binary_url: "https://github.com/{{ blackbox_exporter_repo }}/releases/download/v{{ blackbox_exporter_version }}/\ +blackbox_exporter_binary_url: "https://github.com/{{ _blackbox_exporter_repo }}/releases/download/v{{ blackbox_exporter_version }}/\ blackbox_exporter-{{ blackbox_exporter_version }}.linux-{{ go_arch_map[ansible_architecture] | default(ansible_architecture) }}.tar.gz" diff --git a/roles/blackbox_exporter/meta/argument_specs.yml b/roles/blackbox_exporter/meta/argument_specs.yml index 2fa7cc99..b551369f 100644 --- a/roles/blackbox_exporter/meta/argument_specs.yml +++ b/roles/blackbox_exporter/meta/argument_specs.yml @@ -11,6 +11,9 @@ argument_specs: blackbox_exporter_version: description: "Blackbox exporter package version" default: "0.18.0" + blackbox_exporter_binary_url: + description: "URL of the blackbox_exporter binaries .tar.gz file" + default: "https://github.com/{{ _blackbox_exporter_repo }}/releases/download/v{{ blackbox_exporter_version }}/blackbox_exporter-{{ blackbox_exporter_version }}.linux-{{ go_arch_map[ansible_architecture] | default(ansible_architecture) }}.tar.gz" blackbox_exporter_web_listen_address: description: "Address on which blackbox exporter will be listening" default: "0.0.0.0:9115" diff --git a/roles/blackbox_exporter/vars/main.yml b/roles/blackbox_exporter/vars/main.yml index 7f528a40..a16d1e54 100644 --- a/roles/blackbox_exporter/vars/main.yml +++ b/roles/blackbox_exporter/vars/main.yml @@ -5,3 +5,4 @@ go_arch_map: aarch64: 'arm64' armv7l: 'armv7' armv6l: 'armv6' +_blackbox_exporter_repo: "prometheus/blackbox_exporter" diff --git a/roles/node_exporter/defaults/main.yml b/roles/node_exporter/defaults/main.yml index 49ba7e2a..8d8753c9 100644 --- a/roles/node_exporter/defaults/main.yml +++ b/roles/node_exporter/defaults/main.yml @@ -1,10 +1,9 @@ --- node_exporter_version: 1.1.2 node_exporter_binary_local_dir: "" -node_exporter_repo: "prometheus/node_exporter" -node_exporter_binary_url: "https://github.com/{{ node_exporter_repo }}/releases/download/v{{ node_exporter_version }}/\ +node_exporter_binary_url: "https://github.com/{{ _node_exporter_repo }}/releases/download/v{{ node_exporter_version }}/\ node_exporter-{{ node_exporter_version }}.linux-{{ go_arch }}.tar.gz" -node_exporter_checksums_url: "https://github.com/{{ node_exporter_repo }}/releases/download/v{{ node_exporter_version }}/sha256sums.txt" +node_exporter_checksums_url: "https://github.com/{{ _node_exporter_repo }}/releases/download/v{{ node_exporter_version }}/sha256sums.txt" node_exporter_web_listen_address: "0.0.0.0:9100" node_exporter_web_telemetry_path: "/metrics" diff --git a/roles/node_exporter/meta/argument_specs.yml b/roles/node_exporter/meta/argument_specs.yml index 416e8d8a..7e54a14f 100644 --- a/roles/node_exporter/meta/argument_specs.yml +++ b/roles/node_exporter/meta/argument_specs.yml @@ -18,10 +18,10 @@ argument_specs: - "This overrides the I(node_exporter_version) parameter" node_exporter_binary_url: description: "URL of the node exporter binaries .tar.gz file" - default: "https://github.com/prometheus/node_exporter/releases/download/v{{ node_exporter_version }}/node_exporter-{{ node_exporter_version }}.linux-{{ go_arch }}.tar.gz" + default: "https://github.com/{{ _node_exporter_repo }}/releases/download/v{{ node_exporter_version }}/node_exporter-{{ node_exporter_version }}.linux-{{ go_arch }}.tar.gz" node_exporter_checksums_url: description: "URL of the node exporter checksums file" - default: "https://github.com/prometheus/node_exporter/releases/download/v{{ node_exporter_version }}/sha256sums.txt" + default: "https://github.com/{{ _node_exporter_repo }}/releases/download/v{{ node_exporter_version }}/sha256sums.txt" node_exporter_web_listen_address: description: "Address on which node exporter will listen" default: "0.0.0.0:9100" diff --git a/roles/node_exporter/vars/main.yml b/roles/node_exporter/vars/main.yml index fdcd1265..abb74cfd 100644 --- a/roles/node_exporter/vars/main.yml +++ b/roles/node_exporter/vars/main.yml @@ -7,3 +7,4 @@ go_arch_map: armv6l: 'armv6' go_arch: "{{ go_arch_map[ansible_architecture] | default(ansible_architecture) }}" +_node_exporter_repo: "prometheus/node_exporter" diff --git a/roles/prometheus/defaults/main.yml b/roles/prometheus/defaults/main.yml index a2e61062..aebfe423 100644 --- a/roles/prometheus/defaults/main.yml +++ b/roles/prometheus/defaults/main.yml @@ -1,10 +1,9 @@ --- prometheus_version: 2.27.0 prometheus_binary_local_dir: '' -prometheus_repo: "prometheus/prometheus" -prometheus_binary_url: "https://github.com/{{ prometheus_repo }}/releases/download/v{{ prometheus_version }}/\ +prometheus_binary_url: "https://github.com/{{ _prometheus_repo }}/releases/download/v{{ prometheus_version }}/\ prometheus-{{ prometheus_version }}.linux-{{ go_arch }}.tar.gz" -prometheus_checksums_url: "https://github.com/{{ prometheus_repo }}/releases/download/v{{ prometheus_version }}/sha256sums.txt" +prometheus_checksums_url: "https://github.com/{{ _prometheus_repo }}/releases/download/v{{ prometheus_version }}/sha256sums.txt" prometheus_skip_install: false prometheus_config_dir: /etc/prometheus diff --git a/roles/prometheus/meta/argument_specs.yml b/roles/prometheus/meta/argument_specs.yml index 2e29b5d0..1e41d4d8 100644 --- a/roles/prometheus/meta/argument_specs.yml +++ b/roles/prometheus/meta/argument_specs.yml @@ -24,10 +24,10 @@ argument_specs: - "This overrides I(prometheus_version) parameter" prometheus_binary_url: description: "URL of the prometheus binaries .tar.gz file" - default: "https://github.com/prometheus/prometheus/releases/download/v{{ prometheus_version }}/ prometheus-{{ prometheus_version }}.linux-{{ go_arch }}.tar.gz" + default: "https://github.com/{{ _prometheus_repo }}/releases/download/v{{ prometheus_version }}/ prometheus-{{ prometheus_version }}.linux-{{ go_arch }}.tar.gz" prometheus_checksums_url: description: URL of the prometheus checksums file - default: "https://github.com/prometheus/prometheus/releases/download/v{{ prometheus_version }}/sha256sums.txt" + default: "https://github.com/{{ _prometheus_repo }}/releases/download/v{{ prometheus_version }}/sha256sums.txt" prometheus_config_dir: description: "Path to directory with prometheus configuration" default: "/etc/prometheus" diff --git a/roles/prometheus/vars/main.yml b/roles/prometheus/vars/main.yml index 5748251f..2b2591cc 100644 --- a/roles/prometheus/vars/main.yml +++ b/roles/prometheus/vars/main.yml @@ -12,3 +12,4 @@ _prometheus_binary_install_dir: '/usr/local/bin' _prometheus_selinux_packages: "{{ ['libselinux-python', 'policycoreutils-python'] if ansible_python_version is version('3', '<') else ['python3-libselinux', 'python3-policycoreutils'] }}" +_prometheus_repo: "prometheus/prometheus" diff --git a/roles/snmp_exporter/defaults/main.yml b/roles/snmp_exporter/defaults/main.yml index f37bf841..1e6662ab 100644 --- a/roles/snmp_exporter/defaults/main.yml +++ b/roles/snmp_exporter/defaults/main.yml @@ -1,9 +1,8 @@ --- snmp_exporter_version: 0.19.0 -snmp_exporter_repo: "prometheus/snmp_exporter" -snmp_exporter_binary_url: "https://github.com/{{ snmp_exporter_repo }}/releases/download/v{{ snmp_exporter_version }}/\ +snmp_exporter_binary_url: "https://github.com/{{ _snmp_exporter_repo }}/releases/download/v{{ snmp_exporter_version }}/\ snmp_exporter-{{ snmp_exporter_version }}.linux-{{ go_arch_map[ansible_architecture] | default(ansible_architecture) }}.tar.gz" -snmp_exporter_checksums_url: "https://github.com/{{ snmp_exporter_repo }}/releases/download/v{{ snmp_exporter_version }}/sha256sums.txt" +snmp_exporter_checksums_url: "https://github.com/{{ _snmp_exporter_repo }}/releases/download/v{{ snmp_exporter_version }}/sha256sums.txt" snmp_exporter_web_listen_address: "0.0.0.0:9116" snmp_exporter_log_level: info diff --git a/roles/snmp_exporter/meta/argument_specs.yml b/roles/snmp_exporter/meta/argument_specs.yml index 81bb3c42..a7b2b2b2 100644 --- a/roles/snmp_exporter/meta/argument_specs.yml +++ b/roles/snmp_exporter/meta/argument_specs.yml @@ -13,10 +13,10 @@ argument_specs: default: "0.19.0" snmp_exporter_binary_url: description: "URL of the snmp exporter binaries .tar.gz file" - default: "https://github.com/prometheus/snmp_exporter/releases/download/v{{ snmp_exporter_version }}/snmp_exporter-{{ snmp_exporter_version }}.linux-{{ go_arch_map[ansible_architecture] | default(ansible_architecture) }}.tar.gz" + default: "https://github.com/{{ _snmp_exporter_repo }}/releases/download/v{{ snmp_exporter_version }}/snmp_exporter-{{ snmp_exporter_version }}.linux-{{ go_arch_map[ansible_architecture] | default(ansible_architecture) }}.tar.gz" snmp_exporter_checksums_url: description: "URL of the snmp exporter checksums file" - default: "https://github.com/prometheus/snmp_exporter/releases/download/v{{ snmp_exporter_version }}/sha256sums.txt" + default: "https://github.com/{{ _snmp_exporter_repo }}/releases/download/v{{ snmp_exporter_version }}/sha256sums.txt" snmp_exporter_web_listen_address: description: "Address on which SNMP exporter will be listening" default: "0.0.0.0:9116" diff --git a/roles/snmp_exporter/vars/main.yml b/roles/snmp_exporter/vars/main.yml index 7f528a40..084a2a0e 100644 --- a/roles/snmp_exporter/vars/main.yml +++ b/roles/snmp_exporter/vars/main.yml @@ -5,3 +5,4 @@ go_arch_map: aarch64: 'arm64' armv7l: 'armv7' armv6l: 'armv6' +_snmp_exporter_repo: "prometheus/snmp_exporter" diff --git a/roles/systemd_exporter/defaults/main.yml b/roles/systemd_exporter/defaults/main.yml index e442ea9c..34e6b5f1 100644 --- a/roles/systemd_exporter/defaults/main.yml +++ b/roles/systemd_exporter/defaults/main.yml @@ -1,10 +1,9 @@ --- systemd_exporter_version: 0.4.0 systemd_exporter_binary_local_dir: "" -systemd_exporter_repo: "prometheus-community/systemd_exporter" -systemd_exporter_binary_url: "https://github.com/{{ systemd_exporter_repo }}/releases/download/v{{ systemd_exporter_version }}/\ +systemd_exporter_binary_url: "https://github.com/{{ _systemd_exporter_repo }}/releases/download/v{{ systemd_exporter_version }}/\ systemd_exporter-{{ systemd_exporter_version }}.linux-{{ go_arch }}.tar.gz" -systemd_exporter_checksums_url: "https://github.com/{{ systemd_exporter_repo }}/releases/download/v{{ systemd_exporter_version }}/sha256sums.txt" +systemd_exporter_checksums_url: "https://github.com/{{ _systemd_exporter_repo }}/releases/download/v{{ systemd_exporter_version }}/sha256sums.txt" systemd_exporter_web_listen_address: "0.0.0.0:9558" systemd_exporter_enable_restart_count: false diff --git a/roles/systemd_exporter/meta/argument_specs.yml b/roles/systemd_exporter/meta/argument_specs.yml index bb8fed83..2b45b974 100644 --- a/roles/systemd_exporter/meta/argument_specs.yml +++ b/roles/systemd_exporter/meta/argument_specs.yml @@ -18,10 +18,10 @@ argument_specs: - "This overrides I(systemd_exporter_version) parameter" systemd_exporter_binary_url: description: URL of the systemd exporter binaries .tar.gz file" - default: "https://github.com/prometheus-community/systemd_exporter/releases/download/v{{ systemd_exporter_version }}/systemd_exporter-{{ systemd_exporter_version }}.linux-{{ go_arch }}.tar.gz" + default: "https://github.com/{{ _systemd_exporter_repo }}/releases/download/v{{ systemd_exporter_version }}/systemd_exporter-{{ systemd_exporter_version }}.linux-{{ go_arch }}.tar.gz" systemd_exporter_checksums_url: description: "URL of the systemd exporter checksums file" - default: "https://github.com/prometheus-community/systemd_exporter/releases/download/v{{ systemd_exporter_version }}/sha256sums.txt" + default: "https://github.com/{{ _systemd_exporter_repo }}/releases/download/v{{ systemd_exporter_version }}/sha256sums.txt" systemd_exporter_web_listen_address: description: Address on which systemd exporter will listen" default: "0.0.0.0:9558" diff --git a/roles/systemd_exporter/vars/main.yml b/roles/systemd_exporter/vars/main.yml index fdcd1265..dbe31198 100644 --- a/roles/systemd_exporter/vars/main.yml +++ b/roles/systemd_exporter/vars/main.yml @@ -7,3 +7,4 @@ go_arch_map: armv6l: 'armv6' go_arch: "{{ go_arch_map[ansible_architecture] | default(ansible_architecture) }}" +_systemd_exporter_repo: "prometheus-community/systemd_exporter"