I wanted to run a jenkins job by accepting a date and time field (in format YYYY-MM-DD hh:mm) from user.
Asked
Active
Viewed 5,612 times
1
-
It is a kind of duplicate, but the answers of the linked question are a little outdated. – S.Spieker Oct 31 '18 at 09:26
2 Answers
4
Use parameterized build to get user input at the start of your job. https://wiki.jenkins.io/display/JENKINS/Parameterized+Build
Sample pipeline
pipeline {
agent {label 'slave'}
parameters {
string(name: 'DateTime', defaultValue: '', description: 'Enter date & time in format YYYY-MM-DD hh:mm')
}
stages {
stage('Build') {
steps {
// Build
}
}
}
}

ben5556
- 2,915
- 2
- 11
- 16