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
  • 31
  • 1
  • 5

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,915
  • 2
  • 11
  • 16
2

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

Date parameter

S.Spieker
  • 7,005
  • 8
  • 44
  • 50