jenkins-cli

Query for last successful build number in Jenkins with change

≯℡__Kan透↙ 提交于 2019-12-05 06:48:29
Example: 32 - fail 31 - stable no change (triggered by parent) 30 - stable with changes 29 - fail ... I want a query to return 30 So far what I got: To query the last stable build number: http://jenkins/job/project_name/lastStableBuild/buildNumber This returns 31 . Not exactly what I need. To check if this build has changes, the only way I know is : http://jenkins/job/project_name/31/api/json Then I need to go inside the huge JSON and check if any item in changeSet > items. Is there a easier way to query for the latest stable build with changes (30) ? Jenkins' Remote access API with: http:/

Updating Jira tickets from Jenkins workflow (jenkinsfile)

流过昼夜 提交于 2019-12-05 01:08:15
问题 How can I update a jira issue from within a Jenkinsfile (jenkins-worflow/pipeline)? Is there a way I could use the Jira Issue Updater plugin as a step in the Jenkinsfile? I know I could use the Jira RestAPI, but I'm trying to figure out if I can re-use the functionality provided by the jira-updater-issue. What I'm looking for is a something similar to the example below calling Junit archiver, and atifact archiver, but calling jira updater. node { git url: 'https://github.com/jglick/simple

Execute Shell script from workspace on remote machine after build successful (Jenkins)

限于喜欢 提交于 2019-12-04 11:48:31
问题 The scenario is - I have a job A which runs my ant script and packages the artifact's for me. I am also using parametrized Triggered plug in to Trigger my "Job B" which will deploy my artifact on remote machine. The job A is working fine and also Job B. The tasks that i have to perform with Job B are GIT checkout (which contains my deployment scripts) (successfully doning). Copying artifacts from previous build to Remote machine. (successfully doing) Run shell script on remote machine(script

Updating Jira tickets from Jenkins workflow (jenkinsfile)

前提是你 提交于 2019-12-03 16:50:47
How can I update a jira issue from within a Jenkinsfile (jenkins-worflow/pipeline) ? Is there a way I could use the Jira Issue Updater plugin as a step in the Jenkinsfile? I know I could use the Jira RestAPI, but I'm trying to figure out if I can re-use the functionality provided by the jira-updater-issue . What I'm looking for is a something similar to the example below calling Junit archiver, and atifact archiver, but calling jira updater. node { git url: 'https://github.com/jglick/simple-maven-project-with-tests.git' def mvnHome = tool 'M3' sh "${mvnHome}/bin/mvn -B -Dmaven.test.failure

How to increase jenkins build number automatically?

浪子不回头ぞ 提交于 2019-12-03 14:22:45
How to increase jenkins build number automatically or by using shell script?? For now i am doing the same using configure option, and increasing manually. i want to do it automatically. What you are asking for (i.e. keeping the build number same between multiple jobs) is simply impossible in Jenkins. This is done by design (as noted by Jenkins creator himself): "[JENKINS] assumes that the build number is unique and monotonic." . You can change it to a higher value, but changing it to same number will outright break Jenkins and is therefore not possible. Build run number is just that: a run

How can I get jenkins-cli.jar to use my ssh agent/keychain?

孤人 提交于 2019-12-03 07:17:12
I'm using the jenkins-cli.jar file from my jenkins server, and on every run it prompts me for my ssh key passphrase. I'd like it to use my ssh keychain so I don't have to enter it on every invocation. If it matters, I'm on OSX using the default keychain setup, I don't have a manual ssh-agent configured right now. Jenkins CLI client does not support SSH agents for now. As a workaround, you can generate dedicated key without passphrase, associate it with your Jenkins account and instruct client to use that key on every invocation. 来源: https://stackoverflow.com/questions/30806578/how-can-i-get

Execute Shell script from workspace on remote machine after build successful (Jenkins)

二次信任 提交于 2019-12-03 06:33:38
The scenario is - I have a job A which runs my ant script and packages the artifact's for me. I am also using parametrized Triggered plug in to Trigger my "Job B" which will deploy my artifact on remote machine. The job A is working fine and also Job B. The tasks that i have to perform with Job B are GIT checkout (which contains my deployment scripts) (successfully doning). Copying artifacts from previous build to Remote machine. (successfully doing) Run shell script on remote machine(script present in workspace folder )- Facing issues. I browsed various plug ins for the same but no one is

Jenkins 0 files published after build

徘徊边缘 提交于 2019-12-02 06:56:06
问题 I have a Jenkins server setup with two jobs first job polls the develop branch and builds the project on the jenkins server. i then have another job that polls the production branch this builds this branch on another jenkins slave which is the staging server. This job is configured so that on a successful build it should publish the artefacts over ssh to the production server. All the SSh keys are setup and the staging server connects to production server but 0 files are transferred using GIT

How do I get a list of jobs with longest build time in Jenkins

安稳与你 提交于 2019-12-01 17:51:19
问题 I need to generate a weekly report on our Jenkins build cluster. One of the reports is to display a list of jobs that have the longest build time. The solution I can come up with is to parse the "Build history" page on each slave (also master) and for each build of a job, parse the build page and look for "Took x min x sec on slave-xx". This feels quite cumbersome, does anyone know a better solution using Jenkins API or Groovy script console? Thanks 回答1: You can get the build data for your

How to remotely login to a Jenkins server using Java?

有些话、适合烂在心里 提交于 2019-12-01 12:05:11
I'm trying to login remotely to a Jenkins server using Java. I didn't found some documentation on how this should be securely done. For my local server using the url: http://user:pass@server doesn't work . Can anybody recommend me some documentation regarding this topic ? Documention from jenkins wiki Should work with your Basic Authentication type. Java example with httpclient 4.3.x import java.io.IOException; import java.net.URI; import org.apache.http.HttpHost; import org.apache.http.HttpResponse; import org.apache.http.auth.AuthScope; import org.apache.http.auth.UsernamePasswordCredentials