Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I'm working on setting up Jenkins to handle our release builds. A release build consists of a Windows installer that includes some binaries that must be built on Linux.

Here's what I have so far:

  • The Windows portion and Linux portion are set up as separate Jenkins projects.
  • The Windows project is parameterized, taking the Subversion tag to build and release.
  • As part of its build, the Windows project triggers a build of that same Subversion tag for the Linux project (using the Parameterized Trigger plugin) then copies the artifacts from the Linux project (using the Copy Artifact plugin) to the Windows project's workspace so that they can be included in the Windows installer.

Where I'm stuck: Right now, Copy Artifact is set up to copy the last successful build. It seems more robust to configure Copy Artifact to copy from the exact build that Parameterized Trigger triggered, but I'm having trouble figuring out how to make that work. There's an option for a "build selector" parameter that I think is intended to help with this, but I can't figure out how it's supposed to be set up (and blindly experimenting with different possibilities is somewhat painful when the build takes an hour or two to find success or failure).

How should I set this up? How does build selector work?

share|improve this question
add comment

1 Answer

up vote 3 down vote accepted

After you've completed a triggered build you'll have a new env variable set to the build number of that triggered build called TRIGGERED_BUILD_NUMBER_<job name>. You can use that to specifically copy back the artifacts:

  1. Windows build (called "WindowsBuild"), calls the Linux build (called "LinuxBuild") using the Parameterized Trigger plugin.

    You've got this part, just make sure to check Block until the triggered projects finish their builds and fail the build of course if the Linux build fails.

  2. Next in your Copy Artifacts from another project step:

    Project name: LinuxBuild

    Which build: Specific build

    Build number: $TRIGGERED_BUILD_NUMBER_LinuxBuild

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.