Skip to content

feat: pass custom options to restic backup#101

Open
elmotec wants to merge 5 commits intolawndoc:mainfrom
elmotec:feat/restic-args
Open

feat: pass custom options to restic backup#101
elmotec wants to merge 5 commits intolawndoc:mainfrom
elmotec:feat/restic-args

Conversation

@elmotec
Copy link

@elmotec elmotec commented Jan 24, 2026

add stack-back.restic.backup.options label to the stack-back container (not the backed up containers because all volumes are backed up with one restic command) to take restic backup options. Defaults to --verbose for backward compatibility.

Also:

  • add LABEL_RESTIC_BACKUP_OPTIONS as enum.
  • feature works for both volumes and database backup.
  • change backup(), backup_from_stdin() signature to take restic_backup_options as argument.
  • add --tag test-tag to test compose file and integration_test.
  • enhance integration_test parsing of snapshots (could use json, but less readable).
  • improve visibility of logs when integration tests run showing output of restic command in pytest log (with --log-cli-level=DEBUG).
  • documentation.

add stack-back.restic.backup.options label to the stack-back container
to take `restic backup` options.  Defaults to `--verbose` for backward
compatibility.

Also:
- add LABEL_RESTIC_BACKUP_OPTIONS as enum.
- feature works for both volumes and database backup.
- change backup(), backup_from_stdin() signature to take
  restic_backup_options as argument.
- add --tag test-tag to test compose file and integration_test.
- enhance integration_test parsing of snapshots (could use json, but
  less readable).
- improve visibility of logs when integration tests run showing output
  of restic command in pytest log (with --log-cli-level=DEBUG).
- documentation.
Copilot AI review requested due to automatic review settings January 24, 2026 22:41
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds support for passing custom restic backup options through a Docker label stack-back.restic.backup.options. The feature aims to allow users to customize restic backup behavior (e.g., adding tags) while maintaining backward compatibility with the default --verbose flag.

Changes:

  • Added LABEL_RESTIC_BACKUP_OPTIONS constant to enums
  • Modified backup function signatures to accept restic_backup_options parameter
  • Enhanced integration tests with snapshot parsing and tag verification
  • Added documentation for the new feature

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
src/restic_compose_backup/enums.py Added new label constant for restic backup options
src/restic_compose_backup/restic.py Updated backup functions to accept and pass custom options
src/restic_compose_backup/containers.py Updated base container backup method signature
src/restic_compose_backup/containers_db.py Updated database container backup methods to accept options
src/restic_compose_backup/cli.py Added label parsing logic and option passing
src/tests/integration/test_volume_backups.py Added snapshot parsing helper and tag verification
src/tests/integration/conftest.py Added debug logging for test diagnostics
docker-compose.test.yaml Added test label with --tag option
docs/guide/configuration.rst Documented the new feature
README.md Added note about pytest debug options

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Per lawndoc#101 (comment).  It does feel less surprising.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copy link
Owner

@lawndoc lawndoc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @elmotec thanks for the PR! In addition to your use cases from the discussion, I know this will be handy for people who want to use glacier s3 class and need to pass through additional args for that to work.

Just a few comments for you to review.

@elmotec
Copy link
Author

elmotec commented Feb 8, 2026

Hi @elmotec thanks for the PR! In addition to your use cases from the discussion, I know this will be handy for people who want to use glacier s3 class and need to pass through additional args for that to work.

Just a few comments for you to review.

Thanks @lawndoc, I addressed your comments. Re-requested review.

@elmotec elmotec requested a review from lawndoc February 8, 2026 20:36
@elmotec
Copy link
Author

elmotec commented Feb 9, 2026

Also I am wondering if we should support a back-stack.restic.backup.db.options for the database restic backup call. I am not sure, it could lead to different set of options for each database type (postres, MySQL, ...). It might get complicated.

@lawndoc
Copy link
Owner

lawndoc commented Feb 16, 2026

Also I am wondering if we should support a back-stack.restic.backup.db.options for the database restic backup call. I am not sure, it could lead to different set of options for each database type (postres, MySQL, ...). It might get complicated.

Not a bad idea, but let's save that for another PR so we can get this one merged first.

Copy link
Owner

@lawndoc lawndoc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As I stated in our existing thread, please update the docs to make it clear that backups options should be specific to that sub-command.

Sorry it's been slow feedback on this PR. Been a bit busy lately, but will have more free time again in March.

@elmotec
Copy link
Author

elmotec commented Feb 17, 2026

As I stated in our existing thread, please update the docs to make it clear that backups options should be specific to that sub-command.

Sorry it's been slow feedback on this PR. Been a bit busy lately, but will have more free time again in March.

No worry. I updated the doc to make clear the value of the label is appended at the end of the restic backup command.

@elmotec elmotec requested a review from lawndoc February 17, 2026 12:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants