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 pending-base-commit to status #595

Closed
wants to merge 4 commits into from

Conversation

cgwalters
Copy link
Member

@cgwalters cgwalters commented Jan 28, 2017

One thing that's very confusing about OSTree is there are two layers -
deployments and the refs/commits. If one does an rpm-ostree upgrade, but then
e.g. ostree admin undeploy 0, you still have the new revision in the repo.

We don't do a good job of displaying this state, or helping people clean
it up.

Down the line, I also want to better support something like rpm-ostree pull to
cache updates explicitly without deploying.

This commit just adds a bit of information to the status display. We might want
to have better formatting, but I think this an OK start.

One thing that's very confusing about OSTree is there are two layers -
deployments and the refs/commits. If one does an `rpm-ostree upgrade`, but then
e.g. `ostree admin undeploy 0`, you still have the new revision in the repo.

We don't do a good job of displaying this state, or helping people clean
it up.

Down the line, I also want to better support something like `rpm-ostree pull` to
cache updates explicitly *without* deploying.

This commit just adds a bit of information to the status display. We might want
to have better formatting, but I think this an OK start.
@cgwalters
Copy link
Member Author

This should be good now, the compose test just flaked on repodata.

Copy link
Member

@jlebon jlebon left a comment

Choose a reason for hiding this comment

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

So the assumption here is that the refspec is currently pointing at the base commit we want to deploy? Though in the case of rebase, that doesn't hold true.

One thing that's very confusing about OSTree is there are two layers -
deployments and the refs/commits. If one does an rpm-ostree upgrade, but then
e.g. ostree admin undeploy 0, you still have the new revision in the repo.

But then when the user does rpm-ostree upgrade again, we'll still contact the remote, right? So then that pending commit might not be what we actually use anyway.

csum, &gpg_enabled);
{
base_checksum = csum;
sigs = rpmostreed_deployment_gpg_results (repo, refspec, csum, &gpg_enabled);
Copy link
Member

Choose a reason for hiding this comment

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

Looks like you can just hoist this out of the if and else blocks.

{
const char *base_checksum;
g_assert (g_variant_dict_lookup (dict, "base-checksum", "&s", &base_checksum));
print_kv ("BaseCommit", max_key_len, base_checksum);
}
print_kv ("Commit", max_key_len, checksum);

/* Pending state, but only for the booted comit */
Copy link
Member

Choose a reason for hiding this comment

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

Nit: s/comit/commit/

variant_add_commit_details (&dict, NULL, commit);

if (!ostree_repo_resolve_rev (repo, refspec, TRUE,
&pending_base_commitrev, error))
Copy link
Member

Choose a reason for hiding this comment

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

This won't work with rebases though, 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 I would say here is that at the moment, the data I'm trying to add is just looking for any changes in the origin refspec vs deployed checksum - for each deployment independently.

So it "works" with rebases by ignoring it, because it's a new deployment. I wouldn't say it's broken, but it's showing you information you don't need. Admittedly it is a bit redundant too if you do an atomic host upgrade; atomic host status.

@cgwalters
Copy link
Member Author

Maybe to be least confusing, I can only show the information if there isn't a pending deployment. In that case actually, we'd only show it if the user explicitly did an ostree pull or an ostree reset or something that gets the refspec out of sync. But it helps set the stage for supporting a "pull but don't deploy" mode here, like ostreedev/ostree#642

@cgwalters
Copy link
Member Author

Ok, did that in ⬆️

@jlebon
Copy link
Member

jlebon commented Feb 8, 2017

OK, that works!
@rh-atomic-bot r+ 388ba4b

@rh-atomic-bot
Copy link

⌛ Testing commit 388ba4b with merge ace223a...

@rh-atomic-bot
Copy link

☀️ Test successful - status-atomicjenkins
Approved by: jlebon
Pushing ace223a to master...

jlebon added a commit to jlebon/rpm-ostree that referenced this pull request Sep 11, 2017
Commands like `upgrade` and `deploy` need to know if a new deployment
was actually laid down so that it may print a pkg diff if so. This is
implemented by listening for changes to the DefaultDeployment D-Bus
property. D-Bus emits a signal when the deployment variant changes
value.

However, in coreos#595, with the introduction of `pending-*` related keys, the
deployment variant no longer represents data solely tied to that
specific deployment. In this case, because `deploy` operations currently
set the ref to the resolved checksum, it can happen that deploying the
same base commit when the current refspec *isn't* pointing to that base
commit will result in the `pending-*` keys dropping out and a default
deployment change notification going out.

In this patch, we strengthen how we determine whether a new deployment
was laid down by actually looking at the deployment id, rather than just
assuming that a change to the property implies a new deployment.

Closes: coreos#981
rh-atomic-bot pushed a commit that referenced this pull request Sep 12, 2017
Commands like `upgrade` and `deploy` need to know if a new deployment
was actually laid down so that it may print a pkg diff if so. This is
implemented by listening for changes to the DefaultDeployment D-Bus
property. D-Bus emits a signal when the deployment variant changes
value.

However, in #595, with the introduction of `pending-*` related keys, the
deployment variant no longer represents data solely tied to that
specific deployment. In this case, because `deploy` operations currently
set the ref to the resolved checksum, it can happen that deploying the
same base commit when the current refspec *isn't* pointing to that base
commit will result in the `pending-*` keys dropping out and a default
deployment change notification going out.

In this patch, we strengthen how we determine whether a new deployment
was laid down by actually looking at the deployment id, rather than just
assuming that a change to the property implies a new deployment.

Closes: #981

Closes: #984
Approved by: cgwalters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants