AutoDevOps deploy hostnames should conform to RFC2181
Summary
AutoDevops pipelines with longer group and project names can exceed the 63 character limit for a label (between the dots) of a domain name.
These limits are defined in http://tools.ietf.org/html/rfc2181 and not respecting them causes the dynamically generated hostname to not resolve for most browsers.
Steps to reproduce
- Create an org with ~20 character in the name
- Create a project with ~20 characters in the name
- Create a branch with ~20 characters
- Create a review environment for that branch
- Wait for the k8s deploy to be successful
- Note the hostname is over 63 characters long and will not resolve
Example Project
https://gitlab.ii.coop/ServiceInnovationLab/openfisca-aotearoa/
What is the current bug behavior?
- Generated labels can be over 63 characters long.
- Generated domain names, could, in extreme cases be over 255 characters long.
From: http://tools.ietf.org/html/rfc2181
The DNS itself places only one restriction on the particular labels that can be used to identify resource records. That one restriction relates to the length of the label and the full name. The length of any one label is limited to between 1 and 63 octets. A full domain name is limited to 255 octets (including the separators).
What is the expected correct behavior?
Labels (items between the dots) should be less than 63 characters, and the fqdn should be less than 255 characters overall.
Relevant logs and/or screenshots
https://gitlab.ii.coop/ServiceInnovationLab/openfisca-aotearoa/-/jobs/1746
$ echo serviceinnovationlab-openfisca-aotearoa-review-acc-entitl-x0gvbm.openfisca.ii.nz | wc -c
81
$ dig serviceinnovationlab-openfisca-aotearoa-review-acc-entitl-x0gvbm.openfisca.ii.nz
dig: 'serviceinnovationlab-openfisca-aotearoa-review-acc-entitl-x0gvbm.openfisca.ii.nz' is not a legal IDN name (domain label longer than 63 characters), use +noidnin
Possible fixes
SHA.review-BRANCH.NAMESPACE.GROUP.$DOMAIN would help keep the url meaningful. As long as we don't mind using subdomains.
I suspect in practice most people set *.mysubdomain.com which would account for any subdomains.