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

Branch names consisting of only numbers are not handled correctly #208

Closed
cdchris12 opened this issue Nov 5, 2019 · 1 comment · Fixed by #289
Closed

Branch names consisting of only numbers are not handled correctly #208

cdchris12 opened this issue Nov 5, 2019 · 1 comment · Fixed by #289
Assignees
Labels
bug Something isn't working

Comments

@cdchris12
Copy link
Contributor

Describe the bug
During testing, a branch named 1299 was not picking up custom routes defined in the .lagoon.yml correctly. It looks like this issue is actually shyaml's indeterminate typing for a string that can be either an integer or a string.

To Reproduce
Steps to reproduce the behavior:

  1. Create a branch with only numbers as its name, like 1299
  2. Define custom routes for that branch in the .lagoon.yml file
  3. Observe that the custom routes are not picked up during the lagoon build.

Expected behavior
Since a branch name consisting of only numbers should be a valid branch name, Lagoon should support using solely digits as branch names

Additional context
The fix for this issue will likely involve forcing shyaml to read every branch name as a string, to remove any ambiguity with regards to the type of the branch name.

@cdchris12 cdchris12 added the bug Something isn't working label Nov 5, 2019
@cdchris12 cdchris12 self-assigned this Nov 5, 2019
@tobybellwood tobybellwood transferred this issue from uselagoon/lagoon Jun 8, 2023
@tobybellwood
Copy link
Member

ok - managed to pin this one down, and yes it does fail!

the "legacy" templates read the environment in as a number - at least the branch annotation encases it (incorrectly) in a string

 kind: Service
 metadata:
   labels:
     lagoon.sh/environment: 1.23456789e+09
   annotations:
     lagoon.sh/branch: "1.23456789e+09"

unable to decode "/kubectl-build-deploy/lagoon/services-routes/isolation-network-policy.yaml": resource.metadataOnlyObject.ObjectMeta: v1.ObjectMeta.Labels: ReadString: expects " or n, but found 1, error found in #10 byte of ...|ronment":1234567890

The ingress (processed in golang) does it right

 kind: Ingress
 metadata:
   annotations:
     lagoon.sh/branch: "1234567890"
  labels:
     lagoon.sh/environment: "1234567890"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants