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
1b78fc88
Commit
1b78fc88
authored
May 23, 2013
by
Mitchell Hashimoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
packer: coreBuild runs provisioners as part of Run
parent
83eab87c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
0 deletions
+19
-0
packer/build.go
packer/build.go
+14
-0
packer/build_test.go
packer/build_test.go
+5
-0
No files found.
packer/build.go
View file @
1b78fc88
...
...
@@ -70,6 +70,20 @@ func (b *coreBuild) Run(ui Ui) Artifact {
copy
(
hooks
[
hookName
],
hookList
)
}
// Add a hook for the provisioners if we have provisioners
if
len
(
b
.
provisioners
)
>
0
{
provisioners
:=
make
([]
Provisioner
,
len
(
b
.
provisioners
))
for
i
,
p
:=
range
b
.
provisioners
{
provisioners
[
i
]
=
p
.
provisioner
}
if
_
,
ok
:=
hooks
[
HookProvision
];
!
ok
{
hooks
[
HookProvision
]
=
make
([]
Hook
,
0
,
1
)
}
hooks
[
HookProvision
]
=
append
(
hooks
[
HookProvision
],
&
ProvisionHook
{
provisioners
})
}
hook
:=
&
DispatchHook
{
hooks
}
return
b
.
builder
.
Run
(
ui
,
hook
)
}
packer/build_test.go
View file @
1b78fc88
...
...
@@ -74,6 +74,11 @@ func TestBuild_Run(t *testing.T) {
hook
:=
coreB
.
hooks
[
"foo"
][
0
]
.
(
*
TestHook
)
assert
.
True
(
hook
.
runCalled
,
"run should be called"
)
assert
.
Equal
(
hook
.
runData
,
42
,
"should have correct data"
)
// Verify provisioners run
dispatchHook
.
Run
(
HookProvision
,
nil
,
nil
,
42
)
prov
:=
coreB
.
provisioners
[
0
]
.
provisioner
.
(
*
TestProvisioner
)
assert
.
True
(
prov
.
provCalled
,
"provision should be called"
)
}
func
TestBuild_RunBeforePrepare
(
t
*
testing
.
T
)
{
...
...
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