summaryrefslogtreecommitdiff
path: root/examples/how_to/create_a_job.py
blob: 343685ed942f048557072823def8e337f4e1e551 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
from __future__ import print_function

import logging
logging.basicConfig()

from jenkinsapi.jenkins import Jenkins
from pkg_resources import resource_string
J = Jenkins('http://localhost:8080')
jobName = 'foo_job2'
xml = resource_string('examples', 'addjob.xml')

print(xml)

j = J.create_job(jobname=jobName, config=xml)

j2 = J[jobName]
print(j)

# Delete job
J.delete_job(jobName)