Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new ex history command #1813

Closed
wants to merge 1 commit into from
Closed

Add new ex history command #1813

wants to merge 1 commit into from

Conversation

jlebon
Copy link
Member

@jlebon jlebon commented Apr 16, 2019

This is the rpm-ostree equivalent of dnf history. As opposed to the
history of the refspec (i.e. ostree log), this shows the history of
the system, i.e. the refspecs the host deployed, checksums, versions,
layered packages, etc... The amount of details remembered is similar to
what shows up in status.

There's definitely some further enhancements possible (e.g. printing
package diffs, displaying rollbacks), though this seems in good enough
shape as a first cut.

Closes: #1489

@jlebon jlebon added the WIP label Apr 16, 2019
@jlebon
Copy link
Member Author

jlebon commented Apr 16, 2019

Requires ostreedev/ostree#1842

@jlebon jlebon force-pushed the pr/history branch 3 times, most recently from e8a03f3 to 75aee0e Compare April 25, 2019 02:25
@jlebon jlebon mentioned this pull request Apr 25, 2019
@rh-atomic-bot
Copy link

☔ The latest upstream changes (presumably 97bb57d) made this pull request unmergeable. Please resolve the merge conflicts.

Copy link
Member

@cgwalters cgwalters left a comment

Choose a reason for hiding this comment

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

Just two quick comments. Not sure I understand the high level theory of operation, how the history dir and the journal interact, etc. A brief description of that type of stuff (e.g. as a rustdoc header in the history.rs file) could help a lot.

src/app/rpmostree-ex-builtin-history.c Outdated Show resolved Hide resolved
rust/src/history.rs Show resolved Hide resolved
rust/src/history.rs Outdated Show resolved Hide resolved
@jlebon
Copy link
Member Author

jlebon commented Apr 30, 2019

Fixup! ⬆️

I added docstrings on the functions that missed them and a header describing the overall approach. In the process, I ended up renaming a bunch of things to clearer, more appropriate, names.

@jlebon jlebon marked this pull request as ready for review May 3, 2019 19:35
@jlebon
Copy link
Member Author

jlebon commented May 3, 2019

Rebased! (Just marking as "Ready for review" to pass it through CI).

@jlebon
Copy link
Member Author

jlebon commented May 3, 2019

bot, retest this please

@lucab
Copy link
Contributor

lucab commented May 7, 2019

One overall doubt that the docstring didn't answer: is there some garbage-collection mechanism to be considered/planned/implemented here for history files?

@jlebon
Copy link
Member Author

jlebon commented May 7, 2019

is there some garbage-collection mechanism to be considered/planned/implemented here for history files?

Yes, this is implemented by history_prune in history.rs. We bind pruning to journal log pruning.

@miabbott
Copy link
Member

miabbott commented May 7, 2019

/me bikesheds

In a recent demo of this work, @jlebon pointed out that DeployCommand was indicating the command that was responsible for creating the deployment. So if a user used rpm-ostree rollback to go back to the previous deployment, the DeployCommand wouldn't be rollback, but rather install ltrace or override remove podman.

@dustymabe suggested that we go a step further and track this difference, so rollback would be recorded in the history somehow.

I think this would be excellent, as long as we could display this info in a sane way. Maybe use DeployCommand in the case of a rollback, but also have something like DeployCreateCommand to show the original command used?

The more I think on this, it seems like it's really only the rollback command where confusion would arise. Other operations (deploy, install, rebase, upgrade, etc) are really about creating a brand new deployment, where as rollback is about using a previously created deployment and you would want to know how that deployment was created.

Copy link
Member

@cgwalters cgwalters left a comment

Choose a reason for hiding this comment

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

Overall, this is good code. The doc comment helps significantly, though I still find myself a bit lost while trying to grasp some of the details.

I like the journal unit tests.

We're a bit lacking real e2e tests - we could at least sprinkle a few ex history assertions inside the existing tests probably?

Overall particularly given the fact that this is ex I'm in disposition to merge, though I do have one question around the architecture at the end - it seems dramatically simpler if we can serialize everything we care about in the journal.

rust/src/history.rs Outdated Show resolved Hide resolved
* it breaks the expectation that journal messages should be somewhat easily
* introspectable. We could also serialize it to JSON first, though we wouldn't be able to
* re-use the printing code in `status.c` as is. Note also the GVariant can be large (e.g.
* we include the full `rpmostree.rpmdb.pkglist` in there). */
Copy link
Member

Choose a reason for hiding this comment

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

What elements of this deployment variant do we use? The other option is to log those as structured fields right?

Copy link
Member Author

Choose a reason for hiding this comment

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

What elements of this deployment variant do we use?

Basically almost everything. :) We pass it to the same function in status.c that normally prints it. I also want to make use of the pkglist in the future so that we can show the diff from one version to the next.

The other option is to log those as structured fields right?

Yeah, I had briefly looked at this. One obvious annoyance is that the field naming convention means we have to do some translation back and forth for the top-level keys. And the values themselves I guess would have to be run through g_variant_print and g_variant_parse. Still, I go back to whether we should shove that much data in the journal in the first place. (Even though the actual limit is a crazy amount like 768M...). It somewhat reminds me of the D-Bus/--json discussion around pkglists and how we ended up blacklisting it, even though it's mostly for machines.

@jlebon
Copy link
Member Author

jlebon commented May 24, 2019

We're a bit lacking real e2e tests

