如何检查YML语法是否正确(gitlab.yml) [英] How to check YML grammar is correct (gitlab.yml)

查看:941
本文介绍了如何检查YML语法是否正确(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 (called by check_all_diff)

别忘了:

  • 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