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

Version 1.1.7 blocks valid image label values #248

Closed
ericnorris opened this issue Feb 13, 2025 · 5 comments · Fixed by #249
Closed

Version 1.1.7 blocks valid image label values #248

ericnorris opened this issue Feb 13, 2025 · 5 comments · Fixed by #249
Labels

Comments

@ericnorris
Copy link
Contributor

ericnorris commented Feb 13, 2025

Overview of the Issue

Since version 1.1.7, likely due to #240, we are unable to publish images that have a label value that starts with a number:

Image: <redacted> has invalid labels: value "380ab351648ae3591f65fa9fb7521df0c432000e" for key "git-
sha" must match regex "^[a-z][a-z0-9_-]{0,62}$",

I believe this is overly restrictive - the documentation (https://cloud.google.com/compute/docs/labeling-resources) states (emphasis mine):

Keys and values can contain only lowercase letters, numeric characters, underscores, and dashes. All characters must use UTF-8 encoding, and international characters are allowed. Keys must start with a lowercase letter or international character.

Keys must start with a lowercase letter, but not values. In our case, the value is rejected for not starting with a letter, which I think is incorrect. We are unable to publish images using this plugin version due to this.

Reproduction Steps

  1. Build an image with a label key of git-sha, and a label value of 380ab351648ae3591f65fa9fb7521df0c432000e

Plugin and Packer version

plugin-googlecompute_v1.1.7_x5.0_linux_amd64

Simplified Packer Buildfile

N/A

Operating system and Environment details

N/A

Log Fragments and crash.log files

N/A

@ericnorris ericnorris added the bug label Feb 13, 2025
@ericnorris ericnorris changed the title Version 1.1.7 blocks valid image label _values_ Version 1.1.7 blocks valid image label values Feb 13, 2025
@AlanHale25
Copy link

This is happening with our builds too.
has invalid labels: value "0300" for key "division" must match regex "^[a-z][a-z0-9_-]{0,62}$"

version 1.1.6 works fine

@chrisstaite
Copy link

Caused by #240 having the same regex for labels and keys which is invalid.

@lbajolet-hashicorp
Copy link
Contributor

Good catch @ericnorris, that one's on me, I didn't read the specs enough before merging the PR earlier.

I'll open a PR to address this one ASAP, and publish another release, likely tomorrow, which hopefully will fix this problem.

@lbajolet-hashicorp
Copy link
Contributor

The PR is now open, please feel free to review it to make sure I haven't forgotten any edge-case, and if possible, could I ask you to test it @ericnorris / @chrisstaite / @AlanHale25 ? Since we are releasing tomorrow, I would love to have a confirmation from any of you that the problem is indeed fixed so we can avoid another blunder.

Thanks in advance!

@lbajolet-hashicorp
Copy link
Contributor

lbajolet-hashicorp commented Feb 14, 2025

Thanks for the reviews/discussions on the PR, great insights there!

The PR is merged, and now we are releasing v1.1.8 of the plugin with that patch in, so within one hour, the new version should be available, fixing this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants