vmware-archive / repository-editor-for-tuf

Command line tool for editing and maintaining a TUF repository
Apache License 2.0
5 stars 3 forks source link

No-op snapshot #38

Closed jku closed 2 years ago

jku commented 2 years ago

Handle snapshot command when a new snapshot is not needed

If snapshot is not needed when user calls it (no targets versions were added or updated), avoid bumping snapshot version and expiry. This is useful in tuf-demo because the snapshot process can then run after every push and won't need complex logic to figure out when it needs to run.

This should then allow the snapshot task in tuf-demo workflow to look something like:

      tufrepo snapshot 
      tufrepo verify --root-hash 24d9b03f10ce0fe2e648833de26af60a4a8cd4e65bb396a8200a3194ae8ea76e
      # only set value to true if we really created a new snapshot, not if new snapshot was not needed
      git diff --quiet || echo "::set-output name=snapshot::true"

Fixes #37

jku commented 2 years ago

thanks for review. I pushed one more change (just added one more check to the test), will merge now

jku commented 2 years ago

tuf-demo seems to work now: Both snapshot and timestamp work and repository is in a valid state again