-
Notifications
You must be signed in to change notification settings - Fork 27
Expand file tree
/
Copy path13_Input_Parameters.groovy
More file actions
40 lines (39 loc) · 1.72 KB
/
13_Input_Parameters.groovy
File metadata and controls
40 lines (39 loc) · 1.72 KB
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
// let write a bit complex one with both input and parameters.
// stage > input and parameters
pipeline {
agent any
stages {
stage ('Deploy to Dev') {
steps {
echo "Deploying to dev env Succesfully"
}
}
stage ('Deploy to Prod') {
options {
timeout(time: 600, unit: 'SECONDS')
}
input {
message "Should We Continue ???"
ok "Approved"
submitter "krish" // maha, krish , by default admins can approve, no need to provide the name here
submitterParameter "whoApproved"
parameters {
string(name: 'CHANGE_TICKET', defaultValue: 'CH12345', description: 'Please Enter Change Ticket number')
booleanParam(name: 'SRE Approved ????', defaultValue: true, description: 'Is approval taken from SRE??')
choice(name: 'Release', choices: 'Regular\nHotfix', description: 'What type of release is this ??')
text(name: 'Notes', defaultValue: "Enter release notes if any.....", description: 'Release Notes')
password(name: 'myPassword', defaultValue: 'myPasswordValue', description: 'Enter the password')
credentials(name: 'myCredentials', description: 'My Credentials stored', required: true)
}
}
steps {
echo "The Change Ticket is ${CHANGE_TICKET}"
echo "Deploying to Production"
echo "This is a ${Release} Release"
echo "Approved by ${whoApproved}"
}
}
}
}
// pipeline >> params.NAME
// stage >.>.input >>>> parameters >>> NAME