如何检查YML语法是否正确(gitlab.yml) [英] How to check YML grammar is correct (gitlab.yml)
问题描述
GitLab服务器无法启动.原因可能是因为gitlab.yml配置文件不正确.
GitLab server can't start. The reason is likely because gitlab.yml configuration file is not correct.
使用哪种工具检查yml语法正确?
我已经尝试过Notepad ++和SublimeText,但是它们在不同的地方显示小标志:
I have tried Notepad++ and SublimeText, but they show small sign in different places:
记事本不喜欢缩进1行.
Notepad doesn't like indent for 1 line.
SublimeText
SublimeText
真的可以在GitLab配置解析器中出现缩进和空格问题吗?
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
gitlab.yml
gitlab.yml.example
我开发了一些 bash diff脚本 键中的差异(不是值,因为应该在其中放置自己的值)
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
我只是做一个:
cd gitlab/config
check_all_diff .
这样,如果密钥,密钥顺序,新密钥或已删除密钥的术语有任何变化,我可以在升级gitlab时发现它们.
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.
总而言之,您需要复制到目录部分您的$PATH
:
To summarize, you need to copy in a directory part of your $PATH
:
-
check_all_diff
-
check_diff
(被check_all_diff
调用)
check_all_diff
check_diff
(called bycheck_all_diff
)
别忘了:
-
chmod 755 check_all_diff check_diff
- 请勿引入不正确的eol(行尾)字符.如果您这样做了,
dos2unix
将解决这些问题.
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屋!