添加行到ClearCase config

时间:2017-10-25 13:49:24

标签: clearcase cleartool clearcase-automation

我在Jenkins上运行一个用于在ClearCase上创建视图的作业,而ClearCase视图创建了默认的配置规范。

我想通过添加更多行来编辑配置规范,但我不想每次都手动编辑它。所以我希望为Jenkins添加一些脚本,以便每次运行时都可以编辑configspec。

有没有人如何明确案例专家谁可以任务。

1 个答案:

答案 0 :(得分:0)

创建ClearCase视图后,您需要将其配置规范作为cleartool edcs

的文件获取
cd /path/to/view
cleartool catcs > cs

您需要在默认值之前添加您的选择规则:如config spec

中所述
  

由于配置规范中的规则按顺序处理,因此更改顺序可能会影响版本选择。例如,假设此规则出现在配置规范的开头附近:

element * /main/LATEST
  

配置规范中的任何后续规则将永远不会被使用,因为规则始终提供匹配;每个元素在其主分支上都有最新版本。

     

注意:
  指定快照视图的加载规则的顺序并不重要。

要编写该脚本,请参阅“Using sed, Insert a line below (or above) the pattern?” 另一种选择:见“How to insert the content of a file into another file before a pattern (marker)?” 将您的其他行放入名为othercs的文件中。

#!/bin/bash
while IFS= read -r line
do
    if [[ "$line" =~ .*CHECKEDOUT.*$ ]]
    then
        cat othercs
    fi
    echo "$line"
done < cs

完成后,您可以附加所需的任何其他加载规则(如果您使用的是快照视图,因为动态视图没有加载规则)

最后,一旦cs文件具有正确的选择/加载规则,您就可以使用cleartool setcs将其设置回当前视图。

cleartool setcs -tag view-tag  cs
                              ^
                              |
                     name of the file you have modified