diff --git a/post-processor/vagrant-cloud/post-processor.go b/post-processor/vagrant-cloud/post-processor.go index a655819f0..8a7f53ebc 100644 --- a/post-processor/vagrant-cloud/post-processor.go +++ b/post-processor/vagrant-cloud/post-processor.go @@ -17,8 +17,10 @@ const VAGRANT_CLOUD_URL = "https://vagrantcloud.com/api/v1" type Config struct { common.PackerConfig `mapstructure:",squash"` - Tag string `mapstructure:"box_tag"` - Version string `mapstructure:"version"` + Tag string `mapstructure:"box_tag"` + Version string `mapstructure:"version"` + VersionDescription string `mapstructure:"version_description"` + NoRelease bool `mapstructure:"no_release"` AccessToken string `mapstructure:"access_token"` VagrantCloudUrl string `mapstructure:"vagrant_cloud_url"` diff --git a/post-processor/vagrant-cloud/step_create_version.go b/post-processor/vagrant-cloud/step_create_version.go index 211604875..882a5971d 100644 --- a/post-processor/vagrant-cloud/step_create_version.go +++ b/post-processor/vagrant-cloud/step_create_version.go @@ -8,7 +8,8 @@ import ( type Version struct { Version string `json:"version"` - Number uint `json:"number,omitempty"` + Description string `json:"description,omitempty"` + Number uint `json:"number,omitempty"` } type stepCreateVersion struct { @@ -29,7 +30,7 @@ func (s *stepCreateVersion) Run(state multistep.StateBag) multistep.StepAction { path := fmt.Sprintf("box/%s/versions", box.Tag) - version := &Version{Version: config.Version} + version := &Version{Version: config.Version, Description: config.VersionDescription} // Wrap the version in a version object for the API wrapper := make(map[string]interface{}) diff --git a/post-processor/vagrant-cloud/step_release_version.go b/post-processor/vagrant-cloud/step_release_version.go index 0065c6100..4e40f5ca3 100644 --- a/post-processor/vagrant-cloud/step_release_version.go +++ b/post-processor/vagrant-cloud/step_release_version.go @@ -14,6 +14,12 @@ func (s *stepReleaseVersion) Run(state multistep.StateBag) multistep.StepAction ui := state.Get("ui").(packer.Ui) box := state.Get("box").(*Box) version := state.Get("version").(*Version) + config := state.Get("config").(Config) + + if config.NoRelease { + ui.Say(fmt.Sprintf("Not releasing version due to configuration: %s", version.Version)) + return multistep.ActionContinue + } path := fmt.Sprintf("box/%s/version/%v/release", box.Tag, version.Number)