Hi, @rutuparn! We are using Active Choices Parameter plugin similarly. But as files we are using build artifacts of another job. And jobs which should be in choice list contain ImageProducing
word in description.
Here is an example from our Jenkinsfile:
// Parameters for Jenkins GUI
properties([
parameters([
[$class: 'CascadeChoiceParameter',
choiceType: 'PT_SINGLE_SELECT',
name: 'ARTIFACT_PROJECT_NAME',
description: "Project for copy images from",
filterable: true,
filterLength: 1,
randomName: 'choice-parameter-9587366504630684',
script: [
$class: 'GroovyScript',
fallbackScript: [script: 'return ["Failed to load projects"]'],
script: [script: '''
def instances = []
for (instance in jenkins.model.Jenkins.instance.getAllItems()) {
if (instance.getDescription() && instance.getDescription().contains("ImageProducing")) {
instances.add(instance.displayName)
}
}
return instances
'''
]
]
],
[$class: 'CascadeChoiceParameter',
choiceType: 'PT_CHECKBOX',
description: 'Show all builds regardless its state',
filterLength: 1,
filterable: false,
name: 'SHOW_FAILED_BUILDS',
randomName: 'choice-parameter-5331064039195643',
referencedParameters: '',
script: [
$class: 'GroovyScript',
fallbackScript: [classpath: [], oldScript: '', sandbox: false, script: ''],
script: [script: '''
return ['Show all builds']
'''
]
]
],
[$class: 'CascadeChoiceParameter',
choiceType: 'PT_SINGLE_SELECT',
name: 'ARTIFACT_BUILD_NUMBER',
description: "Build number for copy images from",
referencedParameters: 'ARTIFACT_PROJECT_NAME,SHOW_FAILED_BUILDS',
filterable: true,
filterLength: 1,
randomName: 'choice-parameter-9513006304630684',
script: [
$class: 'GroovyScript',
fallbackScript: [script: 'return ["Failed to load build numbers from PROJECT_NAME"]'],
script: [script: '''
for (instance in jenkins.model.Jenkins.instance.getAllItems()) {
if (instance.displayName == ARTIFACT_PROJECT_NAME) {
def builds = []
for (def build in instance.builds) {
if (SHOW_FAILED_BUILDS == 'Show all builds') {
builds.add(build.number)
} else if (build.getResult().toString().equals("SUCCESS")) {
builds.add(build.number)
}
}
return builds
}
}
'''
]
]
],
string(name:'IMAGE_FILES', defaultValue:'internal/images/image-*.tar', description: 'This artifact will be copied from build above', trim: true)
And use the following step into pipeline to copy artifacts into workspace:
copyArtifacts filter: params.IMAGE_FILES, projectName: params.ARTIFACT_PROJECT_NAME, selector: (params.ARTIFACT_PROJECT_NAME== 'latest' ? lastSuccessful() : specific("${params.ARTIFACT_PROJECT_NAME}"))
I know, that it is not actually what you looking for, but example may be helpful.