version files
This commit is contained in:
parent
8ecd16db81
commit
3db40194af
|
@ -5,7 +5,9 @@ import (
|
|||
packerVersion "github.com/hashicorp/packer/version"
|
||||
)
|
||||
|
||||
var AlicloudPluginVersion = version.PluginVersion{
|
||||
Version: packerVersion.Version,
|
||||
VersionPrerelease: packerVersion.VersionPrerelease,
|
||||
var AlicloudPluginVersion *version.PluginVersion
|
||||
|
||||
func init() {
|
||||
AlicloudPluginVersion = version.InitializePluginVersion(
|
||||
packerVersion.Version, packerVersion.VersionPrerelease)
|
||||
}
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
package version
|
||||
|
||||
import (
|
||||
"github.com/hashicorp/packer/helper/version"
|
||||
packerVersion "github.com/hashicorp/packer/version"
|
||||
)
|
||||
|
||||
var AWSPluginVersion *version.PluginVersion
|
||||
|
||||
func init() {
|
||||
AWSPluginVersion = version.InitializePluginVersion(
|
||||
packerVersion.Version, packerVersion.VersionPrerelease)
|
||||
}
|
|
@ -5,7 +5,9 @@ import (
|
|||
packerVersion "github.com/hashicorp/packer/version"
|
||||
)
|
||||
|
||||
var AzurePluginVersion = version.PluginVersion{
|
||||
Version: packerVersion.Version,
|
||||
VersionPrerelease: packerVersion.VersionPrerelease,
|
||||
var AzurePluginVersion *version.PluginVersion
|
||||
|
||||
func init() {
|
||||
AzurePluginVersion = version.InitializePluginVersion(
|
||||
packerVersion.Version, packerVersion.VersionPrerelease)
|
||||
}
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
package version
|
||||
|
||||
import (
|
||||
"github.com/hashicorp/packer/helper/version"
|
||||
packerVersion "github.com/hashicorp/packer/version"
|
||||
)
|
||||
|
||||
var CloudstackPluginVersion *version.PluginVersion
|
||||
|
||||
func init() {
|
||||
CloudstackPluginVersion = version.InitializePluginVersion(
|
||||
packerVersion.Version, packerVersion.VersionPrerelease)
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
package version
|
||||
|
||||
import (
|
||||
"github.com/hashicorp/packer/helper/version"
|
||||
packerVersion "github.com/hashicorp/packer/version"
|
||||
)
|
||||
|
||||
var DockerPluginVersion *version.PluginVersion
|
||||
|
||||
func init() {
|
||||
DockerPluginVersion = version.InitializePluginVersion(
|
||||
packerVersion.Version, packerVersion.VersionPrerelease)
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
package version
|
||||
|
||||
import (
|
||||
"github.com/hashicorp/packer/helper/version"
|
||||
packerVersion "github.com/hashicorp/packer/version"
|
||||
)
|
||||
|
||||
var DigitalOceanPluginVersion *version.PluginVersion
|
||||
|
||||
func init() {
|
||||
DigitalOceanPluginVersion = version.InitializePluginVersion(
|
||||
packerVersion.Version, packerVersion.VersionPrerelease)
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
package version
|
||||
|
||||
import (
|
||||
"github.com/hashicorp/packer/helper/version"
|
||||
packerVersion "github.com/hashicorp/packer/version"
|
||||
)
|
||||
|
||||
var FilePluginVersion *version.PluginVersion
|
||||
|
||||
func init() {
|
||||
FilePluginVersion = version.InitializePluginVersion(
|
||||
packerVersion.Version, packerVersion.VersionPrerelease)
|
||||
}
|
|
@ -5,7 +5,9 @@ import (
|
|||
packerVersion "github.com/hashicorp/packer/version"
|
||||
)
|
||||
|
||||
var GCEPluginVersion = version.PluginVersion{
|
||||
Version: packerVersion.Version,
|
||||
VersionPrerelease: packerVersion.VersionPrerelease,
|
||||
var GCEPluginVersion *version.PluginVersion
|
||||
|
||||
func init() {
|
||||
GCEPluginVersion = version.InitializePluginVersion(
|
||||
packerVersion.Version, packerVersion.VersionPrerelease)
|
||||
}
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
package version
|
||||
|
||||
import (
|
||||
"github.com/hashicorp/packer/helper/version"
|
||||
packerVersion "github.com/hashicorp/packer/version"
|
||||
)
|
||||
|
||||
var HcloudPluginVersion *version.PluginVersion
|
||||
|
||||
func init() {
|
||||
HcloudPluginVersion = version.InitializePluginVersion(
|
||||
packerVersion.Version, packerVersion.VersionPrerelease)
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
package version
|
||||
|
||||
import (
|
||||
"github.com/hashicorp/packer/helper/version"
|
||||
packerVersion "github.com/hashicorp/packer/version"
|
||||
)
|
||||
|
||||
var HyperonePluginVersion *version.PluginVersion
|
||||
|
||||
func init() {
|
||||
HyperonePluginVersion = version.InitializePluginVersion(
|
||||
packerVersion.Version, packerVersion.VersionPrerelease)
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
package version
|
||||
|
||||
import (
|
||||
"github.com/hashicorp/packer/helper/version"
|
||||
packerVersion "github.com/hashicorp/packer/version"
|
||||
)
|
||||
|
||||
var HypervPluginVersion *version.PluginVersion
|
||||
|
||||
func init() {
|
||||
HypervPluginVersion = version.InitializePluginVersion(
|
||||
packerVersion.Version, packerVersion.VersionPrerelease)
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
package version
|
||||
|
||||
import (
|
||||
"github.com/hashicorp/packer/helper/version"
|
||||
packerVersion "github.com/hashicorp/packer/version"
|
||||
)
|
||||
|
||||
var JDCloudPluginVersion *version.PluginVersion
|
||||
|
||||
func init() {
|
||||
JDCloudPluginVersion = version.InitializePluginVersion(
|
||||
packerVersion.Version, packerVersion.VersionPrerelease)
|
||||
}
|
|
@ -5,7 +5,9 @@ import (
|
|||
packerVersion "github.com/hashicorp/packer/version"
|
||||
)
|
||||
|
||||
var LinodePluginVersion = version.PluginVersion{
|
||||
Version: packerVersion.Version,
|
||||
VersionPrerelease: packerVersion.VersionPrerelease,
|
||||
var LinodePluginVersion *version.PluginVersion
|
||||
|
||||
func init() {
|
||||
LinodePluginVersion = version.InitializePluginVersion(
|
||||
packerVersion.Version, packerVersion.VersionPrerelease)
|
||||
}
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
package version
|
||||
|
||||
import (
|
||||
"github.com/hashicorp/packer/helper/version"
|
||||
packerVersion "github.com/hashicorp/packer/version"
|
||||
)
|
||||
|
||||
var LXCPluginVersion *version.PluginVersion
|
||||
|
||||
func init() {
|
||||
LXCPluginVersion = version.InitializePluginVersion(
|
||||
packerVersion.Version, packerVersion.VersionPrerelease)
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
package version
|
||||
|
||||
import (
|
||||
"github.com/hashicorp/packer/helper/version"
|
||||
packerVersion "github.com/hashicorp/packer/version"
|
||||
)
|
||||
|
||||
var LXDPluginVersion *version.PluginVersion
|
||||
|
||||
func init() {
|
||||
LXDPluginVersion = version.InitializePluginVersion(
|
||||
packerVersion.Version, packerVersion.VersionPrerelease)
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
package version
|
||||
|
||||
import (
|
||||
"github.com/hashicorp/packer/helper/version"
|
||||
packerVersion "github.com/hashicorp/packer/version"
|
||||
)
|
||||
|
||||
var NCloudPluginVersion *version.PluginVersion
|
||||
|
||||
func init() {
|
||||
NCloudPluginVersion = version.InitializePluginVersion(
|
||||
packerVersion.Version, packerVersion.VersionPrerelease)
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
package version
|
||||
|
||||
import (
|
||||
"github.com/hashicorp/packer/helper/version"
|
||||
packerVersion "github.com/hashicorp/packer/version"
|
||||
)
|
||||
|
||||
var NullPluginVersion *version.PluginVersion
|
||||
|
||||
func init() {
|
||||
NullPluginVersion = version.InitializePluginVersion(
|
||||
packerVersion.Version, packerVersion.VersionPrerelease)
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
package version
|
||||
|
||||
import (
|
||||
"github.com/hashicorp/packer/helper/version"
|
||||
packerVersion "github.com/hashicorp/packer/version"
|
||||
)
|
||||
|
||||
var OneAndOnePluginVersion *version.PluginVersion
|
||||
|
||||
func init() {
|
||||
OneAndOnePluginVersion = version.InitializePluginVersion(
|
||||
packerVersion.Version, packerVersion.VersionPrerelease)
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
package version
|
||||
|
||||
import (
|
||||
"github.com/hashicorp/packer/helper/version"
|
||||
packerVersion "github.com/hashicorp/packer/version"
|
||||
)
|
||||
|
||||
var OpenstackPluginVersion *version.PluginVersion
|
||||
|
||||
func init() {
|
||||
OpenstackPluginVersion = version.InitializePluginVersion(
|
||||
packerVersion.Version, packerVersion.VersionPrerelease)
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
package version
|
||||
|
||||
import (
|
||||
"github.com/hashicorp/packer/helper/version"
|
||||
packerVersion "github.com/hashicorp/packer/version"
|
||||
)
|
||||
|
||||
var OraclePluginVersion *version.PluginVersion
|
||||
|
||||
func init() {
|
||||
OraclePluginVersion = version.InitializePluginVersion(
|
||||
packerVersion.Version, packerVersion.VersionPrerelease)
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
package version
|
||||
|
||||
import (
|
||||
"github.com/hashicorp/packer/helper/version"
|
||||
packerVersion "github.com/hashicorp/packer/version"
|
||||
)
|
||||
|
||||
var OutscalePluginVersion *version.PluginVersion
|
||||
|
||||
func init() {
|
||||
OutscalePluginVersion = version.InitializePluginVersion(
|
||||
packerVersion.Version, packerVersion.VersionPrerelease)
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
package version
|
||||
|
||||
import (
|
||||
"github.com/hashicorp/packer/helper/version"
|
||||
packerVersion "github.com/hashicorp/packer/version"
|
||||
)
|
||||
|
||||
var ParallelsPluginVersion *version.PluginVersion
|
||||
|
||||
func init() {
|
||||
ParallelsPluginVersion = version.InitializePluginVersion(
|
||||
packerVersion.Version, packerVersion.VersionPrerelease)
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
package version
|
||||
|
||||
import (
|
||||
"github.com/hashicorp/packer/helper/version"
|
||||
packerVersion "github.com/hashicorp/packer/version"
|
||||
)
|
||||
|
||||
var ProfitbricksPluginVersion *version.PluginVersion
|
||||
|
||||
func init() {
|
||||
ProfitbricksPluginVersion = version.InitializePluginVersion(
|
||||
packerVersion.Version, packerVersion.VersionPrerelease)
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
package version
|
||||
|
||||
import (
|
||||
"github.com/hashicorp/packer/helper/version"
|
||||
packerVersion "github.com/hashicorp/packer/version"
|
||||
)
|
||||
|
||||
var ProxmoxPluginVersion *version.PluginVersion
|
||||
|
||||
func init() {
|
||||
ProxmoxPluginVersion = version.InitializePluginVersion(
|
||||
packerVersion.Version, packerVersion.VersionPrerelease)
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
package version
|
||||
|
||||
import (
|
||||
"github.com/hashicorp/packer/helper/version"
|
||||
packerVersion "github.com/hashicorp/packer/version"
|
||||
)
|
||||
|
||||
var QemuPluginVersion *version.PluginVersion
|
||||
|
||||
func init() {
|
||||
QemuPluginVersion = version.InitializePluginVersion(
|
||||
packerVersion.Version, packerVersion.VersionPrerelease)
|
||||
}
|
|
@ -5,7 +5,9 @@ import (
|
|||
packerVersion "github.com/hashicorp/packer/version"
|
||||
)
|
||||
|
||||
var ScalewayPluginVersion = version.PluginVersion{
|
||||
Version: packerVersion.Version,
|
||||
VersionPrerelease: packerVersion.VersionPrerelease,
|
||||
var ScalewayPluginVersion *version.PluginVersion
|
||||
|
||||
func init() {
|
||||
ScalewayPluginVersion = version.InitializePluginVersion(
|
||||
packerVersion.Version, packerVersion.VersionPrerelease)
|
||||
}
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
package version
|
||||
|
||||
import (
|
||||
"github.com/hashicorp/packer/helper/version"
|
||||
packerVersion "github.com/hashicorp/packer/version"
|
||||
)
|
||||
|
||||
var TencentPluginVersion *version.PluginVersion
|
||||
|
||||
func init() {
|
||||
TencentPluginVersion = version.InitializePluginVersion(
|
||||
packerVersion.Version, packerVersion.VersionPrerelease)
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
package version
|
||||
|
||||
import (
|
||||
"github.com/hashicorp/packer/helper/version"
|
||||
packerVersion "github.com/hashicorp/packer/version"
|
||||
)
|
||||
|
||||
var TritonPluginVersion *version.PluginVersion
|
||||
|
||||
func init() {
|
||||
TritonPluginVersion = version.InitializePluginVersion(
|
||||
packerVersion.Version, packerVersion.VersionPrerelease)
|
||||
}
|
|
@ -5,7 +5,9 @@ import (
|
|||
packerVersion "github.com/hashicorp/packer/version"
|
||||
)
|
||||
|
||||
var UcloudPluginVersion = version.PluginVersion{
|
||||
Version: packerVersion.Version,
|
||||
VersionPrerelease: packerVersion.VersionPrerelease,
|
||||
var UcloudPluginVersion *version.PluginVersion
|
||||
|
||||
func init() {
|
||||
UcloudPluginVersion = version.InitializePluginVersion(
|
||||
packerVersion.Version, packerVersion.VersionPrerelease)
|
||||
}
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
package version
|
||||
|
||||
import (
|
||||
"github.com/hashicorp/packer/helper/version"
|
||||
packerVersion "github.com/hashicorp/packer/version"
|
||||
)
|
||||
|
||||
var VagrantPluginVersion *version.PluginVersion
|
||||
|
||||
func init() {
|
||||
VagrantPluginVersion = version.InitializePluginVersion(
|
||||
packerVersion.Version, packerVersion.VersionPrerelease)
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
package version
|
||||
|
||||
import (
|
||||
"github.com/hashicorp/packer/helper/version"
|
||||
packerVersion "github.com/hashicorp/packer/version"
|
||||
)
|
||||
|
||||
var VirtualboxPluginVersion *version.PluginVersion
|
||||
|
||||
func init() {
|
||||
VirtualboxPluginVersion = version.InitializePluginVersion(
|
||||
packerVersion.Version, packerVersion.VersionPrerelease)
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
package version
|
||||
|
||||
import (
|
||||
"github.com/hashicorp/packer/helper/version"
|
||||
packerVersion "github.com/hashicorp/packer/version"
|
||||
)
|
||||
|
||||
var VMwarePluginVersion *version.PluginVersion
|
||||
|
||||
func init() {
|
||||
VMwarePluginVersion = version.InitializePluginVersion(
|
||||
packerVersion.Version, packerVersion.VersionPrerelease)
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
package version
|
||||
|
||||
import (
|
||||
"github.com/hashicorp/packer/helper/version"
|
||||
packerVersion "github.com/hashicorp/packer/version"
|
||||
)
|
||||
|
||||
var VSpherePluginVersion *version.PluginVersion
|
||||
|
||||
func init() {
|
||||
VSpherePluginVersion = version.InitializePluginVersion(
|
||||
packerVersion.Version, packerVersion.VersionPrerelease)
|
||||
}
|
|
@ -5,7 +5,9 @@ import (
|
|||
packerVersion "github.com/hashicorp/packer/version"
|
||||
)
|
||||
|
||||
var YandexPluginVersion = version.PluginVersion{
|
||||
Version: packerVersion.Version,
|
||||
VersionPrerelease: packerVersion.VersionPrerelease,
|
||||
var YandexPluginVersion *version.PluginVersion
|
||||
|
||||
func init() {
|
||||
YandexPluginVersion = version.InitializePluginVersion(
|
||||
packerVersion.Version, packerVersion.VersionPrerelease)
|
||||
}
|
||||
|
|
|
@ -12,20 +12,39 @@ import (
|
|||
// The git commit that was compiled. This will be filled in by the compiler.
|
||||
var GitCommit string
|
||||
|
||||
// InitializePluginVersion initializes the SemVer and returns a version var.
|
||||
// If the provided "version" string is not valid, the call to version.Must
|
||||
// will panic. Therefore, this function should always be called in a package
|
||||
// init() function to make sure that plugins are following proper semantic
|
||||
// versioning and to make sure that plugins which aren't following proper
|
||||
// semantic versioning crash immediately rather than later.
|
||||
func InitializePluginVersion(vers, versionPrerelease string) *PluginVersion {
|
||||
pv := PluginVersion{
|
||||
version: vers,
|
||||
versionPrerelease: versionPrerelease,
|
||||
}
|
||||
// This call initializes the SemVer to make sure that if Packer crashes due
|
||||
// to an invalid SemVer it's at the very beginning of the Packer run.
|
||||
pv.semVer = version.Must(version.NewVersion(vers))
|
||||
return &pv
|
||||
}
|
||||
|
||||
type PluginVersion struct {
|
||||
// The main version number that is being run at the moment.
|
||||
Version string
|
||||
version string
|
||||
// A pre-release marker for the version. If this is "" (empty string)
|
||||
// then it means that it is a final release. Otherwise, this is a pre-release
|
||||
// such as "dev" (in development), "beta", "rc1", etc.
|
||||
VersionPrerelease string
|
||||
versionPrerelease string
|
||||
// The Semantic Version of the plugin. Used for version constraint comparisons
|
||||
semVer *version.Version
|
||||
}
|
||||
|
||||
func (p *PluginVersion) FormattedVersion() string {
|
||||
var versionString bytes.Buffer
|
||||
fmt.Fprintf(&versionString, "%s", p.Version)
|
||||
if p.VersionPrerelease != "" {
|
||||
fmt.Fprintf(&versionString, "-%s", p.VersionPrerelease)
|
||||
fmt.Fprintf(&versionString, "%s", p.version)
|
||||
if p.versionPrerelease != "" {
|
||||
fmt.Fprintf(&versionString, "-%s", p.versionPrerelease)
|
||||
|
||||
if GitCommit != "" {
|
||||
fmt.Fprintf(&versionString, " (%s)", GitCommit)
|
||||
|
@ -35,18 +54,28 @@ func (p *PluginVersion) FormattedVersion() string {
|
|||
return versionString.String()
|
||||
}
|
||||
|
||||
func (p *PluginVersion) Semver() *version.Version {
|
||||
func (p *PluginVersion) SemVer() *version.Version {
|
||||
if p.semVer != nil {
|
||||
// SemVer is an instance of version.Version. This has the secondary
|
||||
// benefit of verifying during tests and init time that our version is a
|
||||
// proper semantic version, which should always be the case.
|
||||
SemVer := version.Must(version.NewVersion(p.Version))
|
||||
return SemVer
|
||||
p.semVer = version.Must(version.NewVersion(p.version))
|
||||
}
|
||||
return p.semVer
|
||||
}
|
||||
|
||||
func (p *PluginVersion) GetVersion() string {
|
||||
return p.version
|
||||
}
|
||||
|
||||
func (p *PluginVersion) GetVersionPrerelease() string {
|
||||
return p.versionPrerelease
|
||||
}
|
||||
|
||||
// String returns the complete version string, including prerelease
|
||||
func (p *PluginVersion) String() string {
|
||||
if p.VersionPrerelease != "" {
|
||||
return fmt.Sprintf("%s-%s", p.Version, p.VersionPrerelease)
|
||||
if p.versionPrerelease != "" {
|
||||
return fmt.Sprintf("%s-%s", p.version, p.versionPrerelease)
|
||||
}
|
||||
return p.Version
|
||||
return p.version
|
||||
}
|
||||
|
|
|
@ -5,7 +5,9 @@ import (
|
|||
packerVersion "github.com/hashicorp/packer/version"
|
||||
)
|
||||
|
||||
var ExoscaleImportPluginVersion = version.PluginVersion{
|
||||
Version: packerVersion.Version,
|
||||
VersionPrerelease: packerVersion.VersionPrerelease,
|
||||
var ExoscaleImportPluginVersion *version.PluginVersion
|
||||
|
||||
func init() {
|
||||
ExoscaleImportPluginVersion = version.InitializePluginVersion(
|
||||
packerVersion.Version, packerVersion.VersionPrerelease)
|
||||
}
|
||||
|
|
|
@ -16,10 +16,7 @@ const Version = "1.6.6"
|
|||
// such as "dev" (in development), "beta", "rc1", etc.
|
||||
const VersionPrerelease = "dev"
|
||||
|
||||
var PackerVersion = pluginVersion.PluginVersion{
|
||||
Version: Version,
|
||||
VersionPrerelease: VersionPrerelease,
|
||||
}
|
||||
var PackerVersion *pluginVersion.PluginVersion
|
||||
|
||||
func FormattedVersion() string {
|
||||
return PackerVersion.FormattedVersion()
|
||||
|
@ -31,7 +28,8 @@ func FormattedVersion() string {
|
|||
var SemVer *version.Version
|
||||
|
||||
func init() {
|
||||
SemVer = version.Must(version.NewVersion(Version))
|
||||
PackerVersion = pluginVersion.InitializePluginVersion(Version, VersionPrerelease)
|
||||
SemVer = PackerVersion.SemVer()
|
||||
}
|
||||
|
||||
// String returns the complete version string, including prerelease
|
||||
|
|
Loading…
Reference in New Issue