mirror of
https://github.com/hashicorp/packer.git
synced 2026-10-13 09:42:02 -04:00
Merge pull request #12801 from hashicorp/backport/nywilken/hcp-packer-non-compliant-plugin-error/internally-sound-egret
This pull request was automerged via backport-assistant
This commit is contained in:
+17
-1
@@ -25,6 +25,10 @@ import (
|
||||
"github.com/posener/complete"
|
||||
)
|
||||
|
||||
const (
|
||||
hcpReadyIntegrationURL = "https://developer.hashicorp.com/packer/integrations?flags=hcp-ready"
|
||||
)
|
||||
|
||||
type BuildCommand struct {
|
||||
Meta
|
||||
}
|
||||
@@ -202,6 +206,8 @@ func (c *BuildCommand) RunContext(buildCtx context.Context, cla *BuildArgs) int
|
||||
m map[string]error
|
||||
}{m: make(map[string]error)}
|
||||
limitParallel := semaphore.NewWeighted(cla.ParallelBuilds)
|
||||
|
||||
var hasPossibleIncompatibleHCPIntegration bool
|
||||
for i := range builds {
|
||||
if err := buildCtx.Err(); err != nil {
|
||||
log.Println("Interrupted, not going to start any more builds.")
|
||||
@@ -267,12 +273,13 @@ func (c *BuildCommand) RunContext(buildCtx context.Context, cla *BuildArgs) int
|
||||
writeDiags(c.Ui, nil, hcl.Diagnostics{
|
||||
&hcl.Diagnostic{
|
||||
Summary: fmt.Sprintf(
|
||||
"failed to complete HCP-enabled build %q",
|
||||
"publishing build metadata to HCP Packer for %q failed",
|
||||
name),
|
||||
Severity: hcl.DiagError,
|
||||
Detail: hcperr.Error(),
|
||||
},
|
||||
})
|
||||
hasPossibleIncompatibleHCPIntegration = true
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
@@ -384,6 +391,15 @@ func (c *BuildCommand) RunContext(buildCtx context.Context, cla *BuildArgs) int
|
||||
c.Ui.Say("\n==> Builds finished but no artifacts were created.")
|
||||
}
|
||||
|
||||
if hasPossibleIncompatibleHCPIntegration {
|
||||
msg := fmt.Sprintf(`
|
||||
It looks like one or more plugins in your build may be incompatible with HCP Packer.
|
||||
Check that you are using an HCP Ready integration before trying again:
|
||||
%s`, hcpReadyIntegrationURL)
|
||||
|
||||
c.Ui.Error(msg)
|
||||
}
|
||||
|
||||
if len(errs.m) > 0 {
|
||||
// If any errors occurred, exit with a non-zero exit status
|
||||
ret = 1
|
||||
|
||||
@@ -641,7 +641,7 @@ func (bucket *Bucket) completeBuild(
|
||||
err = decoder.Decode(state)
|
||||
if err != nil {
|
||||
return packerSDKArtifacts, fmt.Errorf(
|
||||
"failed to obtain HCP Packer artifact from post-processor artifact: %w",
|
||||
"failed to obtain HCP Packer compliant artifact: %w",
|
||||
err)
|
||||
}
|
||||
log.Printf("[TRACE] updating artifacts for build %q", buildName)
|
||||
|
||||
@@ -164,7 +164,7 @@ func (version *Version) statusSummary(ui sdkpacker.Ui) {
|
||||
buf := &strings.Builder{}
|
||||
|
||||
buf.WriteString(fmt.Sprintf(
|
||||
"\nVersion %q is not complete, the following builds are not done:\n\n",
|
||||
"\nVersion %q is incomplete, the following builds are missing artifact metadata:\n\n",
|
||||
version.Fingerprint))
|
||||
for _, b := range rem {
|
||||
buf.WriteString(fmt.Sprintf("* %q: %s\n", b.ComponentType, b.Status))
|
||||
|
||||
Reference in New Issue
Block a user