creativeprojects / resticprofile

Configuration profiles manager and scheduler for restic backup
https://creativeprojects.github.io/resticprofile/
GNU General Public License v3.0
701 stars 33 forks source link

schedule: added unified schedule config struct #333

Closed jkellerer closed 6 months ago

jkellerer commented 7 months ago

Draft for schedule structs discussed in #80

# defaults in global section
global:
  systemd-drop-in-files:
    - "default-drop-in.conf"

  schedule-defaults:
    log: /path/to/default-schedule.log
    lock-wait: 60m

# inline or schedule structure type config in profile command sections
default:
  systemd-drop-in-files:
    - "profile-operrides.conf"

  # inline
  check:
    schedule:
      - weekly
    schedule-log: /path/to/check.log

  # schedule structure
  backup:
    schedule:
      at: "daily"
      log: /path/to/backup-schedule.log
      lock-wait: 30m

.. and finally group support (in this PR, it is config only. Also needs updates to scheduling (partially done in #290), coming later):

version = 2

groups:
  all:
    profiles: "*"
    schedules:
      backup:
        at: "daily"
        log: /path/to/backup-schedule.log
        lock-wait: 30m
codecov[bot] commented 7 months ago

Codecov Report

Attention: Patch coverage is 90.38902% with 42 lines in your changes are missing coverage. Please review.

Project coverage is 70.50%. Comparing base (5fad1cb) to head (9a46c4c).

Files Patch % Lines
commands.go 33.33% 14 Missing :warning:
config/mocks/PropertyInfo.go 48.00% 10 Missing and 3 partials :warning:
config/config.go 79.41% 4 Missing and 3 partials :warning:
config/jsonschema/schema.go 84.21% 1 Missing and 2 partials :warning:
config/schedule.go 98.49% 2 Missing and 1 partial :warning:
config/profile.go 92.59% 1 Missing and 1 partial :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #333 +/- ## ========================================== + Coverage 69.96% 70.50% +0.54% ========================================== Files 118 119 +1 Lines 11923 12176 +253 ========================================== + Hits 8341 8584 +243 - Misses 3193 3196 +3 - Partials 389 396 +7 ``` | [Flag](https://app.codecov.io/gh/creativeprojects/resticprofile/pull/333/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Fred) | Coverage Δ | | |---|---|---| | [unittests](https://app.codecov.io/gh/creativeprojects/resticprofile/pull/333/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Fred) | `70.50% <90.39%> (+0.54%)` | :arrow_up: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Fred#carryforward-flags-in-the-pull-request-comment) to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

jkellerer commented 6 months ago

@creativeprojects , think it is ready now. had it running on one of my machines and schedules work like before (had them recreated to use run-schedule).

creativeprojects commented 6 months ago

I looked at the MR and so far it all looks good to me. I'm going to play with it on some of my configs and see how it goes 👍🏻

Oh BTW I forgot to mention I think we have no way of displaying a group configuration: the <profile>.show command only works with profiles 🤔 we could add the feature later though

jkellerer commented 6 months ago

Thanks for checking!

jkellerer commented 6 months ago

Had already began refactoring #290 to allow scheduling groups. That is the only remaining part.