Используйте набор свойств Urbancode Build в скрипте постобработки на следующем шаге Groovy - PullRequest
0 голосов
/ 25 октября 2018

У меня есть сценарий постобработки, который извлекает строку из предыдущего шага (называемую «Захватить изменения»):

// 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"))

Единственный вывод, который я получаю в шаге groovy, - ноль.

...