Skip to content
πŸ• Jenkins plugin to define day/time restrictions for pipelines
Java Groovy
Branch: master
Clone or download
Pull request Compare This branch is 27 commits ahead, 22 commits behind Jouda-Hidri:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
screenshots
src
.gitignore
Jenkinsfile
LICENSE
README.md
_config.yml
pom.xml

README.md

Curfew

Curfew is a Jenkins plugin that enables you to set (configurable through the UI) time restrictions, that can be applied to any stage in the pipeline, by simply calling the method curfew(). If someone triggers a Jenkins pipeline outside of your allowed timeframe, the pipeline will be aborted, unless manually approved through the UI prompt.

Contents

  1. Getting started
  2. Jenkinsfile examples
  3. Showcase

Getting started

  • Download the hpi file locally: click here
  • Go to Manage Jenkins > Manage Plugins > Advanced > Upload plugin
  • Click on choose file, navigate to where you download the .hpi file and select it. Curfew will be now installed as a plugin within Jenkins.
  • Go back to Manage Jenkins > Configure System
  • Find Curfew and set your configuration (timezone, restricted times/days).
  • In your Jenkinsfile simply call curfew at any stage

Settings example: (Mon-Thu prevent before 08:00 and after 16:00, Fri time restriction all day, no restrictions Sat-Sun). Curfew UI Demo

Jenkinsfile examples

Declarative Pipeline

pipeline {
  agent any
  stages {
    stage('curfew') {
      steps {
        script {
          curfew()
        }
      }
    }
  }
}

Scripted Pipeline

node {
  stage('curfew') {
    curfew()
  }
}

Showcase

Following you will find a demonstration of what the prompt for manual approval looks like, in case someone triggers the pipeline outside of the allowed timeframe:

Curfew UI Demo

Contact

hidrijouda@gmail.com

License

This project is licensed under the MIT License.

You can’t perform that action at this time.