Skip to content

Commit

Permalink
Update example 2
Browse files Browse the repository at this point in the history
  • Loading branch information
MarkEWaite committed Oct 8, 2024
1 parent ef5babc commit 682e3e0
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -139,12 +139,16 @@ if(manager.logContains(".*uses or overrides a deprecated API.*")) {
#### Example 2

Suppose we have a parameterized build, which uses the boolean parameter *storeToDB* in order to instruct the build to store some artifacts into the database.
The script below puts a badge next to the builds for which this parameter is set.
The script below puts a badge next to the builds for which this parameter is set with short text.

```groovy
if("true".equals(manager.build.buildVariables.get("storeToDB"))) {
manager.addBadge("db_in.gif", "Stored to DB")
// Declarative Pipeline script block
if (params.storeToDB) {
manager.addBadge("db_in.gif", "Stored in DB")
} else {
manager.addBadge("delete.gif", "Not stored in DB")
}
manager.addShortText(params.storeToDB ? "In DB" : "Not in DB")
```

![](docs/images/example2.png)
Expand Down

0 comments on commit 682e3e0

Please sign in to comment.