Groovy Script (ksc_run_groovy) output

Hi,

After running a Groovy script in an execution step, Is there any way to read the returned output? We have tried some options inside the groovy script like print, println, System.out.println/print function, but we cannot see the result on the execution log, it is directly log into the server log.

Is there any way that will work like "ksc_local_exec" which read the returned response with a token like [EXEC.OUTPUT]? 

Thanks, 

  • Suggested Answer

    0  

    Hi Emre,

    The way groovy script execution works in PPM is that the value returned by the script will be evaluated to see if the script execution should be considered a success:
    - If it's a String, it's expected to be "true"
    - If it's an integer, it's expected to be 0
    - null value is considered success
    - Otherwise it's cast to a Boolean.

    If you want to write some output to the execution step debug log, you can call this from your script:

    debugExeLog.println(...)

    I'm not aware of any easy way ot get result of the execution (except for the simple success/failure). You could write some complex output to some file from your groovy script and later read the file contents in another step to expose it to other special commands.