An open API service indexing awesome lists of open source software.

https://github.com/jenkinsci/implied-labels-plugin

Create agent labels based on user defined expressions
https://github.com/jenkinsci/implied-labels-plugin

adopt-this-plugin

Last synced: 2 months ago
JSON representation

Create agent labels based on user defined expressions

Awesome Lists containing this project

README

          

# Implied Labels Plugin

Infer dynamic node labels using configured implications.

Lets have a node with `linux`, `RHEL`, `RHEL8` and `RHEL8_5` labels.
Most of this information is redundant and can be inferred from the `RHEL8_5`
label. Here is an excerpt of the Implied Labels Plugin configuration to do
just that.

![](docs/images/implied-labels.png)

This plugin gathers the implication rules to one place (*Manage Jenkins
\> Label implications*), so explicit node labels can be defined in more
concise form (without redundancy). Implications are readable for every
user with `Jenkins.READ`, but only `Jenkins.ADMINISTER` is authorized to
configure. The plugin also detects explicitly configured node labels that
can be inferred using existing implication rules.

## Details

Jenkins administrators can declare any number of implication rules for
label inference. An implication consists of *label expression* and *atom
list*. A node that matches *label expression* will have assigned new
labels from *atom list*. Labels contributed from the Implied Labels Plugin
are dynamic labels and thus not saved in configuration. Implications are
evaluated in topological order so implication expressions can refer to
labels contributed by other implications.

## Configuration as code

Label definitions can be automated with [configuration as code](https://plugins.jenkins.io/configuration-as-code/).

```
unclassified:
impliedLabels:
implications:
- atoms: "linux"
expression: "Ubuntu || CentOS || Debian || Rocky || openSUSE"
```

When combined with the [Platform Labeler plugin](https://plugins.jenkins.io/platformlabeler/), the implied labels can use the labels generated by the Platform Labeler plugin.
Here is an example that combines the two plugins to apply the `linux` label to an operating system based on its name.

```yaml
unclassified:
impliedLabels:
implications:
- atoms: "linux"
expression: "Alpine||Amazon||Debian||Fedora||openSUSE||Raspbian||RedHatEnterprise||Rocky||SUSE||Ubuntu"
- atoms: "Unix"
expression: "linux||freebsd"
platformLabelerGlobalConfiguration:
labelConfig:
architecture: true
architectureName: false
architectureNameVersion: false
name: true
nameVersion: false
osName: true
version: true
windowsFeatureUpdate: false
```