这是file-a.yaml
unclassified:
sonarGlobalConfiguration:
buildWrapperEnabled: false
installations:
- credentialsId: "ID1"
name: "sonarqube"
serverUrl: "https://example.com"
triggers:
skipScmCause: false
skipUpstreamCause: false
- credentialsId: "ID2"
name: "sonarqube-2"
serverUrl: "https://example.co.uk"
triggers:
skipScmCause: false
skipUpstreamCause: false
字符串
这是file-b.yaml
unclassified:
sonarGlobalConfiguration:
installations:
- credentialsId: "ID-3"
name: "sonarqube-3"
serverUrl: "https://example.org"
triggers:
skipScmCause: false
skipUpstreamCause: false
型
我想合并这两个文件,这样file-a.yaml在unclassificed.sonarGlobalConfiguration.installations下包含3个项目
合并这两个文件或仅向安装阵列中添加一个新项目。这可以用YQ实现吗?
我尝试了几种YQ命令的组合,但是失败得很惨-以前有人做过这种事情吗?
1条答案
按热度按时间4ioopgfo1#
使用最新的
yq
(v4.34.2
):字符串