Hi,
I’m encountering an issue while trying to deploy JupyterHub (Version 4.0.7) using Helm. When I attempt to apply my values.yaml throw gitlab ci/cd, I consistently get the following error message:
Error: failed to parse jupyterhub/helm-jupyterhub/values.yaml: error converting YAML to JSON: yaml: line 17: could not find expected ':'
I’ve checked my values.yaml file, and everything seems to be correctly formatted, but I can’t seem to pinpoint what’s causing this error. Could someone help me understand what might be causing this issue and how to resolve it?
The values.yml file that you posted has only placeholders for different secrets and I am assuming you are replacing those placeholders from GitLab CI secrets variables. Are you sure the YAML is valid after replacement? I think you will have to check for the formatting errors.
Thank you for your feedback
Yes, you are correct that the values.yml file contains placeholders for different secrets. I can confirm that these placeholders are replaced with the actual secret values using GitLab CI secret variables during the pipeline execution.
I have verified the values.yml file with a YAML validator after the secrets are replaced, and it passed without any errors. This ensures that the YAML formatting is correct post-replacement.
Any other suggestions?
No, I dont have any other ideas. The error is quite clear, there is a colon missing somwhere in your YAML file after secret replacement. This can be due to hidden characters and/or incorrect indentation.
When checking, did you use the actual file created by and used in your CI pipeline, or did you apply the substitutions outside of CI?
Can you put quotes around the replacements, e.g. "<JUPYTERHUB_COOKIE_SECRET>"
The error says it’s happening on line 17:
cookieSecret: <JUPYTERHUB_COOKIE_SECRET>
so I think it is definitely an issue in the secret substitution, or the substituted secret value itself. Not having access to your secrets or how the secrets are substituted, it’s hard to say exactly what’s going wrong there, but I think that’s where you should focus. For debugging purposes, you could try showing the raw bytes of line 16-17 after substitution in case there is something funky there like non-printing characters which can cause this kind of error:
with open("config.yaml", "rb") as f:
lines = f.readlines()
for lineno in range(16, 18):
print(lineno, repr(lines[lineno - 1]))
Thanks for suggestions all! Problem solved!
Strange but when I edit values.yaml and remove comments from 15, 16, 18 line I resolve the issue
Now values.file look like this:
Ah, the comments makes sense! Since there is a <JUPYTERHUB_CONFIG> in one of the removed comments. Is there a chance this is a multi-line string? If so, it would wrap around to new lines that wouldn’t be commented out.