-
Notifications
You must be signed in to change notification settings - Fork 177
Fix handling short id in docker app commands #717
Conversation
Signed-off-by: Jean-Christophe Sirot <[email protected]>
604f178
to
2f13025
Compare
Codecov Report
@@ Coverage Diff @@
## master #717 +/- ##
=======================================
Coverage 72.45% 72.45%
=======================================
Files 59 59
Lines 3438 3438
=======================================
Hits 2491 2491
Misses 612 612
Partials 335 335 Continue to review full report at Codecov.
|
015dc6d
to
7fa7cc7
Compare
var ( | ||
identifierRegexp = regexp.MustCompile(`^([a-f0-9]{64})$`) | ||
|
||
shortIdentifierRegexp = regexp.MustCompile(`^([a-f0-9]{1,64})$`) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only one character looks a little bit short, isn't it too widely open?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems that docker image inspect x
works if you have only 1 image whose id is starting with x
if err != nil { | ||
return nil, errors.Wrapf(err, "failed to read bundle %q", ref) | ||
} | ||
|
||
data, err := ioutil.ReadFile(filepath.Join(path, "bundle.json")) | ||
bndl, err := b.fetchBundleJSON(filepath.Join(paths[0], "bundle.json")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What happens to other paths here? Is it worth it returning all the paths if we only use the first (and I guess it has to be the id
path?
7fa7cc7
to
2878175
Compare
2878175
to
606e6d3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM with a couple of nits
606e6d3
to
5ac6329
Compare
…le store. Now the bundle store scans the bundle directory and creates a map of existing bundle references. All subsequent operations on the bundle store are using this map as the reference for stored bundle. Signed-off-by: Jean-Christophe Sirot <[email protected]>
5ac6329
to
280f562
Compare
- What I did
This PR add the possibility to use short id in
docker app
commands (app image tag
,app image remove
,app run
...)- How I did it
The bundle store interface now exposes a
LookUp
function which convert a string (an id, short id, tagged or digested reference) into areference.Reference
object if it exists in the store. A map ofID
to[]reference.Reference
is also maintained by the bundle store implementation.- How to verify it
Some unit tests and e2e tests have been added
- A picture of a cute animal (not mandatory but encouraged)