Coder Social home page Coder Social logo

jenkinsci / run-condition-plugin Goto Github PK

View Code? Open in Web Editor NEW
7.0 98.0 26.0 308 KB

Allow plugins to define new run conditions that decide whether to run a build step

Home Page: https://plugins.jenkins.io/run-condition/

Java 90.69% HTML 9.31%
adopt-this-plugin hacktoberfest

run-condition-plugin's Introduction

Run condition plugin

Features

This plugin defines an ExtensionPoint that can be used by plugins to define new Run Conditions and to use Run Conditions to decide whether to run a build step.

This plugin defines a few core Run Conditions:

  • Always / Never
    The always and Never conditions can be used to disable a build step from the job configuration without losing the current configuration for that build step
  • Boolean condition
    Run the step if a token expands to a representation of true (or the string "run")
  • Current status
    Run the build step if the current build status is within the configured range
  • File exists / Files match
    Run the step if a file exists, or at least one file matches a pattern.
  • Strings match
    Run if the two strings are the same
  • Numerical comparison
    Run the build step depending on the result of comparing two numbers. Very useful with tokens provided by the "Static Code Analysis Plug-ins" that were integrated into the Warnings Next Generation
  • Regular expression match
    Provide a regular expression and a label. The build step will run if the expression matches the label. Both the expression and the label are expanded with the Token Macro Plugin enabling a dynamic (parameterized) regex, label or both.
  • Time / Day of week
    Only run during a specified period of the day, or day of the week.
  • And / Or / Not
    Logical operations to enable the combining and sense inversion of Run Conditions
  • Build Cause
    Run the build step depending on the cause of the build e.g. triggered by timer, user, scm-change,...
  • Script Condition
    Use shell script to decide whether a step should be skipped
  • Windows Batch Condition
    Use windows batch to decide whether a step should be skipped 

Run Conditions are currently used in the following plugins

  • Build Keeper Plugin — Select a policy for automatically marking builds as "keep forever" to enable long term analysis trending when discarding old builds - or use to protect logs and artifacts from certain builds
  • Conditional BuildStep Plugin — A buildstep wrapping any number of other buildsteps, controlling their execution based on a defined condition.
  • Run Condition Extras Plugin — This plugin provides additional run conditions and integrations for Run Condition Plugin

Install

This plugin is used by other plugins and will be installed automatically when one of those is installed from the Update Center.

To install manually, download the latest plugin from http://mirrors.jenkins-ci.org/plugins/run-condition/ and use the Upload Plugin option in the Advanced tab of the Plugin Manager.
If you do install manually, you will need to also install the Token Macro Plugin from http://mirrors.jenkins-ci.org/plugins/token-macro/.

Examples

Example: Control execution by a string parameter

... this one gets executed if 'SOME_ENV' (any environment variable) matches the string 'MyEnvValue'. As any build parameter gets exposed as an environment variable, the value can be controlled by a parameter.

Control execution by a string parameter

Example: Run a build step if a file does not exist

Use the logical Not condition, and inside, select File exists

Run a build step if a file does not exist

Example: Use a parameterised build to select which publishers to run

I.e. Set string parameter on a parameterized build to ^(UAT|DEMO)$ to run all steps that are labeled with either DEMO or UAT

Use a parameterised build to select which publishers to run

Example: Only publish junit reports if we have some result files

Only publish junit reports if we have some result files

Example: Only sound the sirens during work hours

Add an And condition and then add Time and Day of week conditions to it

Only sound the sirens during work hours

How to contribute a RunCondition to the Run Condition Plugin

This plugin provides an ExtensionPoint which enables other plugins to provide new Run Conditions to plugins that use them.
There is an example plugin on GitHub. run-cond-eg-help
This is the RunCondition ExtensionPoint.
This one file contains all of the java code in the Example plugin.
And this is the XML for the view

Changelog

For recent versions, see GitHub Releases
For versions 1.0 and older, see the CHANGELOG.md

run-condition-plugin's People

Contributors

aayushsaini101 avatar bap2000 avatar bishal7679 avatar cjo9900 avatar dependabot[bot] avatar gounthar avatar greybird avatar imod avatar iqbalrohail avatar jmmeessen avatar markewaite avatar ndeloof avatar oleg-nenashev avatar olivergondza avatar sghill-rewrite avatar timja avatar yunir avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.