Skip to content
This repository has been archived by the owner on Jun 13, 2021. It is now read-only.

WIP: refactor as a CLI plugin #433

Closed
wants to merge 2 commits into from
Closed

WIP: refactor as a CLI plugin #433

wants to merge 2 commits into from

Conversation

ijc
Copy link
Contributor

@ijc ijc commented Dec 13, 2018

- What I did

First pass refactoring as a plugin using the framework from docker/cli#1564.

I intend to track that PR using app as a test case for the framework. Shouldn't be merged until the plugins stuff is available!

- How to verify it

With a docker CLI binary build from docker/cli#1564 place the docker-app built from this PR in the plugin search path (or set DOCKER_CLI_PLUGIN_EXTRA_DIRS to point to a directory containing docker-app). Then docker app «foof» should work as docker-app «foof» did previously.

@GordonTheTurtle
Copy link

Please sign your commits following these rules:
https://github.com/moby/moby/blob/master/CONTRIBUTING.md#sign-your-work
The easiest way to do this is to amend the last commit:

$ git clone -b "cli-plugin" git@github.com:ijc/docker-app.git somewhere
$ cd somewhere
$ git rebase -i HEAD~842354474752
editor opens
change each 'pick' to 'edit'
save the file and quit
$ git commit --amend -s --no-edit
$ git rebase --continue # and repeat the amend for each commit
$ git push -f

Amending updates the existing PR. You DO NOT need to open a new one.

@codecov
Copy link

codecov bot commented Dec 18, 2018

Codecov Report

Merging #433 into master will decrease coverage by 0.11%.
The diff coverage is 87.5%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #433      +/-   ##
==========================================
- Coverage   62.65%   62.54%   -0.12%     
==========================================
  Files          49       49              
  Lines        2362     2339      -23     
==========================================
- Hits         1480     1463      -17     
+ Misses        679      676       -3     
+ Partials      203      200       -3
Impacted Files Coverage Δ
internal/packager/extract.go 69.41% <0%> (ø) ⬆️
cmd/docker-app/root.go 75% <100%> (-1.93%) ⬇️
cmd/docker-app/main.go 100% <100%> (+28.57%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 78fa752...2ea4767. Read the comment docs.

@ijc
Copy link
Contributor Author

ijc commented Dec 18, 2018

Self Reminder: There's a bunch of docs updates required here too.

Ian Campbell added 2 commits January 29, 2019 15:35
Needed some dependency bumps for newer deps (docker/docker and grpc) plus
tweaks to the app due to api changes.

Signed-off-by: Ian Campbell <ijc@docker.com>
docker/cli#1564

Since this pushes the actual command down to `docker-app app`, adjust the e2e
tests with:

    $ sed -Eie 's/icmd\.RunCommand\(dockerApp,/icmd.RunCommand(dockerApp, "app",/g' e2e/*.go
    $ sed -Eie 's/exec.Command\(dockerApp,/exec.Command(dockerApp, "app",/g' e2e/*.go
    $ sed -Eie 's/\[\]string\{dockerApp,/\[\]string\{dockerApp, "app",/g' e2e/*.go

(which might be precisely equivalent to `sed -Eie 's/dockerApp,/dockerApp, "app",/g' e2e/*.go`)

Finally, the idiom in docker/cli (for better or worse) is to include an "Error:
" prefix in the error string itself, rather than injecting it when printing.
Since CLI plugins follow the behaviour of the CLI here it is necessary to
prepend "Error: " to some messages. I've only done exactly those necessary to
pass the e2e tests, a fuller audit is very likely required.

Signed-off-by: Ian Campbell <ijc@docker.com>
@ijc
Copy link
Contributor Author

ijc commented Feb 27, 2019

Closing in favour of #469

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

2 participants