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

auto-update: make output more user friendly #10880

Merged
merged 6 commits into from
Jul 14, 2021

Conversation

vrothberg
Copy link
Member

@vrothberg vrothberg commented Jul 8, 2021

The rather raw and scarce output of podman auto-update has been a
thorn in my eyes for a longer while. So far, Podman would only print
updated systemd units, one per line, without further formatting.

Motivated by issue #9949 which is asking for some more useful
information in combination with a dry-run feature, I sat down and
reflected which information may come in handy.

Running podman auto-update will now look as follows:

$ podman auto-update                                                                        
Trying to pull [...]                                                                        
                                                                                            
UNIT                    CONTAINER            IMAGE                   POLICY      UPDATED    
container-test.service  08fd34e533fd (test)  localhost:5000/busybox  registry    false      

Also refactor the spaghetti code in the backend a bit to make it easier
to digest and maintain.

For easier testing and for the sake of consistency with other commands
listing output, add a --format flag.

The man page will get an overhaul in a follow up commit.

Signed-off-by: Valentin Rothberg [email protected]

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jul 8, 2021

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: vrothberg

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jul 8, 2021
@vrothberg
Copy link
Member Author

@edsantiago, I would love your thoughts on the proposed changes.

cmd/podman/auto-update.go Outdated Show resolved Hide resolved
@edsantiago
Copy link
Member

LGTM in principle, but there's a segv that needs fixing, and tests need some work too. I'll look again on Monday. Thanks for taking this on!

@vrothberg vrothberg force-pushed the auto-update branch 3 times, most recently from 287649e to 223ae16 Compare July 9, 2021 15:33
The output of auto-update leaves quite some space for improvements.  One
thing is to make it more obvious which systemd units were restarted.

With this change, the output looks as follows:
```
$ podman auto-update
Trying to pull...

Restarted the following systemd units:
$unit-1
$unit-2
$unit-3
```

Signed-off-by: Valentin Rothberg <[email protected]>
Fix a bug were an authfile label in a container would mistakenly
override the authfile path for all subsequent checks.

Signed-off-by: Valentin Rothberg <[email protected]>
Use the `HasDifferentDigest()` method of the image to replace the
previous checks if an image needs to be updated.

Signed-off-by: Valentin Rothberg <[email protected]>
Pass a single context.Context through the call stack.  If auto-updates
will ever be made available for REST calls, the context will help
supporting disconnected clients.

Signed-off-by: Valentin Rothberg <[email protected]>
Signed-off-by: Valentin Rothberg <[email protected]>
The rather raw and scarce output of `podman auto-update` has been a
thorn in my eyes for a longer while.  So far, Podman would only print
updated systemd units, one per line, without further formatting.

Motivated by issue containers#9949 which is asking for some more useful
information in combination with a dry-run feature, I sat down and
reflected which information may come in handy.

Running `podman auto-update` will now look as follows:

```
$ podman auto-update
Trying to pull [...]

UNIT                    CONTAINER            IMAGE                   POLICY      UPDATED
container-test.service  08fd34e533fd (test)  localhost:5000/busybox  registry    false
```

Also refactor the spaghetti code in the backend a bit to make it easier
to digest and maintain.

For easier testing and for the sake of consistency with other commands
listing output, add a `--format` flag.

The man page will get an overhaul in a follow up commit.

Signed-off-by: Valentin Rothberg <[email protected]>
@vrothberg
Copy link
Member Author

@edsantiago @mheon, updated. I like it much more like that 👍

@TomSweeneyRedHat
Copy link
Member

LGTM and happy green test buttons.
@edsantiago thoughts?

@edsantiago
Copy link
Member

Still LGTM but I will leave up to others to slash-lgtm it

@baude
Copy link
Member

baude commented Jul 14, 2021

alright, ill bite ...
/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Jul 14, 2021
@openshift-merge-robot openshift-merge-robot merged commit ce4c23c into containers:main Jul 14, 2021
@vrothberg vrothberg deleted the auto-update branch July 15, 2021 07:25
@github-actions github-actions bot added the locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. label Sep 22, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 22, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants