我有一个后处理脚本,可以从上一步中提取一行(称为“抓取变化”):
// Register a scanner to search for the text '<change-log>' in the log.
// The first argument is a regular expression.
//
// The second argument, an inline function, is invoked once for
// every line in the log output that matches the pattern. The "lineNumber"
// variable contains the line number where the match occurred, and the
// "line" variable is the full text of the line.
//
commandOut.print("find changes ...");
var haschanges = false;
scanner.register('\<change\-log\>', function(lineNumber, line) {
properties.put("changes", line);
commandOut.print("changes: " + line);
haschanges = true;
});
scanner.scan();
if (haschanges == false) {
commandOut.print("no changes!");
properties.put("Status", "Failure");
}
var exit = properties.get('exitCode');
if (exit == 0 && haschanges == true) {
properties.put('Status', 'Success');
}
else {
properties.put('Status', 'Failure');
}
然后我尝试在此常规脚本的以后的步骤中使用它:
println(inProps.get("Grab changes/changes"))
在常规步骤中获得的唯一输出为空。