From b91ed54cc96fa870043759322e6e064605677941 Mon Sep 17 00:00:00 2001 From: Yevgeniy Brikman Date: Thu, 23 Feb 2017 14:30:32 +0000 Subject: [PATCH] Add support for running a specific Packer build --- packer/packer.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/packer/packer.go b/packer/packer.go index a859c18c3..3e4151e84 100644 --- a/packer/packer.go +++ b/packer/packer.go @@ -8,8 +8,9 @@ import ( ) type PackerOptions struct { - Template string // The path to the Packer template + Template string // The path to the Packer template Vars map[string]string // The custom vars to pass when running the build command + Only string // If specified, only run the build of this name } // Build the given Packer template and return the generated AMI ID @@ -52,5 +53,10 @@ func formatPackerArgs(options PackerOptions) []string { args = append(args, "-var", key + "=" + value) } + if options.Only != "" { + args = append(args, "-only=" + options.Only) + } + return append(args, options.Template) -} \ No newline at end of file +} +