0 votes
in Technology by (557k points)
How to download the Console log for a particular Jenkins build programmatically?

1 Answer

0 votes
by (557k points)

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>

...