jenkins-api

How to check disabled jobs with Jenkins server?

假如想象 提交于 2019-12-13 14:17:50
问题 I am using Jenkins to run tests on my servers. So I created a job for each server and I run the test on the job, and I would like to know with simple bash script if my specific job is disabled/enabled? I can ssh to Jenkins server and I want to run that script from there how I can do that? 回答1: See http://<Your Jenkins>/api and http://<Your Jenkins>/api/xml : <hudson> ... <job> <name>...your job name...</name> ... <color>disabled</color> </job> ... For a job's description see http://<Your

Pure Java REST API POST calls to Jenkins /reload or /restart always return status 403 forbidden, but work

狂风中的少年 提交于 2019-12-13 03:52:40
问题 I'm getting an Exception when running this, but Jenkins actually executes the requested action : URL url = new URL("https://somehost.com/jenkins/quietDown"); HttpURLConnection c= (HttpURLConnection) url.openConnection(); c.setRequestMethod("POST"); c.setRequestProperty("Authorization", "Basic " + Base64.getEncoder().encodeToString(("user:apiToken").getBytes())); c.getInputStream().close(); Exception: Exception in thread "main" java.io.IOException: Server returned HTTP response code: 403 for

Call to JenkinsAPI(https) just hangs

家住魔仙堡 提交于 2019-12-11 05:46:49
问题 My code is given below from jenkinsapi.jenkins import Jenkins def get_server_instance(): jenkins_url = 'https://<privateJenkinsServer>:<port>' print "Hello" server = Jenkins(jenkins_url, username = 'foouser', password = 'foopassword') return server if __name__ == '__main__': print get_server_instance().version When I execute this, it just prints "Hello" and then hangs. What could be the reason for this ? N.B. I am running this in my corporate network behind a proxy. Reference: http:/

Please clarify: Jenkins REST API with CSRF needs crumbs for user:PASSWORD, but not user:API_TOKEN?

↘锁芯ラ 提交于 2019-12-10 22:39:02
问题 I found that with CSRF Protection enabled, i can either issue a post request with crumbs header and using username:PASSWORD for the basic auth header: String basic = "<username>:<PASSWORD>"; HttpURLConnection c = (HttpURLConnection) new URL("https://host.com/jenkins/quietDown").openConnection(); c.setInstanceFollowRedirects(false); c.setRequestMethod("POST"); c.addRequestProperty("Jenkins-Crumb", "<CRUMB>"); c.addRequestProperty("Authorization", "Basic " + Base64.getEncoder().encodeToString

Is there any Jenkins API to get artifacts name and download it? [closed]

南楼画角 提交于 2019-12-06 02:05:15
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed last year . I want to ask, If I use jenkins. How can I get all artifacts list and download it, but not from jenkins web interface. I want to make my own web interface for certain goals. Is there any jenkins API to do this? 回答1: According to this answer: https://superuser.com/questions/587426/download-a-file-from-the-latest

Is there any Jenkins API to get artifacts name and download it? [closed]

大兔子大兔子 提交于 2019-12-04 05:45:13
I want to ask, If I use jenkins. How can I get all artifacts list and download it, but not from jenkins web interface. I want to make my own web interface for certain goals. Is there any jenkins API to do this? Bruno Lavit According to this answer: https://superuser.com/questions/587426/download-a-file-from-the-latest-stable-jenkins-build You can use the Jenkins API to get the list of artifacts: http:// your.jenkins.server /job/ your.job /lastStableBuild/api/xml?tree=artifacts%5BrelativePath%5D With a script, you can extract the artefact relative path: Next, you can build your download URLs

Modifying Jenkins Description for a build

社会主义新天地 提交于 2019-12-02 10:20:02
问题 I would like to remotely change a Jenkins build description. I have my script all set and ready except for one tiny problem: Multiple line descriptions. I am using the REST API and JSON in Jenkins to download the old description: old_description=$(curl -s --user "$USER:$PASSWORD" --data-urlencode "tree=description" \ "$jenkins_url/job/$job_name/$build_number/api/json") old_description=${old_description#*:\"} #Remove JSON garbage old_description=${old_description%\"\}} #Remove JSON garbage The

Modifying Jenkins Description for a build

最后都变了- 提交于 2019-12-02 07:28:41
I would like to remotely change a Jenkins build description. I have my script all set and ready except for one tiny problem: Multiple line descriptions. I am using the REST API and JSON in Jenkins to download the old description: old_description=$(curl -s --user "$USER:$PASSWORD" --data-urlencode "tree=description" \ "$jenkins_url/job/$job_name/$build_number/api/json") old_description=${old_description#*:\"} #Remove JSON garbage old_description=${old_description%\"\}} #Remove JSON garbage The `curl command pulls out: <font color=blue><b>At first you don't succeed. Try again</b></font><br/> \r

Create jobs and execute them in jenkins using REST

只愿长相守 提交于 2019-11-29 23:16:22
I am trying to create a WCF REST client that will communicate to Jenkins and create a job from an XML file and then build the job. My understanding is that you can do that with Jenkins. Can some one please provide some commands that you can type on a browser's address bar to create and build jobs? ie: http:localhost/jenkins/createItem?name=TESTJOB something along those lines. See the Jenkins API Wiki page (including the comments at the end). You can fill in the gaps using the documentation provided by Jenkins itself; for example, http://JENKINS_HOST/api will give you the URL for creating a job