https://pulumi.com logo
#getting-started
Title
# getting-started
b

breezy-agency-13977

12/10/2023, 2:26 AM
How can I set a pulumiLabel so it isn't 0? I am getting an error publishing to Google Cloud Registry
Copy code
Label key 'pulumiLabels.%' violates format constraints. The key must start with a lowercase character, can only contain lowercase letters, numeric characters, underscores and dashes. The key can be at most 63 characters long. International characters are allowed.
When I check out my google cloud run logs I see this error and the labels I am passing are
Copy code
labels: {
pulumiLabels.%: "0"
cloud.googleapis.com/location: "us-central1"
}
I am not setting any pulumi labels anywhere in my setup. How can I get this to not be
0
?
c

careful-salesclerk-28135

12/10/2023, 11:24 AM
I have noted that occasionally during a CI deployment some resources, typically
gcp:cloudrun:Service
would get a label with the name
pulumiLabels.%
when I had not expressed it anywhere in my code. I have not been able to reproduce this consistently, but it has happened a few times. For the cases I encountered the value of the label was an empty string. I found despite numerous refresh attempts, the label would not be removed from the resource. I had to manually remove it from the state file, after which things worked as expected. Without removing the label from the state file, pulumi would always try to update the resource, and the update would always fail with the error:
Copy code
Details:
    [
      {
        "@type": "<http://type.googleapis.com/google.rpc.BadRequest|type.googleapis.com/google.rpc.BadRequest>",
        "fieldViolations": [
          {
            "description": "At least one label does not conform to GCP naming style. Label key 'pulumiLabels.%' violates format constraints. The key must start with a lowercase character, can only contain lowercase letters, numeric characters, underscores and dashes. The key can be at most 63 characters long. International characters are allowed.",
            "field": "metadata.labels"
          }
        ]
      }
    ]
b

breezy-agency-13977

12/11/2023, 3:35 PM
Thanks @careful-salesclerk-28135. That worked great when I deleted my state. I had to also delete my services and spin them back up though since I lost my state. I am back to having this issue though where a label got added. Is there a way to edit the sate file to just delete the one label so I don't have to do that whole process?
s

salmon-account-74572

12/11/2023, 5:07 PM
Are you all using v7 of the GCP provider? It looks like there is an issue filed for this behavior with v7 of the provider: https://github.com/pulumi/pulumi-gcp/issues/1387 It would be great if you all could weigh in on that issue with any additional details on your experiences.
b

breezy-agency-13977

12/11/2023, 5:20 PM
Yes, I am using
"<http://github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/cloudrun|github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/cloudrun>"
The last comment on there is my main.go that I am using.
c

careful-salesclerk-28135

12/11/2023, 5:23 PM
I must have missed that issue when looking for issues, I just edited the state file, and all references to the key pulumiLabels.% in maps I remove. I encountered this same very issues as mentioned in 1387 in a production environment so could not easily obliterate the full state. That being said, this is based on a gcp backend, not sure what state storage you are using.
2 Views