Skip to content

Commit

Permalink
Add Platform Labeler example (#248)
Browse files Browse the repository at this point in the history
* Add Platform Labeler example to docs

Combining the implied labels plugin and platform labeler plugin can
simplify label management for agents that intentionally vary by operating
system or processor architecture.

* Remove first Platform Labeler reference
  • Loading branch information
MarkEWaite authored Dec 10, 2024
1 parent 106eb42 commit 8b50704
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ labels contributed by other implications.
## Configuration as code

Label definitions can be automated with [configuration as code](https://plugins.jenkins.io/configuration-as-code/).
The [platform labeler](https://plugins.jenkins.io/platformlabeler/) can automatically assign labels based on operating system properties and those operating system properties can be used to define more labels.

```
unclassified:
Expand All @@ -38,3 +37,26 @@ unclassified:
- 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
```

0 comments on commit 8b50704

Please sign in to comment.