Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[JENKINS-67870] Add project action Latest Dependency-Check
To improve accessibility to the latest dependency check report add a new action on the main job page as for the "Last Test Result" that leads to the last dependency-check.
- Loading branch information
Showing
3 changed files
with
86 additions
and
1 deletion.
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
53 changes: 53 additions & 0 deletions
53
src/main/java/org/jenkinsci/plugins/DependencyCheck/ResultProjectAction.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,53 @@ | ||
/* | ||
* This file is part of Dependency-Check Jenkins plugin. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package org.jenkinsci.plugins.DependencyCheck; | ||
|
||
import hudson.model.Action; | ||
import hudson.model.Job; | ||
|
||
/** | ||
* Action attached to project to link latest dependency-check report. | ||
* | ||
* @author Nikolas Falco | ||
* @since 5.1.3 | ||
*/ | ||
public class ResultProjectAction implements Action { | ||
|
||
/** | ||
* Project that owns this action. | ||
*/ | ||
public final Job<?,?> job; | ||
|
||
public ResultProjectAction(Job<?,?> job) { | ||
this.job = job; | ||
} | ||
|
||
@Override | ||
public String getIconFileName() { | ||
return null; | ||
} | ||
|
||
@Override | ||
public String getDisplayName() { | ||
return "Dependency-Check"; | ||
} | ||
|
||
@Override | ||
public String getUrlName() { | ||
return null; | ||
} | ||
|
||
} |
28 changes: 28 additions & 0 deletions
28
src/main/resources/org/jenkinsci/plugins/DependencyCheck/ResultProjectAction/jobMain.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,28 @@ | ||
<!-- | ||
This file is part of Dependency-Check Jenkins plugin. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
--> | ||
<?jelly escape-by-default='true'?> | ||
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:t="/lib/hudson" xmlns:test="/lib/hudson/test"> | ||
<table style="margin-top: 1em; margin-left: 1em;"> | ||
<j:set var="tr" value="${it.job.lastCompletedBuild.getAction(it.class.classLoader.loadClass('org.jenkinsci.plugins.DependencyCheck.ResultAction'))}"/> | ||
<j:if test="${tr != null}"> | ||
<t:summary icon="/plugin/dependency-check-jenkins-plugin/icons/dependency-check-icon.svg"> | ||
<a href="lastCompletedBuild/${tr.urlName}/">${%Latest Dependency-Check}</a> | ||
<st:nbsp/> | ||
<test:test-result it="${tr}"/> | ||
</t:summary> | ||
</j:if> | ||
</table> | ||
</j:jelly> |