Skip to content

Commit

Permalink
version: compute SemVer from rawVersion
Browse files Browse the repository at this point in the history
A bug in the SDK prevents us from calling SemVer on the PluginVersion
derived from the rawVersion, as when doing so, we reset the semVer
attribute to only use the core part of the version, thereby dropping any
information on pre-release/metadata.

This is not ideal, and arguably not wanted. So in order to not lose this
information, we re-compute the SemVer from rawVersion, this way we don't
overwrite it for both structures.
  • Loading branch information
lbajolet-hashicorp committed Apr 23, 2024
1 parent f767d06 commit 410e59f
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion version/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,11 @@ func init() {
rawVersion = strings.TrimSpace(rawVersion)

PackerVersion = pluginVersion.NewRawVersion(rawVersion)
SemVer = PackerVersion.SemVer()
// A bug in the SDK prevents us from calling SemVer on the PluginVersion
// derived from the rawVersion, as when doing so, we reset the semVer
// attribute to only use the core part of the version, thereby dropping any
// information on pre-release/metadata.
SemVer, _ = version.NewVersion(rawVersion)

Version = PackerVersion.GetVersion()
VersionPrerelease = PackerVersion.GetVersionPrerelease()
Expand Down

0 comments on commit 410e59f

Please sign in to comment.