forked from Praqma/drmemory-plugin
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-20222
- Loading branch information
1 parent
a83206c
commit 9bc958e
Showing
8 changed files
with
514 additions
and
514 deletions.
There are no files selected for viewing
428 changes: 208 additions & 220 deletions
428
src/main/java/net/praqma/jenkins/plugin/drmemory/DrMemoryBuildAction.java
Large diffs are not rendered by default.
Oops, something went wrong.
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
78 changes: 43 additions & 35 deletions
78
src/main/java/net/praqma/jenkins/plugin/drmemory/DrMemoryProjectAction.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 |
---|---|---|
@@ -1,61 +1,69 @@ | ||
package net.praqma.jenkins.plugin.drmemory; | ||
|
||
import java.util.logging.*; | ||
import java.io.IOException; | ||
|
||
import org.kohsuke.stapler.StaplerRequest; | ||
import org.kohsuke.stapler.StaplerResponse; | ||
|
||
import hudson.model.AbstractBuild; | ||
import hudson.model.AbstractProject; | ||
import hudson.model.Actionable; | ||
import hudson.model.ProminentProjectAction; | ||
import hudson.model.Result; | ||
|
||
public class DrMemoryProjectAction extends Actionable implements ProminentProjectAction { | ||
private final AbstractProject<?, ?> project; | ||
|
||
public DrMemoryProjectAction( AbstractProject<?, ?> project ) { | ||
this.project = project; | ||
} | ||
private final AbstractProject<?, ?> project; | ||
private static final Logger log = Logger.getLogger(DrMemoryProjectAction.class.toString()); | ||
|
||
public String getDisplayName() { | ||
return "DrMemory"; | ||
} | ||
public DrMemoryProjectAction(AbstractProject<?, ?> project) { | ||
this.project = project; | ||
} | ||
|
||
public String getSearchUrl() { | ||
return getUrlName(); | ||
} | ||
@Override | ||
public String getDisplayName() { | ||
return "DrMemory"; | ||
} | ||
|
||
public String getIconFileName() { | ||
return "graph.gif"; | ||
} | ||
@Override | ||
public String getSearchUrl() { | ||
return getUrlName(); | ||
} | ||
|
||
@Override | ||
public String getIconFileName() { | ||
return "graph.gif"; | ||
} | ||
|
||
@Override | ||
public String getUrlName() { | ||
return "drmemory"; | ||
} | ||
|
||
|
||
public String getUrlName() { | ||
return "drmemory"; | ||
} | ||
|
||
public void doGraph(StaplerRequest req, StaplerResponse rsp) throws IOException { | ||
if (getLastResult() != null) { | ||
getLastResult().doGraph(req, rsp); | ||
} | ||
} | ||
|
||
public DrMemoryBuildAction getLastResult() { | ||
for( AbstractBuild<?, ?> b = getLastBuildToBeConsidered(); b != null; b = b.getPreviousNotFailedBuild() ) { | ||
if( b.getResult() == Result.FAILURE || ( b.getResult() != Result.SUCCESS ) ) { | ||
continue; | ||
} | ||
|
||
DrMemoryBuildAction r = b.getAction( DrMemoryBuildAction.class ); | ||
if( r != null ) { | ||
return r; | ||
} | ||
} | ||
return null; | ||
} | ||
|
||
private AbstractBuild<?, ?> getLastBuildToBeConsidered() { | ||
return project.getLastSuccessfulBuild(); | ||
} | ||
public DrMemoryBuildAction getLastResult() { | ||
for (AbstractBuild<?, ?> b = getLastBuildToBeConsidered(); b != null; b = b.getPreviousNotFailedBuild()) { | ||
if (b.getResult().isBetterOrEqualTo(Result.UNSTABLE)) { | ||
log.fine( String.format( "Using build %s to draw graph", b.number) ) ; | ||
DrMemoryBuildAction r = b.getAction(DrMemoryBuildAction.class); | ||
if (r != null) { | ||
return r; | ||
} | ||
} else { | ||
continue; | ||
} | ||
} | ||
log.fine( String.format( "Found no results to draw graphs with") ) ; | ||
return null; | ||
} | ||
|
||
private AbstractBuild<?, ?> getLastBuildToBeConsidered() { | ||
return project.getLastSuccessfulBuild(); | ||
} | ||
} |
Oops, something went wrong.