Hi,
I have a custom Builder running, and it's working, if I use the Builders section only.
If I add the provisioners section, the scripts in the provisioners section doesn't run.
Any idea why this is, and how to get the provisioners section to work?
The scripts are meant to be run on Linux.
Initially, my custom Builder doesn't have any Provisioner or PostProcessor built-in.
However, operating under the assumption that perhaps Packer is looking into loading Provisioner and PostProcessor from my plugin, I tried using the Provisioner and PostProcessor code from Packer, by exporting it into my namespace. So plugin.cmdProvisioner became myplugin.Provisioner, and plugin.cmdPostProcessor became myplugin.PostProcessor.
Here's my main routine (which is for my custom Builder) before adding provisioner and postprocessor:
func main() {
server, err := plugin.Server()
if err != nil {
panic(err)
}
server.RegisterBuilder(new(myplugin.Builder))
server.Serve()
}
The above works, and my Builder can build images successfully
Here's my routine (still inside my own Builder) after adding provisioner and postprocessor:
func main() {
server, err := plugin.Server()
if err != nil {
panic(err)
}
server.RegisterBuilder(new(myplugin.Builder))
server.RegisterProvisioner(new(myplugin.Provisioner))
server.RegisterPostProcessor(new(myplugin.PostProcessor))
server.Serve()
}
Here's my configuration file:
{
"min_packer_version": "0.12.0",
"builders": [{
... // omitted as this part is working ///
}],
"provisioners": [
{
"type": "shell-local",
"command": "echo Hello World > /home/chuacw/successful.txt"
}
],
"post-processors": [{
"type": "manifest",
"output": "manifests/test-node.json",
"strip_path": true
}]
}