Skip to content
This repository has been archived by the owner on Feb 24, 2020. It is now read-only.

stage0: implement image list --full flag #1455

Merged
merged 6 commits into from Sep 25, 2015

Conversation

blixtra
Copy link
Collaborator

@blixtra blixtra commented Sep 22, 2015

The output of rkt image list was not very pleasant due to the very
long hash and data format. This change shortens the hash to use the
first 12 alphanumeric digits after the '-' char. The date format is
changed to use a human readable format such as "5 days ago". For this, a new dependency was added, github.com/dustin/go-humanize.

If one care to have the older output format, she can use the newly
introduced --full flag. Similar to the --full flag in rkt list, this
provides a full hash and date output string.

A follow up change needs to be made so that the commands that take the
image hash as an argument can use the short form. Currently the short
version of the hash is of little use other than viewing

@jonboulle jonboulle changed the title Blixtra/rkt implement image list full flag stage0: implement image list --full flag Sep 22, 2015
@alban
Copy link
Member

alban commented Sep 22, 2015

This documentation should be updated:

https://github.com/coreos/rkt/blob/master/Documentation/subcommands/image.md

@iaguis
Copy link
Member

iaguis commented Sep 22, 2015

Cool!

A couple of things:

  • I think we should make the other commands work with the short form in this PR. The image workflow would be broken by default if we don't.
  • Should we include sha512-?. Currently the spec says "Currently the only permitted hash algorithm is sha512".

@sgotti
Copy link
Contributor

sgotti commented Sep 23, 2015

Should we include sha512-?. Currently the spec says "Currently the only permitted hash algorithm is sha512".

I'm quite worried about removing this as it's required in all the manifest and this will create some confusion. IMHO it looks cleaner to know the hash type. Additionally if the spec adds additional hash types the prefix will be needed and coming back to it will create some UX problems.

I think we should make the other commands work with the short form in this PR. The image workflow would be broken by default if we don't.

If keeping sha512- the commands should use store.ResolveKey to get the full key from a shorter form. I haven't checked if all commands are doing this correclty (I'm quite sure that rkt image rm just works correctly).

@blixtra blixtra force-pushed the blixtra/rkt-implement-image-list-full-flag branch from a21165d to 4a7ab0d Compare September 23, 2015 12:28
@blixtra
Copy link
Collaborator Author

blixtra commented Sep 23, 2015

@sgotti Thanks for the input. I've updated the PR and with the hash identifier prefix the other commands do work fine.

@alban
Copy link
Member

alban commented Sep 23, 2015

The code LGTM.

@yifan-gu : do you know if there is any script parsing the output of rkt image list? Kubernetes?

TODO:

@blixtra
Copy link
Collaborator Author

blixtra commented Sep 23, 2015

@alban Working on the tests and thanks fro the documentation heads-up.

Should we really be parsing the command line output? Perhaps we could just have a json output format. I recall there being a ticket about that but I didn't find it with a quick search.

@alban
Copy link
Member

alban commented Sep 23, 2015

Should we really be parsing the command line output?

I think we should not parse the output, but I wanted to check just in case some software does it anyway.

@yifan-gu
Copy link
Contributor

@yifan-gu : do you know if there is any script parsing the output of rkt image list? Kubernetes?

@alban Not sure what do you mean by script. But I am parsing it in kubernetes, for example here

@blixtra
Copy link
Collaborator Author

blixtra commented Sep 23, 2015

@yifan-gu I took a quick look at that code and it looks like it should work with this change if you don't require the full hash. The output with that command is now simply...

sha512-b843248e28fa redis:latest

@yifan-gu
Copy link
Contributor

@blixtra I think this won't break the code until we have a collision on the shortened hash :)
Anyway hopefully api service can save us from such problems.

@blixtra blixtra force-pushed the blixtra/rkt-implement-image-list-full-flag branch from cef7359 to 827e169 Compare September 25, 2015 11:58
@blixtra
Copy link
Collaborator Author

blixtra commented Sep 25, 2015

Added functional tests and the docs are updated.

// Run tests
for _, tt := range tests {
runCmd := fmt.Sprintf("%s %s", ctx.cmd(), tt.cmd)
t.Logf("executing: %v", runCmd)
Copy link
Member

Choose a reason for hiding this comment

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

It's useful to know the test number, can you add it?

@blixtra blixtra force-pushed the blixtra/rkt-implement-image-list-full-flag branch from 827e169 to 33668ea Compare September 25, 2015 14:56
@blixtra
Copy link
Collaborator Author

blixtra commented Sep 25, 2015

Thanks for the feedback. Here's another go.

@blixtra blixtra force-pushed the blixtra/rkt-implement-image-list-full-flag branch from 33668ea to 2164938 Compare September 25, 2015 15:29
@alban
Copy link
Member

alban commented Sep 25, 2015

LGTM when the Semaphore tests pass.

Note: TestShortHash will need to be updated when #1483 gets fixed.

The output of rkt image list was not very pleasant due to the very long
hash and data format. This change shortens the hash to show the hash
identifier plus the first 12 alphanumeric digits after the '-' char by
default. The date format is changed to use a human readable format such
as "5 days ago".

If one care to have the older output format, she can use the newly
introduced --full flag. Similar to the --full flag in rkt list, this
provides a full hash and date output string.

A follow up change needs to be made so that the commands that take the
image hash as an argument can use the short form. Currently the short
version of the hash is of little use other than viewing.

Closes rkt#1438
Closes rkt#1439
This commit refactors the functional call, panic pattern that was reused
often in the functional tests.
The tests checks that `rkt image list` is returning the correct short
hash and the commands accept image hashes as parameters work with that
hash.
@blixtra blixtra force-pushed the blixtra/rkt-implement-image-list-full-flag branch from 2164938 to 4d23248 Compare September 25, 2015 15:38
iaguis added a commit that referenced this pull request Sep 25, 2015
…t-full-flag

stage0: implement image list --full flag
@iaguis iaguis merged commit feadd17 into rkt:master Sep 25, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants