-
Notifications
You must be signed in to change notification settings - Fork 143
Open
Description
A recent change (#400) to the download URL for Mimir packages in the Mimir role has resulted in it failing to be able to download those packages.
The change added a mimir- prefix to the mimir_version variable, but that variable already includes said prefix (when it is the default value of "latest" and the version is scraped from GitHub) and so now it is being doubled up resulting in a URL that does not exist.
A simple test for this is:
---
- hosts: localhost
gather_facts: false
vars:
__mimir_arch: "amd64"
tasks:
# Snippet from the Mimir role: https://github.com/grafana/grafana-ansible-collection/blob/main/roles/mimir/tasks/deploy.yml#L3
- name: Scrape Github API endpoint to obtain latest Mimir version
ansible.builtin.uri:
url: "https://api.github.com/repos/grafana/mimir/releases/latest"
method: GET
body_format: json
become: false
delegate_to: localhost
run_once: true
register: __github_latest_version
- name: Latest available Mimir version
ansible.builtin.set_fact:
mimir_version: "{{ __github_latest_version.json.tag_name | regex_replace('^v?(\\d+\\.\\d+\\.\\d+)$', '\\1') }}"
# End of Snippet
- debug:
msg: '{{ mimir_version }}'
- name: Latest available Mimir version
ansible.builtin.set_fact:
mimir_download_url_rpm: "https://github.com/grafana/mimir/releases/download/mimir-{{ mimir_version }}/mimir-{{ mimir_version }}_{{ __mimir_arch }}.rpm"
- debug:
msg: '{{ mimir_download_url_rpm }}'
- name: "Check if the URL is reachable"
ansible.builtin.uri:
url: "{{ mimir_download_url_rpm }}"
method: HEAD
register: url_check_result
failed_when: false
- name: "Confirm the URL exists"
ansible.builtin.assert:
that:
# Check for any successful status code (200-299)
- "url_check_result.status >= 200"
- "url_check_result.status < 300"
fail_msg: "The URL '{{ mimir_download_url_rpm }}' is not available. Status code: {{ url_check_result.status }}"
success_msg: "The URL '{{ mimir_download_url_rpm }}' is available. Status code: {{ url_check_result.status }}"
...I assume this change was made to account for users overriding the default mimir_version, and so the role should probably be updated to strip the mimir- off of the tag name when scraping the latest version from GitHub.
Spirit-act
Metadata
Metadata
Assignees
Labels
No labels