1

I am looking to disable a jenkins job for some amount of time like 4 hours from now.

For eg I want to disable a job for 4 hours starting from 11 am, could you please let me know whether it is possible?

Hari
  • 237
  • 1
  • 10
  • 23

3 Answers3

1

You could make two helper jobs:

  • One job that is scheduled to run at 11 am which disables the job you want and
  • Another job that runs at 15 pm which enables the job

The actual enabling and disabling of jobs is easiest to do using jenkins command line client, either the java client (https://wiki.jenkins-ci.org/display/JENKINS/Jenkins+CLI) or the ssh client (https://wiki.jenkins-ci.org/display/JENKINS/Jenkins+SSH)

At work I have set up exactly that kind of setup. I myself use the ssh client. To disable a job I use

ssh -p <jenkins ssh port> user@localhost disable-job <jobname>

It is a good idea to configure Jenkins to set up a static ssh port and set up a user with ssh key without password for this purpose.

The client command to enable a job is enable-job.

sti
  • 11,047
  • 1
  • 27
  • 27
1

You could leave the job as active and set up polling of the repository using CRONTAB syntax. The result would be the job would be non-responsive to repository commits outside the times you specify.

Simpler and achieves the same result.

Andrew Gray
  • 3,593
  • 3
  • 35
  • 62
-1

I think that the Configuration Slicing Plugin could solve your problems. This plugin performs mass configuration of select project properties, including email, timer, discard old builds, Maven configuration, disable jobs, etc..