Skip to content

Instantly share code, notes, and snippets.

@paulmey
Last active July 17, 2019 03:59
Show Gist options
  • Save paulmey/d634c61d7b5fb698b08b5cdb2f9cf713 to your computer and use it in GitHub Desktop.
Save paulmey/d634c61d7b5fb698b08b5cdb2f9cf713 to your computer and use it in GitHub Desktop.
This program demonstrates that Packer hangs when long lines need to be logged.
  1. go build -o packer-builder-bug
  2. PACKER_LOG=1 ./packer build test.json
package main
import (
"context"
"log"
"strings"
"time"
"github.com/hashicorp/packer/packer"
"github.com/hashicorp/packer/packer/plugin"
)
func main() {
server, err := plugin.Server()
if err != nil {
panic(err)
}
server.RegisterBuilder(new(testBuilder))
server.Serve()
}
type testBuilder struct{}
func (*testBuilder) Prepare(...interface{}) ([]string, error) { return nil, nil }
func (*testBuilder) Run(context.Context, packer.Ui, packer.Hook) (packer.Artifact, error) {
time.Sleep(time.Second)
log.Print(strings.Repeat("Logging test - ", 10000))
time.Sleep(time.Second)
return nil, nil
}
{
"builders":[
{"type": "bug"}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment