如何检查 YML 语法是否正确(gitlab.yml) [英] How to check YML grammar is correct (gitlab.yml)
问题描述
,它将寻找keys 的差异(不是值,因为您应该将自己的值放在那里)
## LDAP 设置ldap: (<--- 它是一个键)启用:真^^^ ^^^核心价值
我只是做一个:
cd gitlab/configcheck_all_diff .
这样,如果密钥、密钥顺序、新密钥或已删除密钥有任何变化,我可以在升级 gitlab 时发现这些.
总而言之,您需要复制 目录部分你的 $PATH
:
check_all_diff
check_diff
(由check_all_diff
调用)
别忘了:
chmod 755 check_all_diff check_diff
- 不要引入不正确的 eol(行尾)字符.如果您这样做了,
dos2unix
会处理这些问题.
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?
What I use, and this works with any editor, is a comparison between:
gitlab.yml
gitlab.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 bycheck_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.
这篇关于如何检查 YML 语法是否正确(gitlab.yml)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!