How to call a hudson job by another job that is in another hudson

I have job A in Hudson A and Job B in Hudson B. I want to run job A on job B.

+4
source share
5 answers

In the configuration of your task B, check the Trigger assemblies box remotely (for example, from scripts) and set the token.

The help text displays a URL that you can call to start the assembly from remote scripts (for example, from the shell script in the Hudson A task).

However, this will start task B regardless of the result of A. Morechilli's answer is probably the best solution.

+6
source

I did not use Hudson, but I would suggest that your easiest approach is to use a URL trigger:

http://wiki.hudson-ci.org/display/HUDSON/URL+Change+Trigger

I think the last assembly url can be used for this.

+5
source

In recent versions of Hudson, the lastSuccessfultBuild / HTML page will display the time since it was created, which will be different for each call. This causes the URL change trigger to rotate.

One fix is ​​to use the xml, json, or python API to request only a subset of the information. Using the tree query parameter, the following URL will return an XML document containing only the build number of the last successful build.

http: // SERVER: PORT / job / JOBNAME / lastSuccessfulBuild / api / xml? tree = number

Using this URL restored the behavior that I expected from the URL change trigger.

+4
source

Personally, I think the easiest way to do this is to look at the build time PROJECT_NAME/lastSuccessfulBuild/buildTimestamp : PROJECT_NAME/lastSuccessfulBuild/buildTimestamp

+2
source

I use wget to start the build:

 wget --post-data 'it-just-need-to-be-a-POST-request' --auth-no-challenge --http-user=myuser --http-password=mypassword http://jenkins.xx.xx/xxx/job/A/build?delay=0sec 

For other ways on how you can run the build, see REST and other jenkins APIs. But this works fine on unix.

+1
source

Source: https://habr.com/ru/post/1302471/


All Articles