Executing Hudson jobs remotely -
i trying automate hudson hitting appropriate urls remotely. using python's urllib2 doing same.
first of , trying build existing job , build status.
a sample url build this:
http://tomcaturl:8080/hudson/job/.net%20build/build
however returns me html data.
hudson docs can data in python/json/xml format, try hit
http://tomcaturl:8080/hudson/job/.net%20build/build/api/json
but no data @ all, although build happens successfully.
is there way find out build started remote build request, can maintain one-to-one mapping.
please note doing through remote python program , not have access hudson gui.
first of all, if have security/login enabled have logged in remote hudson server /job/jobname/build. if allow starting build without being logged in, not problem.
the /job/jobname/build request return html data. if not logged in repsonse redirecting login page , build not started. if request successful not redirect login, , can assume build queued. can check build queue using api url of project (see below). note there may delay before build started, can control calling /job/jobname/build?delay=0sec
the api not available under job/jobname/build url, can see api information here:
http://tomcaturl:8080/hudson/job/.net%20build/api
most pages in hudson shows information (about project, specific build , on) has api page if append /api/xml or /api/json end of url. reason /job/jobname/build doesn't have api page because isn't url information page.
example api requests:
xml call information project:
http://tomcaturl:8080/hudson/job/.net%20build/api/xml
json call information last successful build of project:
http://tomcaturl:8080/hudson/job/.net%20build/lastsucessfulbuild/api/json
Comments
Post a Comment