Skip to content

Commit

Permalink
fix(CI): fetch and parse promtail checksum
Browse files Browse the repository at this point in the history
  • Loading branch information
meysam81 committed Sep 21, 2024
1 parent 55f82dc commit fec7fc9
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
3 changes: 2 additions & 1 deletion roles/promtail/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
---
promtail_arch: "{{ (ansible_architecture | default('amd64')) | replace('x86_64', 'amd64') }}"
promtail_os: linux
promtail_url: https://github.com/grafana/loki/releases/download/v{{ promtail_version | regex_replace('^v', '') }} /promtail-{{ promtail_os }}-{{ promtail_arch }}.zip
promtail_url: https://github.com/grafana/loki/releases/download/v{{ promtail_version | regex_replace('^v', '') }}/promtail-{{ promtail_os }}-{{ promtail_arch }}.zip

Check failure on line 4 in roles/promtail/defaults/main.yml

View workflow job for this annotation

GitHub Actions / ansible-lint

yaml[line-length]

Line too long (164 > 160 characters)
promtail_sha256sum_url: https://github.com/grafana/loki/releases/download/v{{ promtail_version | regex_replace('^v', '') }}/SHA256SUMS
promtail_version: 3.2.0

promtail_user: promtail
Expand Down
10 changes: 9 additions & 1 deletion roles/promtail/tasks/setup-Debian.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,20 @@
---
- name: Download and read sha256sum file
ansible.builtin.set_fact:
sha256sum_file_content: "{{ lookup('ansible.builtin.url', promtail_sha256sum_url, wantlist=True) }}"
when: promtail_version and promtail_sha256sum_url
- name: Extract SHA256 checksums for {{ promtail_download_url | basename }}
ansible.builtin.set_fact:
sha256sum: "{{ sha256sum_file_content | select('search', promtail_download_url | basename) | map('split', ' ') | map('first') | list | first }}"
when: promtail_version and promtail_sha256sum_url
- name: Download promtail
ansible.builtin.get_url:
url: "{{ promtail_url }}"
dest: "/tmp/{{ promtail_url | basename }}"
mode: "0444"
owner: "{{ promtail_user }}"
group: "{{ promtail_group }}"
checksum: "sha256:{{ promtail_checksum }}"
checksum: "{{ 'sha256:' + sha256sum if sha256sum else None }}"
register: promtail_download
- name: Extract promtail

Check failure on line 19 in roles/promtail/tasks/setup-Debian.yml

View workflow job for this annotation

GitHub Actions / ansible-lint

no-handler

Tasks that run when changed should likely be handlers.
ansible.builtin.unarchive:
Expand Down

0 comments on commit fec7fc9

Please sign in to comment.