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
75fe58d5
Commit
75fe58d5
authored
Jun 18, 2013
by
Mitchell Hashimoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
packer: Post-processors are configured
parent
21869295
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
31 additions
and
3 deletions
+31
-3
packer/build.go
packer/build.go
+9
-0
packer/build_test.go
packer/build_test.go
+10
-0
packer/post_processor_test.go
packer/post_processor_test.go
+12
-3
No files found.
packer/build.go
View file @
75fe58d5
...
...
@@ -109,6 +109,15 @@ func (b *coreBuild) Prepare() (err error) {
}
}
// Prepare the post-processors
for
_
,
ppSeq
:=
range
b
.
postProcessors
{
for
_
,
corePP
:=
range
ppSeq
{
if
err
=
corePP
.
processor
.
Configure
(
corePP
.
config
);
err
!=
nil
{
return
}
}
}
return
}
...
...
packer/build_test.go
View file @
75fe58d5
...
...
@@ -16,6 +16,11 @@ func testBuild() Build {
provisioners
:
[]
coreBuildProvisioner
{
coreBuildProvisioner
{
&
TestProvisioner
{},
[]
interface
{}{
42
}},
},
postProcessors
:
[][]
coreBuildPostProcessor
{
[]
coreBuildPostProcessor
{
coreBuildPostProcessor
{
&
TestPostProcessor
{},
42
},
},
},
}
}
...
...
@@ -47,6 +52,11 @@ func TestBuild_Prepare(t *testing.T) {
prov
:=
coreProv
.
provisioner
.
(
*
TestProvisioner
)
assert
.
True
(
prov
.
prepCalled
,
"prepare should be called"
)
assert
.
Equal
(
prov
.
prepConfigs
,
[]
interface
{}{
42
,
debugFalseConfig
},
"prepare should be called with proper config"
)
corePP
:=
coreB
.
postProcessors
[
0
][
0
]
pp
:=
corePP
.
processor
.
(
*
TestPostProcessor
)
assert
.
True
(
pp
.
configCalled
,
"config should be called"
)
assert
.
Equal
(
pp
.
configVal
,
42
,
"config should have right value"
)
}
func
TestBuild_Prepare_Twice
(
t
*
testing
.
T
)
{
...
...
packer/post_processor_test.go
View file @
75fe58d5
package
packer
type
TestPostProcessor
struct
{}
type
TestPostProcessor
struct
{
configCalled
bool
configVal
interface
{}
ppCalled
bool
ppArtifact
Artifact
}
func
(
*
TestPostProcessor
)
Configure
(
interface
{})
error
{
func
(
pp
*
TestPostProcessor
)
Configure
(
v
interface
{})
error
{
pp
.
configCalled
=
true
pp
.
configVal
=
v
return
nil
}
func
(
*
TestPostProcessor
)
PostProcess
(
Artifact
)
(
Artifact
,
error
)
{
func
(
pp
*
TestPostProcessor
)
PostProcess
(
a
Artifact
)
(
Artifact
,
error
)
{
pp
.
ppCalled
=
true
pp
.
ppArtifact
=
a
return
nil
,
nil
}
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