Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hcp packer registry build labels #11401

Merged
merged 5 commits into from Nov 18, 2021
Merged

hcp packer registry build labels #11401

merged 5 commits into from Nov 18, 2021

Conversation

nywilken
Copy link
Member

@nywilken nywilken commented Nov 16, 2021

  • Add basic support for build_labels argument
  • Update complete test-fixture with a build_labels configuration
  • Add test for deprecated labels argument
  • Add deprecation for hcp_packer_registry.labels

Documentation Preview

When using the now deprecated labels argument of the new bucket_labels a Warning will be presented to the user.

~>  HCP_PACKER_BUILD_FINGERPRINT=356786543567865456789656789 packer
build source.pkr.hcl
Warning: the argument hcp_packer_registry.labels has been deprecated and will be removed in a future release; please use hcp_packer_registry.bucket_labels

When trying to use both bucket_labels and labels together an error is presented to the user.

~>  HCP_PACKER_BUILD_FINGERPRINT=ss6786543567865456789656789 packer
build source.pkr.hcl
Error: hcp_packer_registry.labels and hcp_packer_registry.bucket_labels are mutely exclusive; please use the recommended argument hcp_packer_registry.bucket_labels

  on source.pkr.hcl line 17:
    (source code not available)

Basic testing template
source "file" "basic-example" {
  content = "Lorem ipsum dolor sit amet"
  target  = "/tmp/artifact"
}

source "file" "markdown" {
  content = "Lorem ipsum dolor sit amet"
  target  = "/tmp/two.md"
}

build {
  hcp_packer_registry {
    bucket_name = "simple-artifact"
    description = "Simple artifact build"

    bucket_labels = {
      "CreatedBy" = "Packer"
      "TestedWith" = "LatestDev"
    }


    build_labels = {
      "python_version" = "3.0"
    }

  }
  name    = "simple-artifact"
  sources = ["sources.file.basic-example", "sources.file.markdown"]

  provisioner "shell-local" {
    inline = ["hostname"]
  }

}

* Update complete test-fixture with a build_labels configuration
* Add test for deprecated labels argument
* Add deprecation for hcp_packer_registry.labels

When using the now deprecated labels argument of the new bucket_labels a
Warning will be presented to the user.

```
~>  HCP_PACKER_BUILD_FINGERPRINT=356786543567865456789656789 packer
build source.pkr.hcl
Warning: the argument hcp_packer_registry.labels has been deprecated and will be removed in a future release; please use hcp_packer_registry.bucket_labels
```

When trying to use both bucket_labels and labels together an error is
presented to the user.
```
~>  HCP_PACKER_BUILD_FINGERPRINT=ss6786543567865456789656789 packer
build source.pkr.hcl
Error: hcp_packer_registry.labels and hcp_packer_registry.bucket_labels are mutely exclusive; please use the recommended argument hcp_packer_registry.bucket_labels

  on source.pkr.hcl line 17:
    (source code not available)

```
@nywilken nywilken requested a review from a team as a code owner November 16, 2021 21:30
"foo" = "bar"
}
build_labels = {
"python_version" = "3.0"
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

noice !

Copy link
Contributor

@azr azr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, super nice !

Co-authored-by: Adrien Delorme <azr@users.noreply.github.com>
@azr azr merged commit 06b35c3 into master Nov 18, 2021
@azr azr deleted the hcp_packer_registry_build_labels branch November 18, 2021 08:40
@github-actions
Copy link

I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 19, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants