Jenkins to CloudBees - bootstraponline/meta GitHub Wiki

Start cloudbees job via curl

1. Visit job config, check Trigger builds remotely (e.g., from scripts), provide an authentication token, then Save

2. Visit https://YOURACCOUNT.ci.cloudbees.com/me/configure and press Show API Token...

3. URL encode your email address via Chrome dev tools console.

encodeURIComponent("[email protected]")
"test%2Btest%40gmail.test"

4. Construct curl command. Replace 000 with your API token. Replace email and your account with your email and cloudbees subdomain.

export CLOUDBEES="https://test%2Btest%40gmail.test:[email protected]"
export JOB_TOKEN=123
export COMMIT=456
curl -X POST "$CLOUDBEES/job/your-job-name/build?token=$JOB_TOKEN&cause=$COMMIT" -v

File.open('/tmp/jobs.txt', 'w') do |txt|
  Dir.glob('/path/to/.jenkins/jobs/*/*') do |f|
    puts "File: #{f}"
    txt.puts f if ['config.xml', 'nextBuildNumber'].include? File.basename(f)
  end
end
tar czPf jobs.tar -T /tmp/jobs.txt 
scp [email protected]:/tmp/jobs.tar .

OPEs & Nodes Plus

The OPE must be set the -persistent flag to be configurable with the Nodes Plus plugin.