Skip to content

Commit aec29a1

Browse files
SwampDragonsWilken Rivera
and
Wilken Rivera
authored
add digest to labels, if it exists. (#79)
* add digest to labels, if it exists. * Update builder/docker/artifact_import.go Co-authored-by: Wilken Rivera <wilken@hashicorp.com> Co-authored-by: Wilken Rivera <wilken@hashicorp.com>
1 parent b61d914 commit aec29a1

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

builder/docker/artifact_import.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,13 @@ func (a *ImportArtifact) stateHCPPackerRegistryMetadata() interface{} {
107107
// sha256 id. We store this for posterity, but the image id needs to be
108108
// the sha256.
109109
img.Labels["PackerArtifactID"] = a.Id()
110-
// Overwrite ID with
110+
// Digest exists in state if we ran the packer push postprocessor.
111+
digest, ok := data["Digest"].(string)
112+
if ok {
113+
img.Labels["ImageDigest"] = digest
114+
}
115+
116+
// Overwrite ID with image sha
111117
img.ImageID = data["ImageSha256"].(string)
112118

113119
return img

0 commit comments

Comments
 (0)