1
0
Fork 0
forked from infra/ansible
infra-ansible/roles/pagure/tasks/patches.yml
Aurélien Bompard 05eb12595e
Apply hotfix patches to pagure.io too (staging for now)
Signed-off-by: Aurélien Bompard <aurelien@bompard.org>
2026-05-22 16:44:18 +02:00

35 lines
959 B
YAML

---
- name: Install patch and filterdiff
ansible.builtin.dnf:
name:
- patch
- patchutils
- name: Prepare the patches directory
ansible.builtin.file:
path: /opt/patches
state: directory
mode: "0755"
- name: Download patches
ansible.builtin.copy:
src: /srv/web/infra/bigfiles/hotfixes/pagure/{{ item }}.patch
dest: /opt/patches/{{ item }}.patch
owner: root
group: root
mode: "0644"
loop: "{{ pagure_patches }}"
- name: Apply patches
ansible.builtin.shell:
chdir: "{{ ansible_facts['python3']['sitelib'] }}"
cmd: filterdiff --include '?/pagure/*' /opt/patches/{{ item }}.patch | patch -p1 --forward --fuzz=0 --reject-file=- --batch
loop: "{{ pagure_patches }}"
register: result
ignore_errors: true
changed_when:
- "'Reversed (or previously applied) patch detected!' not in result.stdout"
- result.rc == 0
failed_when: "'FAILED' in result.stdout"
notify:
- Restart apache