Code Monkey home page Code Monkey logo

variant-plugin's Introduction

Variant plugin

This plugin allows Jenkins plugins to behave differently based on the "environment" it is running in.

Annotations

@OptionalExtension and @OptionalPackage annotations can be used to define a set of required:

  • Plugins.
  • Classes.
  • Variants.

Optional Extension - @OptionalExtension

With this plugin, you define environment sensitive extension by marking your extension as @OptionalExtension that specifies the condition of activation.

@OptionalExtension(requirePlugins="git")
public class Foo implements ... {
   ...
}

Optional extensions can be activated by one of the following conditions:

  • Presence of plugins, identified by their short names (like "git")
  • Presence of a class
  • Presence of a "variant" in the environment.

Package for optional extension - @OptionalPackage

Activating variants

Active variants can be selected in several ways. Multiple variants can be independently activated. All of the variants activated in these different ways are combined together to form the effective variant set.

  • Via environment variable JENKINS_VARIANT. This is a whitespace separated list of variant names. This is intended for users to configure through init scripts like /etc/default/...

  • Files in the $JENKINS_HOME/variants directory. For example, if there's a file named $JENKINS_HOME/variants/cjoc, then the cjoc variant gets activated. This is also intended for users.

  • META-INF/MANIFEST.MF of jenkins.war can have the Jenkins-Variant attribute in its main section. This whitespace separated list of variant names is intended to be used by people who create custom distributions of Jenkins.

Why

This addition will allow more controlled extension enablement beyond @Extension(optional=true). For example, it is often common for a plugin to define some additional integration extension that only kicks in when another plugin is present.

Beyond that, at CloudBees, we reuse Jenkins as the platform for other Jenkins-like services. Those are built on the same Jenkins core, but they do not build and instead do other things, such as "CloudBees Jenkins Operations Center."

This mechanism also lets us define multi-modal plugin that can run in such variants and behave differently. In this way, we can use the same plugin across different variants of Jenkins, so that users can think of this as installing one plugin in the whole network of Jenkins variants.

Changelog

For recent versions, see GitHub Releases

For versions 1.2 and older, see see CHANGELOG.md

variant-plugin's People

Contributors

alvarolobato avatar andresrc avatar basil avatar batmat avatar daniel-beck avatar daniel-beck-bot avatar dependabot[bot] avatar fcojfernandez avatar jetersen avatar kohsuke avatar markewaite avatar mramonleon avatar olivergondza avatar recena avatar yunir avatar

Stargazers

 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  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.