Yeah, I'm pretty confident in the unit tests, though I definitely intend to add some basic vmcheck tests as well!

@jlebon
Copy link
Member Author

jlebon commented May 24, 2019

I just realized now that I squashed changes into the commit and rebased in one shot, which makes it hard to see what changed. Anyway, it was mostly a rebase + supporting --json + using get_file_type(). Still need to add tests and address some of the feedback from #1813 (comment) (though yeah... might leave that as a follow-up).

@jlebon jlebon changed the title WIP: Add new ex history command Add new ex history command Jun 11, 2019
@jlebon jlebon removed the WIP label Jun 11, 2019
@jlebon
Copy link
Member Author

jlebon commented Jun 11, 2019

Now with tests! Dropped WIP and updated the original comment as well with the final commit message.

I haven't addressed the feedback in #1813 (comment) other than renaming the key names to CreateCommand and CreateTimestamp. Will open a follow-up ticket for the remaining items.

@jlebon jlebon force-pushed the pr/history branch 2 times, most recently from 86f7f32 to 443fe25 Compare September 20, 2019 21:10
This is the rpm-ostree equivalent of `dnf history`. As opposed to the
history of the refspec (i.e. `ostree log`), this shows the history of
the system, i.e. the refspecs the host deployed, checksums, versions,
layered packages, etc... The amount of details remembered is similar to
what shows up in `status`.

There's definitely some further enhancements possible (e.g. printing
package diffs, displaying rollbacks), though this seems in good enough
shape as a first cut.

Closes: coreos#1489
@jlebon
Copy link
Member Author

jlebon commented Sep 23, 2019

✔️ Tests all green now!
Let's ship this?

@cgwalters
Copy link
Member

I think this is safe enough to try out and use to gather feedback. Thanks for the work on this!

@rh-atomic-bot r+ f49100a

@rh-atomic-bot
Copy link

⌛ Testing commit f49100a with merge d3f08ae...

rh-atomic-bot pushed a commit that referenced this pull request Sep 23, 2019
This is the rpm-ostree equivalent of `dnf history`. As opposed to the
history of the refspec (i.e. `ostree log`), this shows the history of
the system, i.e. the refspecs the host deployed, checksums, versions,
layered packages, etc... The amount of details remembered is similar to
what shows up in `status`.

There's definitely some further enhancements possible (e.g. printing
package diffs, displaying rollbacks), though this seems in good enough
shape as a first cut.

Closes: #1489

Closes: #1813
Approved by: cgwalters
@rh-atomic-bot
Copy link

💔 Test failed - status-papr

@jlebon
Copy link
Member Author

jlebon commented Sep 23, 2019

@rh-atomic-bot retry

@rh-atomic-bot
Copy link

⌛ Testing commit f49100a with merge b740eb4...

rh-atomic-bot pushed a commit that referenced this pull request Sep 23, 2019
This is the rpm-ostree equivalent of `dnf history`. As opposed to the
history of the refspec (i.e. `ostree log`), this shows the history of
the system, i.e. the refspecs the host deployed, checksums, versions,
layered packages, etc... The amount of details remembered is similar to
what shows up in `status`.

There's definitely some further enhancements possible (e.g. printing
package diffs, displaying rollbacks), though this seems in good enough
shape as a first cut.

Closes: #1489

Closes: #1813
Approved by: cgwalters
@rh-atomic-bot
Copy link

💔 Test failed - status-papr

@jlebon
Copy link
Member Author

jlebon commented Sep 23, 2019

@rh-atomic-bot retry

@rh-atomic-bot
Copy link

⌛ Testing commit f49100a with merge 33cf82f...

rh-atomic-bot pushed a commit that referenced this pull request Sep 23, 2019
This is the rpm-ostree equivalent of `dnf history`. As opposed to the
history of the refspec (i.e. `ostree log`), this shows the history of
the system, i.e. the refspecs the host deployed, checksums, versions,
layered packages, etc... The amount of details remembered is similar to
what shows up in `status`.

There's definitely some further enhancements possible (e.g. printing
package diffs, displaying rollbacks), though this seems in good enough
shape as a first cut.

Closes: #1489

Closes: #1813
Approved by: cgwalters
@rh-atomic-bot
Copy link

💔 Test failed - status-papr

@jlebon
Copy link
Member Author

jlebon commented Sep 24, 2019

@rh-atomic-bot retry

@rh-atomic-bot
Copy link

⌛ Testing commit f49100a with merge 1db9670...

rh-atomic-bot pushed a commit that referenced this pull request Sep 24, 2019
This is the rpm-ostree equivalent of `dnf history`. As opposed to the
history of the refspec (i.e. `ostree log`), this shows the history of
the system, i.e. the refspecs the host deployed, checksums, versions,
layered packages, etc... The amount of details remembered is similar to
what shows up in `status`.

There's definitely some further enhancements possible (e.g. printing
package diffs, displaying rollbacks), though this seems in good enough
shape as a first cut.

Closes: #1489

Closes: #1813
Approved by: cgwalters
@rh-atomic-bot
Copy link

💔 Test failed - status-papr

@jlebon
Copy link
Member Author

jlebon commented Sep 24, 2019

@rh-atomic-bot retry

@rh-atomic-bot
Copy link

⌛ Testing commit f49100a with merge 1075559...

@rh-atomic-bot
Copy link

☀️ Test successful - status-papr
Approved by: cgwalters
Pushing 1075559 to master...

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.

Consider an rpm-ostree history command
5 participants