jenkins-cli

Jenkins Add permissions to jobs using groovy

北城余情 提交于 2019-12-01 11:49:32
问题 I need to add some permissions (Read, Build, Workspace, cancel etc) to a spesific user to a lot of jobs. I'm wondering it there is a way to do that using groovy script instead of doing it manually. 回答1: As far as I know what you are trying to do is not possible. Link: https://wiki.jenkins-ci.org/display/JENKINS/Matrix-based+security I would recommend using 'configuration slicing' if there is a change that you want to apply to multiple jobs at the same time. https://wiki.jenkins-ci.org/display

creating jenkins jobs with ansible

不羁岁月 提交于 2019-12-01 05:58:31
I'm working on a project to deploy a jenkins CI server on centos7 using ansible And I'm having problems creating jenkins jobs from an xml template using ansible. Everything works fine so far, but now i want to be able to create jobs, and give them some basic configuration from an xml file using ansible. My solution was the following command from jenkins-cli: sudo java -jar jenkins-cli.jar -s http://localhost:8080 create-job Job_test1 < Job_test1.xml this works perfectly when entered manually in the centos7 box, but when i put it into ansible and run it: - name: create jenkins jobs with xml

Jenkins command to get number of builds in queue

你说的曾经没有我的故事 提交于 2019-11-30 17:40:28
I am trying to get the number of builds in the Jenkins Build Queue. May I know the Jenkins command to get the number of builds running in the queue ? See Jenkins' Remote access API. Access the API description with: http://<Your Jenkins>/api/ and the actual data with: http://<Your Jenkins>/api/xml The Build queue has its own separate API: http://<Your Jenkins>/queue/api/ with its data: http://<Your Jenkins>/queue/api/xml That's easy to do with Jenkins Script Console : println Hudson.instance.queue.items.length // => 2 Also that's possible to execute groovy script remotely. For example, from

Jenkins command to get number of builds in queue

时光毁灭记忆、已成空白 提交于 2019-11-30 01:11:48
问题 I am trying to get the number of builds in the Jenkins Build Queue. May I know the Jenkins command to get the number of builds running in the queue ? 回答1: See Jenkins' Remote access API. Access the API description with: http://<Your Jenkins>/api/ and the actual data with: http://<Your Jenkins>/api/xml The Build queue has its own separate API: http://<Your Jenkins>/queue/api/ with its data: http://<Your Jenkins>/queue/api/xml 回答2: That's easy to do with Jenkins Script Console: println Hudson

Check Jenkins job status after triggering a build remotely

丶灬走出姿态 提交于 2019-11-28 10:05:55
I have a script to trigger a job on Jenkins remotely using a token. Here is my script: JENKINS_URL='http://jenkins.myserver.com/jenkins' JOB_NAME='job/utilities/job/my_job' JOB_TOKEN='my_token' curl "${JENKINS_URL}/${JOB_NAME}/buildWithParameters?token=${JOB_TOKEN}" After I run it, I get following response: * Hostname was NOT found in DNS cache * Trying 10.5.187.225... * Connected to jenkins.myserver.com (10.5.187.225) port 80 (#0) > GET /jenkins/job/utilities/job/my_job/buildWithParameters?token=my_token HTTP/1.1 > User-Agent: curl/7.37.1 > Host: jenkins.myserver.com > Accept: */* > < HTTP/1

Same workspace for multiple jobs

房东的猫 提交于 2019-11-28 03:45:38
I have a job called "development" and another project called "code analysis". At the moment we have two different jobs and different workspaces, but same code; is there any way we could use the same workspace for multiple jobs? I checked the plugins available in Jenkins but I haven't found any suitable one. Dipu H Suppose your "development" Jenkins job workspace is /var/workspace/job1 . In the "code analysis" job configuration page, under the tab General click on Advanced... and select the option Use custom workspace and give the same workspace /var/workspace/job1 as of your "development" job.

How can I create parameterized Jenkins job?

五迷三道 提交于 2019-11-28 01:27:51
问题 I want to use same job in different machine. But I don't want to change the configuration of the job each time. Can I pass the machine name label as parameter and run the job in different machine ? (Not simultaneously). I want to pass parameters while running a job to the script which I have written in th configuration (batch script). Can we do that ? Can I get a return value from a job and use it in next job? 回答1: Yes, you can pass a node label parameter with NodeLabel Parameter Plugin. Yes,

Jenkins-Build when a change is pushed to GitHub option is not working

…衆ロ難τιáo~ 提交于 2019-11-27 11:40:35
Jenkins is running on localhost. I have my repository in GitHub. I have the option to 'Build when a change is pushed to GitHub' checked. When I click 'Build Now', build is done successfully, no issues there. But when am committing code to my repository, auto build is not happening. I can access GitHub from my system as the repository is public and I believe even Jenkins should be able to detect it. I know there is a polling option but I want Jenkins to build when change is detected in repository(as this is what we have been trying to achieve). Configuration: Jenkins 1.615 Git Plugin 2.3.5 Git

Same workspace for multiple jobs

孤人 提交于 2019-11-27 05:13:16
问题 I have a job called "development" and another project called "code analysis". At the moment we have two different jobs and different workspaces, but same code; is there any way we could use the same workspace for multiple jobs? I checked the plugins available in Jenkins but I haven't found any suitable one. 回答1: Suppose your "development" Jenkins job workspace is /var/workspace/job1 . In the "code analysis" job configuration page, under the tab General click on Advanced... and select the

Check Jenkins job status after triggering a build remotely

为君一笑 提交于 2019-11-27 03:26:49
问题 I have a script to trigger a job on Jenkins remotely using a token. Here is my script: JENKINS_URL='http://jenkins.myserver.com/jenkins' JOB_NAME='job/utilities/job/my_job' JOB_TOKEN='my_token' curl "${JENKINS_URL}/${JOB_NAME}/buildWithParameters?token=${JOB_TOKEN}" After I run it, I get following response: * Hostname was NOT found in DNS cache * Trying 10.5.187.225... * Connected to jenkins.myserver.com (10.5.187.225) port 80 (#0) > GET /jenkins/job/utilities/job/my_job/buildWithParameters