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

Support for adding docker image tag #230

Merged
merged 7 commits into from
Dec 28, 2016

Conversation

mystelynx
Copy link
Contributor

I added 2 options(repository, tag) to itamae docker command.

itamae docker --image=alpine --repository=foo:5000/bar --tag=v1 recipe.rb
# -> created image: repository=foo:5000/bar tag=v1

itamae docker --image=alpine --repository=foo --tag=v2 recipe.rb
# -> created image: repository=foo tag=v2

itamae docker --image=alpine --repository=foo recipe.rb
# -> created image: repository=foo tag=latest

Copy link
Contributor

@umisora umisora left a comment

Choose a reason for hiding this comment

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

+1

@ryotarai
Copy link
Member

itamae docker --image=alpine --tag=repo:v2 recipe.rb

How about tag option including both repo and tag?

@mystelynx
Copy link
Contributor Author

I tried (92db97b)...but it is difficult to support private docker registry.
https://docs.docker.com/engine/reference/commandline/tag/

itamae docker --image=alpine --tag=your-private-repo:5000/foo:v1 recipe.rb

I think this implementation is the simplest, but it is too bother for users. I'll try to fix. thank you!

@@ -269,6 +269,15 @@ def disable_sudo?
class Docker < Base
def finalize
image = @backend.commit_container
if @options[:tag]
Copy link
Contributor Author

Choose a reason for hiding this comment

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

it's a bit difficult to understand. any ideas?

@@ -269,6 +269,15 @@ def disable_sudo?
class Docker < Base
def finalize
image = @backend.commit_container
if @options[:tag]
opt = @options[:tag].split(':')
if opt.size > 2
Copy link
Member

Choose a reason for hiding this comment

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

You can use regexp.

[12] pry(main)> /\A(.+?)(|:([^:]+))\z/.match('a')
=> #<MatchData "a" 1:"a" 2:"" 3:nil>
[13] pry(main)> /\A(.+?)(|:([^:]+))\z/.match('a:b')
=> #<MatchData "a:b" 1:"a" 2:":b" 3:"b">
[14] pry(main)> /\A(.+?)(|:([^:]+))\z/.match('a:b:c')
=> #<MatchData "a:b:c" 1:"a:b" 2:":c" 3:"c">

@mystelynx
Copy link
Contributor Author

@ryotarai fixed. please review that.

@ryotarai
Copy link
Member

ryotarai commented Dec 28, 2016

Thank you!

@ryotarai ryotarai merged commit aae0af7 into itamae-kitchen:master Dec 28, 2016
@ryotarai
Copy link
Member

ryotarai commented Mar 8, 2017

released in v1.9.11

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants