Clinton Ndegwa
Clinton Ndegwa

Reputation: 1

I have Job A and B in Jenkins. How can I always execute a file in the most recent build of A in the build steps in job B

I have these Jenkins jobs A and B. Job A Builds a bunch of Files for my project. In Job B i wanna execute a command to run a file in the most recent build of job A. My execution even works fine, but only because I have hard coded the build number and I am picking that from the files stored by Jenkins in my C:JenkinsData Directory, I would wanna have that called from the Workspace instead See image for clarification. Jenkins build steps illustration

For e.g my last build right now is 70 I want to know how I can be always executing those same files but in the most recent Build

Or if its even way better Can I execute those same file from Job A since the built files are in the Workspace.

Upvotes: 0

Views: 163

Answers (1)

knrf
knrf

Reputation: 89

You could get the last build index using this API and "number" property: /lastBuild/api/json

ie: http://localhost:8080/job/yourJobName/lastBuild/api/json

This could help: Jenkins - Get last completed build status

Upvotes: 0

Related Questions