Merge pull request #14733 from hashicorp/f-env-var-prerelease-string
core: Use environment variables to set VersionPrerelease at compile time
This commit is contained in:
commit
9a7a243c5c
|
@ -1,7 +1,6 @@
|
||||||
package circonus
|
package circonus
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/circonus-labs/circonus-gometrics/api"
|
"github.com/circonus-labs/circonus-gometrics/api"
|
||||||
|
@ -123,13 +122,5 @@ func providerConfigure(d *schema.ResourceData) (interface{}, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func tfAppName() string {
|
func tfAppName() string {
|
||||||
const VersionPrerelease = terraform.VersionPrerelease
|
return fmt.Sprintf("Terraform v%s", terraform.VersionString())
|
||||||
var versionString bytes.Buffer
|
|
||||||
|
|
||||||
fmt.Fprintf(&versionString, "Terraform v%s", terraform.Version)
|
|
||||||
if VersionPrerelease != "" {
|
|
||||||
fmt.Fprintf(&versionString, "-%s", VersionPrerelease)
|
|
||||||
}
|
|
||||||
|
|
||||||
return versionString.String()
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package postgresql
|
package postgresql
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/hashicorp/errwrap"
|
"github.com/hashicorp/errwrap"
|
||||||
|
@ -109,13 +108,5 @@ func providerConfigure(d *schema.ResourceData) (interface{}, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func tfAppName() string {
|
func tfAppName() string {
|
||||||
const VersionPrerelease = terraform.VersionPrerelease
|
return fmt.Sprintf("Terraform v%s", terraform.VersionString())
|
||||||
var versionString bytes.Buffer
|
|
||||||
|
|
||||||
fmt.Fprintf(&versionString, "Terraform v%s", terraform.Version)
|
|
||||||
if terraform.VersionPrerelease != "" {
|
|
||||||
fmt.Fprintf(&versionString, "-%s", terraform.VersionPrerelease)
|
|
||||||
}
|
|
||||||
|
|
||||||
return versionString.String()
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,9 +41,10 @@ export CGO_ENABLED=0
|
||||||
|
|
||||||
# Allow LD_FLAGS to be appended during development compilations
|
# Allow LD_FLAGS to be appended during development compilations
|
||||||
LD_FLAGS="-X main.GitCommit=${GIT_COMMIT}${GIT_DIRTY} $LD_FLAGS"
|
LD_FLAGS="-X main.GitCommit=${GIT_COMMIT}${GIT_DIRTY} $LD_FLAGS"
|
||||||
# In relase mode we don't want debug information in the binary
|
|
||||||
|
# In release mode we don't want debug information in the binary
|
||||||
if [[ -n "${TF_RELEASE}" ]]; then
|
if [[ -n "${TF_RELEASE}" ]]; then
|
||||||
LD_FLAGS="-X main.GitCommit=${GIT_COMMIT}${GIT_DIRTY} -s -w"
|
LD_FLAGS="-X main.GitCommit=${GIT_COMMIT}${GIT_DIRTY} -X github.com/hashicorp/terraform/terraform.VersionPrerelease= -s -w"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Build!
|
# Build!
|
||||||
|
|
|
@ -12,7 +12,7 @@ const Version = "0.9.6"
|
||||||
// A pre-release marker for the version. If this is "" (empty 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
|
// then it means that it is a final release. Otherwise, this is a pre-release
|
||||||
// such as "dev" (in development), "beta", "rc1", etc.
|
// such as "dev" (in development), "beta", "rc1", etc.
|
||||||
const VersionPrerelease = "dev"
|
var VersionPrerelease = "dev"
|
||||||
|
|
||||||
// SemVersion is an instance of version.Version. This has the secondary
|
// SemVersion is an instance of version.Version. This has the secondary
|
||||||
// benefit of verifying during tests and init time that our version is a
|
// benefit of verifying during tests and init time that our version is a
|
||||||
|
|
|
@ -6,4 +6,5 @@ import "github.com/hashicorp/terraform/terraform"
|
||||||
var GitCommit string
|
var GitCommit string
|
||||||
|
|
||||||
const Version = terraform.Version
|
const Version = terraform.Version
|
||||||
const VersionPrerelease = terraform.VersionPrerelease
|
|
||||||
|
var VersionPrerelease = terraform.VersionPrerelease
|
||||||
|
|
Loading…
Reference in New Issue