From 06941a86a34938622fca73f0ddb9bafdc5b79d94 Mon Sep 17 00:00:00 2001 From: Adrien Delorme Date: Mon, 8 Apr 2019 13:40:02 +0200 Subject: [PATCH] make the file builder run provisioners for testing purposes --- builder/file/builder.go | 6 ++++++ website/source/docs/builders/file.html.md | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/builder/file/builder.go b/builder/file/builder.go index 3ac6e05a8..f4e95c194 100644 --- a/builder/file/builder.go +++ b/builder/file/builder.go @@ -68,5 +68,11 @@ func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (pack artifact.filename = b.config.Target } + if hook != nil { + if err := hook.Run(ctx, packer.HookProvision, ui, new(packer.MockCommunicator), nil); err != nil { + return nil, err + } + } + return artifact, nil } diff --git a/website/source/docs/builders/file.html.md b/website/source/docs/builders/file.html.md index e6daed3d4..7a84fc3f3 100644 --- a/website/source/docs/builders/file.html.md +++ b/website/source/docs/builders/file.html.md @@ -2,7 +2,7 @@ description: | The file Packer builder is not really a builder, it just creates an artifact from a file. It can be used to debug post-processors without incurring high - wait times. It does not run any provisioners. + wait times. layout: docs page_title: 'File - Builders' sidebar_current: 'docs-builders-file' @@ -14,7 +14,7 @@ Type: `file` The `file` Packer builder is not really a builder, it just creates an artifact from a file. It can be used to debug post-processors without incurring high -wait times. It does not run any provisioners. +wait times. ## Basic Example