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

"Re-run" of a PipelineRun that used generateName with a long value fails. #14548

Open
jvmdc opened this issue Nov 27, 2024 · 0 comments
Open

Comments

@jvmdc
Copy link

jvmdc commented Nov 27, 2024

When attempting to rerun (through the UI) a PipelineRun that uses generateName rather than name for its name, the new PipelineRun will fail admission with the error message: admission webhook "validation.webhook.pipeline.tekton.dev" denied the request: validation failed: Invalid resource name: length must be no more than 63 characters: metadata.name

To reproduce:

  1. Start a PipelineRun specifying generateName rather than name, with a length of at least 58 characters.
  2. Attempt to re-run the PipelineRun through one of these paths:
    a. Go to Pipelines -> PipelineRun -> Click three dots next to the PipelineRun -> "Rerun"
    b. Go to Pipelines -> Click three dots next to the Pipeline that was run -> "Start last run"
  3. The PipelineRun will fail admission (in case 2.a without showing in the UI!) with an error message: "admission webhook "validation.webhook.pipeline.tekton.dev" denied the request: validation failed: Invalid resource name: length must be no more than 63 characters: metadata.name"

Cause

The issue arises from this line of code:

? `${getPipelineRunGenerateName(latestRun)}${getRandomChars()}`

In the case where generateName is used in the previous pipeline run, the getPipelineRunGenerateName function invoked simply returns the entire generateName string which is concated by the 6 characters that the getRandomChars function returns. This is then set as the name of the new PipelineRun. If generateName is at least 58 characters long, this will result in a 64 character name, thus failing admission.

My suggestion would be to simply set generateName on the new PipelineRun to the generateName value on the old PipelineRun. When using generateName, Kubernetes will attempt to ensure uniqueness anyway (or fail trying), thus there is no need to use the getRandomChars function.

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

No branches or pull requests

1 participant