-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
46 lines (40 loc) · 1.47 KB
/
Jenkinsfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
pipeline {
agent any
stages {
stage('List Successful Builds') {
steps {
script {
def successfulBuildNumbers = []
// Get the list of successful build numbers
def builds = Jenkins.instance.getItemByFullName('<your-job-name>').getBuilds().findAll { it.getResult().equals(hudson.model.Result.SUCCESS) }
builds.each { build ->
successfulBuildNumbers.add(build.getNumber().toString())
}
// Prompt the user to select a build number
def userInput = input(
id: 'buildNumber',
message: 'Select a successful build number:',
parameters: [
choice(
choices: successfulBuildNumbers,
description: 'Build Number'
)
]
)
// Use the selected build number in subsequent stages
echo "Selected build number: ${userInput}"
}
}
}
// Add more stages as needed
}
// Add post actions or notifications as needed
post {
success {
echo 'Pipeline completed successfully!'
}
failure {
echo 'Pipeline failed!'
}
}
}