1

I wanted to run a jenkins job by accepting a date and time field (in format YYYY-MM-DD hh:mm) from user.

ARUN R
  • 21
  • 1
  • 4

2 Answers2

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,757
  • 2
  • 8
  • 15
2

You can enhance the answer from @ben5556 with the date parameter plugin

Date parameter

S.Spieker
  • 6,473
  • 7
  • 45
  • 50