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:

  • Create job in jenkins with calling svn and maven
  • How to version control out-of-source build directory using CMake and SVN
  • Jenkins Multibranch Pipelines - Configuring properties in branches?
  • Solving undefined reference library linking error in gcc
  • netbeans cordova- error while building my project
  • How to organize full build pipeline with Gulp, Maven and Jenkins, all the way to integration tests?
  • 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 path to git Windows master / Linux slave
  • Jenkins Git plugin with https
  • Hudson : “yes: standard output: Broken pipe”
  • Deploying Maven artifact to multiple repositories with different settings
  • Ivy, Ant, Jenkins - Is it good idea to to a <ivy:cleancache> on Jenkins builds?
  • stderr: fatal: Couldn't find remote ref $GERRIT_REFSPEC
  • 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.