justyns / jenkins_wrapper

Shell script for wrapping External Jenkins jobs (eg: cron jobs) and posting their results to Jenkins

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Simple script for wrapping external Jenkins jobs and sending their output to Jenkins.

Best used for cron jobs.

This script originated here:  http://blog.markfeeney.com/2010/01/jenkins-external-jobs-wrapper-script.html

I added a few simple features:

  1) If a job doesn't exist in Jenkins, it will automatically be created.
     
  2) Job names with whitespace are now supported (eg: "My Job #1")

  3) Supports authenticating to Jenkins instances that require it
     - Set CURL_AUTH_OPTS environment variable, or hardcode into the script (see example in the script)
     - Be aware that this isn't the securest method, since your password could be read by someone on
       the same machine by examining the environment or looking at the script itself.

Examples:
   $ jenkins_wrapper http://jenkins.myco.com:8080 testjob /path/to/script.sh
   $ jenkins_wrapper http://jenkins.myco.com:8080 testjob 'sleep 2 && ls -la'

example with authentication:
   $ CURL_AUTH_OPTS="--user myuser:pass" jenkins_wrapper http://jenkins.myco.com:8080 testjob /path/to/script.sh

About

Shell script for wrapping External Jenkins jobs (eg: cron jobs) and posting their results to Jenkins