问题
GitLab server can't start. The reason is likely because gitlab.yml configuration file is not correct.
What tool to use to check yml grammar is correct?
I have tried Notepad++ and SublimeText, but they show small sign in different places:
Notepad doesn't like indent for 1 line.
SublimeText
Can really indents and spaces be problem in GitLab config parser?
回答1:
What I use, and this works with any editor, is a comparison between:
gitlab.ymlgitlab.yml.example
I developed a little bash diff script which will look for differences in keys (not values, since you are supposed to put your own values there)
## LDAP setting
ldap: (<--- it is a key)
enabled: true
^^^ ^^^
key value
I just do a:
cd gitlab/config
check_all_diff .
That way, if there are any change in term of keys, key order, new keys or deleted keys, I can spot those when I upgrade gitlab.
To summarize, you need to copy in a directory part of your $PATH:
- check_all_diff
- check_diff (called by
check_all_diff)
Don't forget to:
chmod 755 check_all_diff check_diff- don't introduce improper eol (end of line) character. If you did, a dos2unix will take care of those.
来源:https://stackoverflow.com/questions/17825404/how-to-check-yml-grammar-is-correct-gitlab-yml