-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmanual-input.groovy
36 lines (33 loc) · 1.32 KB
/
manual-input.groovy
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
// To include manual input in a Jenkins pipeline, you can use the input step.
// This allows the pipeline to pause and wait for a user to provide input or approve a step before proceeding.
// Here’s an example Jenkinsfile that incorporates a manual input step:
// Jenkinsfile with Manual Input
pipeline {
agent any
stages {
stage('Build') {
steps {
// This step will print 'Building...' to the console output
echo 'Building...'
// Add your build commands here, e.g., compiling code, running tests, etc.
}
}
stage('Manual Approval') {
steps {
script {
// This step pauses the pipeline and waits for user input
// The message displayed to the user is 'Approve deployment?'
// The button the user needs to click to continue is labeled 'Deploy'
input message: 'Approve deployment?', ok: 'Deploy'
}
}
}
stage('Deploy') {
steps {
// This step will print 'Deploying...' to the console output
echo 'Deploying...'
// Add your deployment commands here, e.g., deploying to a server, updating a database, etc.
}
}
}
}