mirror of
https://github.com/hashicorp/packer.git
synced 2026-10-31 02:18:24 -04:00
* Update handling of registry artifacts This change uses the github.com/hashicorp/packer-plgin-sdk/packer/registryimage for querying Artifact State for HCP Registry Image metadata. To handle the conversion of the RPC response, mapstructure was introduced to conversion state data into an registryimage.Image before publishing to a image bucket. * Update to use registry image from packersdk * Rename internal registry service pkg * Update vendored plugins to latest version * The latest release of Amazon, GoogleCompute, and Azure have support for publishing images to the HCP Packer registry.
42 lines
609 B
Go
42 lines
609 B
Go
package env
|
|
|
|
import (
|
|
"os"
|
|
"strings"
|
|
)
|
|
|
|
func HasClientID() bool {
|
|
_, ok := os.LookupEnv(HCPClientID)
|
|
return ok
|
|
}
|
|
|
|
func HasClientSecret() bool {
|
|
_, ok := os.LookupEnv(HCPClientSecret)
|
|
return ok
|
|
}
|
|
|
|
func HasPackerRegistryBucket() bool {
|
|
_, ok := os.LookupEnv(HCPPackerBucket)
|
|
return ok
|
|
}
|
|
|
|
func HasHCPCredentials() bool {
|
|
checks := []func() bool{
|
|
HasClientID,
|
|
HasClientSecret,
|
|
}
|
|
|
|
for _, check := range checks {
|
|
if !check() {
|
|
return false
|
|
}
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
func IsPAREnabled() bool {
|
|
val, ok := os.LookupEnv(HCPPackerRegistry)
|
|
return ok && strings.ToLower(val) != "off" && val != "0"
|
|
}
|