1.

How to download the Console log for a particular Jenkins build programmatically?

Answer»

Using the JENKINS CLI - console - command

java -jar jenkins-cli.jar console JOB [BUILD] [-f] [-N N]

Produces the console OUTPUT of a specific build to stdout, as if you are doing 'cat build.log'

  • JOB: Name of the job
  • BUILD: Build number or PERMALINK to point to the build. Defaults to the LAST build
  • -f: If the build is in progress, append console output as it comes, like tail -f
  • -n N: Display the last N lines.

E.g.

ssh -l <ssh_username> -p <port_no> <Jenkins_URL> console <JOB_NAME>



Discussion

No Comment Found