From 83fbd8e498a93a40105fa07c744561442af4c9ac Mon Sep 17 00:00:00 2001 From: sylviamoss Date: Wed, 28 Jul 2021 14:52:58 +0200 Subject: [PATCH] add some doc in the code --- hcl2template/testdata/hcp_par/duplicate.pkr.hcl | 2 +- hcl2template/testdata/hcp_par/empty.pkr.hcl | 1 + hcl2template/testdata/hcp_par/invalid.pkr.hcl | 2 +- hcl2template/testdata/hcp_par/long-description.pkr.hcl | 2 +- hcl2template/types.build.go | 1 + hcl2template/types.build.hcp_packer_registry.go | 7 +++++-- 6 files changed, 10 insertions(+), 5 deletions(-) diff --git a/hcl2template/testdata/hcp_par/duplicate.pkr.hcl b/hcl2template/testdata/hcp_par/duplicate.pkr.hcl index e3d850b05c1..1e6afe02bed 100644 --- a/hcl2template/testdata/hcp_par/duplicate.pkr.hcl +++ b/hcl2template/testdata/hcp_par/duplicate.pkr.hcl @@ -8,4 +8,4 @@ build { } } hcp_packer_registry {} -} \ No newline at end of file +} diff --git a/hcl2template/testdata/hcp_par/empty.pkr.hcl b/hcl2template/testdata/hcp_par/empty.pkr.hcl index 9af3e558bb1..da70ff87546 100644 --- a/hcl2template/testdata/hcp_par/empty.pkr.hcl +++ b/hcl2template/testdata/hcp_par/empty.pkr.hcl @@ -10,3 +10,4 @@ build { source "virtualbox-iso" "ubuntu-1204" { } + diff --git a/hcl2template/testdata/hcp_par/invalid.pkr.hcl b/hcl2template/testdata/hcp_par/invalid.pkr.hcl index 616e8c24914..42ba3210b94 100644 --- a/hcl2template/testdata/hcp_par/invalid.pkr.hcl +++ b/hcl2template/testdata/hcp_par/invalid.pkr.hcl @@ -4,4 +4,4 @@ build { hcp_packer_registry { labels = "" } -} \ No newline at end of file +} diff --git a/hcl2template/testdata/hcp_par/long-description.pkr.hcl b/hcl2template/testdata/hcp_par/long-description.pkr.hcl index 59fe33b3a88..3cc329b81b6 100644 --- a/hcl2template/testdata/hcp_par/long-description.pkr.hcl +++ b/hcl2template/testdata/hcp_par/long-description.pkr.hcl @@ -8,4 +8,4 @@ super super super super super super super super super super super super super su super super super long description EOT } -} \ No newline at end of file +} diff --git a/hcl2template/types.build.go b/hcl2template/types.build.go index 8f2b6320ae0..2ad40dc89e3 100644 --- a/hcl2template/types.build.go +++ b/hcl2template/types.build.go @@ -61,6 +61,7 @@ type BuildBlock struct { // call for example. Description string + // HCPPackerRegistry contains the configuration for publishing the image to the HCP Packer Registry. HCPPackerRegistry *HCPPackerRegistryBlock // Sources is the list of sources that we want to start in this build block. diff --git a/hcl2template/types.build.hcp_packer_registry.go b/hcl2template/types.build.hcp_packer_registry.go index 1e28ad7c1d3..819206e92fd 100644 --- a/hcl2template/types.build.hcp_packer_registry.go +++ b/hcl2template/types.build.hcp_packer_registry.go @@ -2,16 +2,19 @@ package hcl2template import ( "fmt" + "github.com/hashicorp/hcl/v2" "github.com/hashicorp/hcl/v2/gohcl" packerregistry "github.com/hashicorp/packer/internal/packer_registry" ) type HCPPackerRegistryBlock struct { + // Bucket description Description string - Labels map[string]string + // Bucket labels + Labels map[string]string - HCL2Ref HCL2Ref + HCL2Ref } func (b *HCPPackerRegistryBlock) WriteBucketConfig(bucket *packerregistry.Bucket) {