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
73c5192b
Commit
73c5192b
authored
Dec 01, 2014
by
Mitchell Hashimoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
command/push: add base_dir setting
parent
f76116e4
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
5 deletions
+22
-5
command/push.go
command/push.go
+21
-4
packer/template.go
packer/template.go
+1
-1
No files found.
command/push.go
View file @
73c5192b
...
...
@@ -86,15 +86,32 @@ func (c *PushCommand) Run(args []string) int {
archiveTemplateEntry
:
args
[
0
],
}
// Determine the path we're archiving
// Determine the path we're archiving. This logic is a bit complicated
// as there are three possibilities:
//
// 1.) BaseDir is an absolute path, just use that.
//
// 2.) BaseDir is empty, so we use the directory of the template.
//
// 3.) BaseDir is relative, so we use the path relative to the directory
// of the template.
//
path
:=
tpl
.
Push
.
BaseDir
if
path
==
""
{
path
,
err
=
filepath
.
Abs
(
args
[
0
])
if
path
==
""
||
!
filepath
.
IsAbs
(
path
)
{
tplPath
,
err
:=
filepath
.
Abs
(
args
[
0
])
if
err
!=
nil
{
c
.
Ui
.
Error
(
fmt
.
Sprintf
(
"Error determining path to archive: %s"
,
err
))
return
1
}
tplPath
=
filepath
.
Dir
(
tplPath
)
if
path
!=
""
{
tplPath
=
filepath
.
Join
(
tplPath
,
path
)
}
path
,
err
=
filepath
.
Abs
(
tplPath
)
if
err
!=
nil
{
c
.
Ui
.
Error
(
fmt
.
Sprintf
(
"Error determining path to archive: %s"
,
err
))
return
1
}
path
=
filepath
.
Dir
(
path
)
}
// Build the upload options
...
...
packer/template.go
View file @
73c5192b
...
...
@@ -46,7 +46,7 @@ type Template struct {
type
PushConfig
struct
{
Name
string
Address
string
BaseDir
string
BaseDir
string
`mapstructure:"base_dir"`
Include
[]
string
Exclude
[]
string
Token
string
...
...
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