Skip to content

Commit

Permalink
Adds information about troubleshooting (#42)
Browse files Browse the repository at this point in the history
  • Loading branch information
damianszczepanik authored Feb 5, 2021
1 parent 251ca7b commit 497dc83
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ The motivation of creating this plugin is to deliver powerful tool that allows t

### Examples

#### retain most recent broken build
#### Retain most recent broken build

Following configuration has two rules. First one makes sure that the newest build with `failure` status is not deleted.
Second deletes all builds which are not `success`. In other words it keeps the most recent broken build and all stables.
Expand Down Expand Up @@ -55,7 +55,7 @@ pipeline {
}
```

#### remove builds based on a parameter
#### Remove builds based on a parameter

Following configuration has three rules. The first uses the token macro condition to test
the value of a parameter. It removes jobs where the string value of `ENABLE_HISTORY` is "false". The second rule will preserve the last 24 builds that do not match the first rule. The third rule deletes the remainder of jobs. Thus the three rules work together to preserve the last 24 builds where `ENABLE_HISTORY` is true.
Expand Down Expand Up @@ -121,6 +121,9 @@ Check also information how to [avoid problems](https://github.com/jenkinsci/buil
There is possibility to build complex rules. Each [rule](./src/main/java/pl/damianszczepanik/jenkins/buildhistorymanager/model/Rule.java) can define more than single condition and action.
Plugin starts as [BuildDiscarder](https://javadoc.jenkins.io/jenkins/model/BuildDiscarder.html) class. Core method that is responsible for processing conditions and actions are stored in [Rule.perform()](./src/main/java/pl/damianszczepanik/jenkins/buildhistorymanager/model/Rule.java) method.

### Troubleshooting
Plugin performs when the builds end. It is not connected to any particular run (like last completed job) which might be deleted by some actions. It logs helpful messages to [Jenkins logs](https://www.jenkins.io/doc/book/system-administration/viewing-logs/).

### Configuration
![feature overview page](./.README/configuration.png)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public List<Rule> getRules() {
@Override
public synchronized void perform(Job<?, ?> job) throws IOException, InterruptedException {
String uniquePerformName = job.getFullName();
LOG.info(uniquePerformName + ": start evaluating build history");
LOG.info(uniquePerformName + ": Start evaluating build history");

// reset counters of matched builds
for (Rule rule : rules) {
Expand All @@ -53,7 +53,7 @@ public synchronized void perform(Job<?, ?> job) throws IOException, InterruptedE
while (run != null) {
LOG.info(uniquePerformName + ": Processing build #" + run.getNumber());
if (run.isKeepLog()) {
LOG.info(uniquePerformName + ": build #" + run.getNumber() + " is marked as keep forever -> skipping");
LOG.info(uniquePerformName + ": Build #" + run.getNumber() + " is marked as keep forever -> skip processing");
} else {
for (int i = 0; i < rules.size(); i++) {
Rule rule = rules.get(i);
Expand Down
2 changes: 0 additions & 2 deletions src/main/resources/index.jelly
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,4 @@
Visit
<a href="https://github.com/jenkinsci/build-history-manager-plugin/wiki">wiki</a>
to check list of available features.
<br/>
<font color="red">New plugin</font>
</div>

0 comments on commit 497dc83

Please sign in to comment.