-
Notifications
You must be signed in to change notification settings - Fork 110
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
JENKINS-21149 Replaced StringParameter with PipelineVersionAction
- Loading branch information
Showing
7 changed files
with
119 additions
and
40 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
60 changes: 60 additions & 0 deletions
60
src/main/java/se/diabol/jenkins/pipeline/PipelineVersionAction.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,60 @@ | ||
/* | ||
This file is part of Delivery Pipeline Plugin. | ||
Delivery Pipeline Plugin is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
the Free Software Foundation, either version 3 of the License, or | ||
(at your option) any later version. | ||
Delivery Pipeline Plugin is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
You should have received a copy of the GNU General Public License | ||
along with Delivery Pipeline Plugin. | ||
If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
package se.diabol.jenkins.pipeline; | ||
|
||
import hudson.EnvVars; | ||
import hudson.model.AbstractBuild; | ||
import hudson.model.Action; | ||
import hudson.model.EnvironmentContributingAction; | ||
|
||
public class PipelineVersionAction implements Action, EnvironmentContributingAction { | ||
|
||
private String version; | ||
|
||
public PipelineVersionAction(String version) { | ||
this.version = version; | ||
} | ||
|
||
public String getVersion() { | ||
return version; | ||
} | ||
|
||
public void setVersion(String version) { | ||
this.version = version; | ||
} | ||
|
||
@Override | ||
public void buildEnvVars(AbstractBuild<?, ?> build, EnvVars env) { | ||
env.put(PipelineVersionContributor.VERSION_PARAMETER, version); | ||
} | ||
|
||
@Override | ||
public String getIconFileName() { | ||
return "document-properties.png"; | ||
} | ||
|
||
@Override | ||
public String getDisplayName() { | ||
return "Pipeline version"; | ||
} | ||
|
||
@Override | ||
public String getUrlName() { | ||
return "pipelineversion"; | ||
} | ||
} |
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
16 changes: 16 additions & 0 deletions
16
src/main/resources/se/diabol/jenkins/pipeline/PipelineVersionAction/index.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,16 @@ | ||
<?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" | ||
xmlns:i="jelly:fmt" xmlns:p="/lib/hudson/project"> | ||
<l:layout title="${it.displayName}"> | ||
<j:invokeStatic var="currentThread" className="java.lang.Thread" method="currentThread" /> | ||
<j:invoke var="buildClass" on="${currentThread.contextClassLoader}" method="loadClass"> | ||
<j:arg value="hudson.model.AbstractBuild" /> | ||
</j:invoke> | ||
<j:set var="build" value="${request.findAncestorObject(buildClass)}" /> | ||
<st:include page="sidepanel.jelly" it="${build}" /> | ||
<l:main-panel> | ||
<h1>${it.version}</h1> | ||
</l:main-panel> | ||
</l:layout> | ||
</j: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
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