ostreedev / ostree

Operating system and container binary deployment and upgrades
https://ostreedev.github.io/ostree/
Other
1.23k stars 287 forks source link

RFE: prune: static delta prune user stories #1481

Open dustymabe opened 6 years ago

dustymabe commented 6 years ago

This may be already covered in one way or another with existing functionality, if so maybe this is a doc/example RFE more than anything else.

cgwalters commented 6 years ago

It seems to me that https://github.com/ostreedev/ostree/issues/1479 is the same as this RFE right? In other words, if --static-deltas-only was honored you could prune them with the same policy as commits right?

dustymabe commented 6 years ago

It seems to me that #1479 is the same as this RFE right? In other words, if --static-deltas-only was honored you could prune them with the same policy as commits right?

Maybe? For some reason for me it is confusing to think about exactly how to combine the options in order to achieve the above mentioned user stories. That's why I said this may be a doc/example RFE more than anything else. We could definitely use some examples in the man pages.

cgwalters commented 6 years ago

It'd be ostree prune --refs-only --static-deltas-only and ostree prune --refs-only --depth=10 --static-deltas-only right?

(update: edited to add --refs-only in the second case too)

dustymabe commented 6 years ago

It'd be ostree prune --refs-only --static-deltas-only

So this one says prune all deltas that don't point to HEAD commits?

and ostree prune --refs-only --depth=10 --static-deltas-only right?

and this one says prune all deltas that point to depth > 10 commits?

That makes sense, but I don't think it's completely obvious with the given docs. For example the --depth= argument could be interpreted as commit depth or static delta depth (if that was even a thing). An example would go a long way here, I think.

cgwalters commented 6 years ago

with the given docs.

There are no docs for this, --static-deltas-only never had any useful semantics; here we're deciding what those semantics are/should be.

In general, we treat deltas as a derived artifact whose "lifecycle" is tied to the commit. Aside from the discussions of "delta only repositories", it doesn't make sense to keep around a delta but not the commit, right?

So all of the prune logic is around the commits.

dustymabe commented 6 years ago

There are no docs for this, --static-deltas-only never had any useful semantics.

The docs I was referring to are what is in the man page

In general, we treat deltas as a derived artifact whose "lifecycle" is tied to the commit. Aside from the discussions of "delta only repositories", it doesn't make sense to keep around a delta but not the commit, right?

I wouldn't think it would make sense (especially if we are talking about the final commit in (final - initial) notation).

So all of the prune logic is around the commits.

does that mean that static deltas do get pruned when pruning normal commits (without --static-delta-only)?

cgwalters commented 6 years ago

The docs I was referring to are what is in the man page

Hm, my patch to make it an error should have also clarified things in the man page. I'll fix it to reflect reality too.

does that mean that static deltas do get pruned when pruning normal commits (without --static-delta-only)?

Yep.

cgwalters commented 6 years ago

Docs PR in https://github.com/ostreedev/ostree/pull/1484

klausenbusk commented 6 years ago

user story: as an admin of an ostree repo, I only consider the latest HEAD commit in any ref to be relevant with regards to static deltas. I'd like a single command I can run to prune all static deltas but the ones pointing the HEAD of a particular ref (or all refs)

For now I'm using the following shell code, but I would definitely prefer a builtin command.

while read delta; do
        to="${delta#*-}"
        if ! grep -rq "^$to$" refs/; then
                ostree static-delta delete "${delta}"
        fi
done < <(ostree static-delta list)