Mirrormanager: get a unique job name in move-to-archive

Signed-off-by: Aurélien Bompard <aurelien@bompard.org>
This commit is contained in:
Aurélien Bompard 2024-07-30 12:30:58 +02:00
parent a30ae9f17a
commit e7cfb0ea69
No known key found for this signature in database
GPG key ID: 31584CFEB9BF64AD
2 changed files with 8 additions and 2 deletions

View file

@ -16,6 +16,8 @@
- /srv/web/infra/ansible/vars/apps/mirrormanager.yml
handlers:
- import_tasks: "{{ handlers_path }}/restart_services.yml"
vars:
job_name: move-to-archive-{{ product|lower|replace(" ", "-") }}-{{ version|lower|replace(" ", "-") }}-{{ ansible_date_time.epoch }}
pre_tasks:
- name: Validate the product {{ product }}
@ -39,4 +41,8 @@
tasks:
- debug:
msg: "Job started. You can watch the logs with:\noc -n mirrormanager logs -f job/move-to-archive-{{product|lower|replace(' ', '-')}}-{{version|lower|replace(' ', '-')}}"
msg: "Job started. You can watch the logs with:\noc -n mirrormanager logs -f job/{{job_name}}"
- debug:
msg: "You can cancel it with:\noc -n mirrormanager delete job/{{job_name}}"
- debug:
msg: "When it's done, clean it up with:\noc -n mirrormanager delete job/{{job_name}}"

View file

@ -4,7 +4,7 @@
apiVersion: batch/v1
kind: Job
metadata:
name: move-to-archive-{{ product|lower|replace(" ", "-") }}-{{ version|lower|replace(" ", "-") }}
name: "{{ job_name }}"
spec:
parallelism: 1
completions: 1