Parameter List in Jenkins to display list of build numbers from another build

Using the Dynamic Parameters plugin

In your promote job:

  • [x] This build is parameterized
  • Add Parameter
  • Dynamic Choice Parameter
  • Set Name to whatever
  • Paste below into Choices Script
import jenkins.model.Jenkins
import hudson.model.AbstractProject
import hudson.model.Result
import hudson.util.RunList

AbstractProject<?, ?> otherJob = Jenkins.getInstance().getItemByFullName("otherJobName", AbstractProject.class)
RunList<?> builds = otherJob.getBuilds().overThresholdOnly(Result.SUCCESS)

def list = builds.limit(5).collect { it.number }

Screenshot from wiki page:

Screenshot