Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
packer
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kristopher Ruzic
packer
Commits
56d22ac9
Commit
56d22ac9
authored
Sep 05, 2014
by
Mitchell Hashimoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
post-processor/docker-push: can login [GH-1243]
parent
d32b4b4f
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
60 additions
and
3 deletions
+60
-3
CHANGELOG.md
CHANGELOG.md
+1
-0
Vagrantfile
Vagrantfile
+3
-1
post-processor/docker-push/post-processor.go
post-processor/docker-push/post-processor.go
+44
-0
website/source/docs/post-processors/docker-push.html.markdown
...ite/source/docs/post-processors/docker-push.html.markdown
+12
-2
No files found.
CHANGELOG.md
View file @
56d22ac9
...
@@ -23,6 +23,7 @@ FEATURES:
...
@@ -23,6 +23,7 @@ FEATURES:
*
builder/vmware: VMware Player 6 is now supported. [GH-1168]
*
builder/vmware: VMware Player 6 is now supported. [GH-1168]
*
builder/vmware-vmx: Boot commands and the HTTP server are supported.
*
builder/vmware-vmx: Boot commands and the HTTP server are supported.
[GH-1169]
[GH-1169]
*
post-processor/docker-push: Can now specify login credentials. [GH-1243]
IMPROVEMENTS:
IMPROVEMENTS:
...
...
Vagrantfile
View file @
56d22ac9
...
@@ -32,10 +32,12 @@ sudo apt-get install -y curl git-core zip
...
@@ -32,10 +32,12 @@ sudo apt-get install -y curl git-core zip
SCRIPT
SCRIPT
Vagrant
.
configure
(
VAGRANTFILE_API_VERSION
)
do
|
config
|
Vagrant
.
configure
(
VAGRANTFILE_API_VERSION
)
do
|
config
|
config
.
vm
.
box
=
"chef/ubuntu-1
4
.04"
config
.
vm
.
box
=
"chef/ubuntu-1
2
.04"
config
.
vm
.
provision
"shell"
,
inline:
$script
config
.
vm
.
provision
"shell"
,
inline:
$script
config
.
vm
.
synced_folder
"."
,
"/vagrant"
,
disabled:
true
[
"vmware_fusion"
,
"vmware_workstation"
].
each
do
|
p
|
[
"vmware_fusion"
,
"vmware_workstation"
].
each
do
|
p
|
config
.
vm
.
provider
"p"
do
|
v
|
config
.
vm
.
provider
"p"
do
|
v
|
v
.
vmx
[
"memsize"
]
=
"2048"
v
.
vmx
[
"memsize"
]
=
"2048"
...
...
post-processor/docker-push/post-processor.go
View file @
56d22ac9
...
@@ -12,6 +12,12 @@ import (
...
@@ -12,6 +12,12 @@ import (
type
Config
struct
{
type
Config
struct
{
common
.
PackerConfig
`mapstructure:",squash"`
common
.
PackerConfig
`mapstructure:",squash"`
Login
bool
LoginEmail
string
`mapstructure:"login_email"`
LoginUsername
string
`mapstructure:"login_username"`
LoginPassword
string
`mapstructure:"login_password"`
LoginServer
string
`mapstructure:"login_server"`
tpl
*
packer
.
ConfigTemplate
tpl
*
packer
.
ConfigTemplate
}
}
...
@@ -35,6 +41,24 @@ func (p *PostProcessor) Configure(raws ...interface{}) error {
...
@@ -35,6 +41,24 @@ func (p *PostProcessor) Configure(raws ...interface{}) error {
// Accumulate any errors
// Accumulate any errors
errs
:=
new
(
packer
.
MultiError
)
errs
:=
new
(
packer
.
MultiError
)
// Process templates
templates
:=
map
[
string
]
*
string
{
"login_email"
:
&
p
.
config
.
LoginEmail
,
"login_username"
:
&
p
.
config
.
LoginUsername
,
"login_password"
:
&
p
.
config
.
LoginPassword
,
"login_server"
:
&
p
.
config
.
LoginServer
,
}
for
n
,
ptr
:=
range
templates
{
var
err
error
*
ptr
,
err
=
p
.
config
.
tpl
.
Process
(
*
ptr
,
nil
)
if
err
!=
nil
{
errs
=
packer
.
MultiErrorAppend
(
errs
,
fmt
.
Errorf
(
"Error processing %s: %s"
,
n
,
err
))
}
}
if
len
(
errs
.
Errors
)
>
0
{
if
len
(
errs
.
Errors
)
>
0
{
return
errs
return
errs
}
}
...
@@ -56,6 +80,26 @@ func (p *PostProcessor) PostProcess(ui packer.Ui, artifact packer.Artifact) (pac
...
@@ -56,6 +80,26 @@ func (p *PostProcessor) PostProcess(ui packer.Ui, artifact packer.Artifact) (pac
driver
=
&
docker
.
DockerDriver
{
Tpl
:
p
.
config
.
tpl
,
Ui
:
ui
}
driver
=
&
docker
.
DockerDriver
{
Tpl
:
p
.
config
.
tpl
,
Ui
:
ui
}
}
}
if
p
.
config
.
Login
{
ui
.
Message
(
"Logging in..."
)
err
:=
driver
.
Login
(
p
.
config
.
LoginServer
,
p
.
config
.
LoginEmail
,
p
.
config
.
LoginUsername
,
p
.
config
.
LoginPassword
)
if
err
!=
nil
{
return
nil
,
false
,
fmt
.
Errorf
(
"Error logging in to Docker: %s"
,
err
)
}
defer
func
()
{
ui
.
Message
(
"Logging out..."
)
if
err
:=
driver
.
Logout
(
p
.
config
.
LoginServer
);
err
!=
nil
{
ui
.
Error
(
fmt
.
Sprintf
(
"Error logging out: %s"
,
err
))
}
}()
}
// Get the name. We strip off any tags from the name because the
// Get the name. We strip off any tags from the name because the
// push doesn't use those.
// push doesn't use those.
name
:=
artifact
.
Id
()
name
:=
artifact
.
Id
()
...
...
website/source/docs/post-processors/docker-push.html.markdown
View file @
56d22ac9
...
@@ -19,8 +19,18 @@ for you, but for now you must manually do this.
...
@@ -19,8 +19,18 @@ for you, but for now you must manually do this.
## Configuration
## Configuration
This post-processor has no configuration! Simply add it to your chain
This post-processor has only optional configuration:
of post-processors and the image will be uploaded.
*
`login`
(boolean) - Defaults to false. If true, the post-processor will
login prior to pushing.
*
`login_email`
(string) - The email to use to authenticate to login.
*
`login_username`
(string) - The username to use to authenticate to login.
*
`login_password`
(string) - The password to use to authenticate to login.
*
`login_server`
(string) - The server address to login to.
## Example
## Example
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment