Skip to content

Use spf13/cobra for docker tag#23278

Merged
thaJeztah merged 1 commit intomoby:masterfrom
yongtang:23211-spf13-cobra-tag
Jun 7, 2016
Merged

Use spf13/cobra for docker tag#23278
thaJeztah merged 1 commit intomoby:masterfrom
yongtang:23211-spf13-cobra-tag

Conversation

@yongtang
Copy link
Copy Markdown
Member

@yongtang yongtang commented Jun 5, 2016

This fix is part of the effort to convert commands to spf13/cobra #23211.

Thif fix coverted command docker tag to use spf13/cobra

Signed-off-by: Yong Tang [email protected]

Comment thread api/client/image/tag.go Outdated
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

No need for [OPTIONS] here 👼

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Thanks @vdemeester the pull request has been updated with [OPTIONS] removed.

@yongtang yongtang force-pushed the 23211-spf13-cobra-tag branch from 31d5515 to 62f1fda Compare June 5, 2016 21:26
Comment thread integration-cli/docker_cli_tag_test.go Outdated
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I don't think we should remove these tests. I think we can fix the behaviour.

If you check out run, I use flags.SetInterspersed(false) in the NewRunCommand(). This will making it stop looking for flags once it finds the first non-flag arg.

Once that' s done we should get the -busybox:test arg as an arg, instead of failing flag validation, which should let us get the old error message out.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Thanks @dnephin. Let me update the pull request to address this issue.

@yongtang yongtang force-pushed the 23211-spf13-cobra-tag branch from 62f1fda to 02fca22 Compare June 6, 2016 01:33
@yongtang
Copy link
Copy Markdown
Member Author

yongtang commented Jun 6, 2016

Thanks @dnephin. I added flags.SetInterspersed(false) though it is still shows:

docker tag a -b
"docker tag" requires exactly 2 argument(s).
See 'docker tag --help'.

Usage:  docker tag IMAGE[:TAG] [REGISTRYHOST/][USERNAME/]NAME[:TAG]

Tag an image into a repository

After some investigation, it seems that ExactArgs() is not passing the expected args.
So I changed

        if len(args) == number 

to

        if len(cmd.Flags().Args()) == number 

in ExactArgs().

Now the command behaves as expected.

Just want to make sure there is no unintended side effect with this change.

@dnephin
Copy link
Copy Markdown
Member

dnephin commented Jun 6, 2016

I fixed it in cobra, and @vdemeester should be picking up the fix in one of the PRs, if you want to keep that change for now, maybe add a TODO saying it should be fixed in cobra?

@yongtang yongtang force-pushed the 23211-spf13-cobra-tag branch from 02fca22 to c1ca169 Compare June 6, 2016 02:22
@yongtang
Copy link
Copy Markdown
Member Author

yongtang commented Jun 6, 2016

@dnephin I just added a TODO in the commit and updated the pull request. Thanks for the help!

@vdemeester
Copy link
Copy Markdown
Member

Updated in #23269 😉

@thaJeztah
Copy link
Copy Markdown
Member

Oh, sorry @yongtang this one needs a rebase as well

@yongtang yongtang force-pushed the 23211-spf13-cobra-tag branch from c1ca169 to 607d528 Compare June 6, 2016 12:39
@yongtang
Copy link
Copy Markdown
Member Author

yongtang commented Jun 6, 2016

Thanks @vdemeester I will keep an eye on #23269 and remove TODO if it get merged. And thanks @thaJeztah the PR has been rebased.

@icecrime icecrime added the status/failing-ci Indicates that the PR in its current state fails the test suite label Jun 6, 2016
@yongtang yongtang force-pushed the 23211-spf13-cobra-tag branch from 607d528 to 1ad8f73 Compare June 7, 2016 02:03
@yongtang
Copy link
Copy Markdown
Member Author

yongtang commented Jun 7, 2016

The pull request has been rebased. It is likely there is a failing test. The failure is caused by an issue in cobra, which has been fixed (not yet merged into the docker yet). Once #23269 is merged the the failure will be fixed.

@thaJeztah
Copy link
Copy Markdown
Member

@yongtang #23269 was merged, so you can rebase and fix the failure

@yongtang yongtang force-pushed the 23211-spf13-cobra-tag branch from 1ad8f73 to ed658f1 Compare June 7, 2016 12:37
@yongtang
Copy link
Copy Markdown
Member Author

yongtang commented Jun 7, 2016

Thanks @thaJeztah the PR has been rebased and fixed.

@thaJeztah thaJeztah removed the status/failing-ci Indicates that the PR in its current state fails the test suite label Jun 7, 2016
This fix is part of the effort to convert commands to spf13/cobra moby#23211.

Thif fix coverted command `docker tag` to use spf13/cobra

Signed-off-by: Yong Tang <[email protected]>
@yongtang yongtang force-pushed the 23211-spf13-cobra-tag branch from ed658f1 to ba7324f Compare June 7, 2016 15:13
@dnephin
Copy link
Copy Markdown
Member

dnephin commented Jun 7, 2016

LGTM

1 similar comment
@cpuguy83
Copy link
Copy Markdown
Member

cpuguy83 commented Jun 7, 2016

LGTM

@vdemeester
Copy link
Copy Markdown
Member

LGTM 🐵

@thaJeztah
Copy link
Copy Markdown
Member

All green! Merging

@thaJeztah thaJeztah merged commit 55a8bfa into moby:master Jun 7, 2016
@yongtang yongtang deleted the 23211-spf13-cobra-tag branch June 8, 2016 02:04
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.

7 participants