Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Action output monitors make it easy to react to the presence of a word, such as "error" in the output from an action.

Example Problems

If you want to abort the build when there are more than five errors, or there is a requirement to process each line of the output somehow. The following are some solutions to those two problems;


Counting warnings

The key is to log the output of the action to a variable, then analyse the contents of the variable. You'll need two variables, "Output" and "Count"

...

Now you're all set to use the variable however you like:


Processing a log line by line

Let's say the output from some external program is very verbose, and all you want is lines that contain "Image: " followed by a filename.

...

Now, we can add whatever processing we like. The "line" variable at this point contains just the name of the image found in the output. We set the "Text Replace" action to ignore failure. The loop should carry on for each line that doesn't have the text we're looking for.

There we have it!


Summary

  1. The program runs, logging its output to a variable called "Output"
  2. The list iterator cycles over that output, placing each line in a variable called "Line"
  3. The Text Replace action then reduces that line down to just the image name, or fails if it's not an image line.
  4. If the text is found, the file is then copied somewhere.

...