Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
[FIXED JENKINS-24046]
Warn users if the pinning is preventing Jenkins from overwriting older versions with bundled versions.
- Loading branch information
Showing
6 changed files
with
138 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
core/src/main/java/jenkins/diagnostics/PinningIsBlockingBundledPluginMonitor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package jenkins.diagnostics; | ||
|
||
import com.google.common.collect.ImmutableList; | ||
import hudson.Extension; | ||
import hudson.PluginWrapper; | ||
import hudson.model.AdministrativeMonitor; | ||
import jenkins.model.Jenkins; | ||
|
||
import javax.inject.Inject; | ||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
/** | ||
* Fires off when we have any pinned plugins that's blocking upgrade from the bundled version. | ||
* | ||
* @author Kohsuke Kawaguchi | ||
*/ | ||
@Extension | ||
public class PinningIsBlockingBundledPluginMonitor extends AdministrativeMonitor { | ||
@Inject | ||
Jenkins jenkins; | ||
|
||
private List<PluginWrapper> offenders; | ||
|
||
@Override | ||
public boolean isActivated() { | ||
return !getOffenders().isEmpty(); | ||
} | ||
|
||
private void compute() { | ||
List<PluginWrapper> offenders = new ArrayList<PluginWrapper>(); | ||
for (PluginWrapper p : jenkins.pluginManager.getPlugins()) { | ||
if (p.isPinningForcingOldVersion()) | ||
offenders.add(p); | ||
} | ||
this.offenders = ImmutableList.copyOf(offenders); | ||
} | ||
|
||
public List<PluginWrapper> getOffenders() { | ||
if (offenders==null) | ||
compute(); | ||
return offenders; | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
...rc/main/resources/jenkins/diagnostics/PinningIsBlockingBundledPluginMonitor/message.jelly
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?jelly escape-by-default='true'?> | ||
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form"> | ||
<div class="warning"> | ||
<p> | ||
${%blurb} | ||
</p> | ||
<ul> | ||
<j:forEach var="p" items="${it.offenders}"> | ||
<li>${p.longName}</li> | ||
</j:forEach> | ||
</ul> | ||
</div> | ||
</j:jelly> |
3 changes: 3 additions & 0 deletions
3
...in/resources/jenkins/diagnostics/PinningIsBlockingBundledPluginMonitor/message.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
blurb=The following plugins are currently pinned, and \ | ||
this prevents Jenkins from using a newer version that''s bundled in the core. \ | ||
We recommend you to <a href="pluginManager/">unpin these plugins</a>: |