Jenkins drop down list of build names of other job

I would like to list out all successfull build names in the drop down menu that got built by another job. I have seen the links to get all list of build ids in the drop down menu with parametrized and copy artifacts plugins. But I need to list with the actual build names set by Build Setter in the other job. Currently i am able to get list with #55,54,53,52.. etc., But I need to list with build names assigned to these builds that got set by build setter.

Code Snippet:

  • Dynamic version from git with go get
  • How to let Jenkins git commit only if there are changes?
  • Does Git, SVN, etc do this type of “branching & merging” or something like this?
  • Configure Jenkins to connect to BitBucket
  • Is it possible to clone a git repository, and split the clone repo, keeping track of the changes from original repo?
  • How to put jobs in a category for the Throttle Concurrent Builds plugin for Jenkins
  • import jenkins.model.Jenkins
    import hudson.model.AbstractProject
    import hudson.model.Result
    import hudson.util.RunList
    AbstractProject<?, ?> otherJob = Jenkins.getInstance().getItemByFullName("iOS_plugin-5.0-build", AbstractProject.class)
    RunList<?> builds = otherJob.getBuilds().overThresholdOnly(Result.SUCCESS)
    def list = builds.limit(5).collect { it.number }


  • Jenkins Git Branch Selection with Fallback
  • Validate certificate and provisioning profile
  • Jenkins Test Result Trend Graph Empty, but Tests Are Run
  • Jenkins / Hudson environment variables
  • Webdriver Unable to connect to host on port 7055 after 45000 ms
  • jenkins pipeline cannot check code into git
  • One Solution collect form web for “Jenkins drop down list of build names of other job”

    I can retrieve the build name (set with the Build Name Setter plugin) with the “displayName” property of the build object.

    Here is my working example, as a “Dynamic Choice Parameter” groovy plugin:

    def jobname="build-my-project"
    def list=[]
    hudson.model.AbstractProject<?, ?> otherJob = jenkins.model.Jenkins.getInstance().getItemByFullName(jobname, hudson.model.AbstractProject.class)
    hudson.util.RunList<?> builds = otherJob.getBuilds().overThresholdOnly(hudson.model.Result.SUCCESS)
    builds.limit(20).each{run -> list.add(run.displayName) }

    I hope this helps!

    Git Baby is a git and github fan, let's start git clone.