Files
backups/generate_pipeline.py
jthor 8ccc129452
All checks were successful
ci/woodpecker/push/regen-update-pipeline Pipeline was successful
test
2025-09-20 23:40:03 -04:00

34 lines
811 B
Python

import json
from jinja2 import Template
with open("backup-paths.json") as f:
manifest = json.load(f)
template_str = """
kind: pipeline
type: docker
name: backup
when:
event: manual
steps:
{% for backup in backups %}
- name: backup_{{ backup.name }}
image: alpine:3
volumes:
- {{ backup.path }}:/mnt/{{ backup.name }}
commands:
- echo "Backing up {{ backup.path }}"
- tar czf /tmp/{{ backup.name }}.tar.gz /mnt/{{ backup.name }}
# Replace with your actual upload/rsync/rclone command
- echo "Upload {{ backup.name }}.tar.gz to remote"
{% endfor %}
"""
template = Template(template_str)
output = template.render(backups=manifest["backups"])
with open(".woodpecker.yml", "w") as f:
f.write(output)
print("Generated .woodpecker.yml with inline volumes")