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

Cleanup branch name in PR Generators #9461

Closed
Aym3nTN opened this issue May 20, 2022 · 0 comments · Fixed by #9462
Closed

Cleanup branch name in PR Generators #9461

Aym3nTN opened this issue May 20, 2022 · 0 comments · Fixed by #9462
Labels
component:applications-set Bulk application management related enhancement New feature or request

Comments

@Aym3nTN
Copy link
Contributor

Aym3nTN commented May 20, 2022

Summary

In PR generators, I noticed that when a branch name contains special characters or is too long to be used in a resource name (by using {{branch}}), the applicationset controller fails to create the resource throwing the below exception.

argocd-applicationset-controller-647f5948d6-bq7sn time="2022-05-20T08:58:18Z" level=error msg="failed to unchanged Application" action=unchanged app=nginx-github-feat/pr_special+character-2 appSet=test-app-set-github error="Application.argoproj.io \"nginx-github-feat/pr_special+character-2\" is invalid: metadata.name: Invalid value: \"nginx-github-feat/pr_special+character-2\": a lowercase RFC 1123 subdomain must consist of lower case alphanumeric characters, '-' or '.', and must start and end with an alphanumeric character (e.g. 'example.com', regex used for validation is '[a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*')"

Motivation

In order to follow the DNS label standard as defined in RFC 1123, manifests' name metadata should not exceed 63 and must consist of lower case alphanumeric characters, '-' or '.', and must start and end with an alphanumeric character.

Docs: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#dns-label-names

Proposal

For that I suggest limiting and cleaning the 'branch' name to contain only 50 characters to give room to append/suffix-ing it with 13 more characters.

@Aym3nTN Aym3nTN added the enhancement New feature or request label May 20, 2022
@jannfis jannfis added the component:applications-set Bulk application management related label May 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component:applications-set Bulk application management related enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants