Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #86 from fbelzunc/JENKINS-33147
[FIXED JENKINS-33147] Customize Date format string and timezone
- Loading branch information
Showing
5 changed files
with
121 additions
and
1 deletion.
There are no files selected for viewing
61 changes: 61 additions & 0 deletions
61
src/main/java/hudson/plugins/promoted_builds/GlobalBuildPromotedBuilds.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,61 @@ | ||
package hudson.plugins.promoted_builds; | ||
|
||
import hudson.Extension; | ||
import jenkins.model.GlobalConfiguration; | ||
import net.sf.json.JSONObject; | ||
import org.kohsuke.stapler.StaplerRequest; | ||
|
||
/** | ||
* Global Jenkins configuration for Promoted Builds | ||
* | ||
* @since 2.26 | ||
*/ | ||
|
||
@Extension | ||
public class GlobalBuildPromotedBuilds extends GlobalConfiguration { | ||
|
||
/** | ||
* By default ISO 8601 like 2016-10-12T09:30Z to be used with | ||
* environmental variable $PROMOTED_TIMESTAMP. | ||
*/ | ||
private String dateFormat; | ||
|
||
/** | ||
* By default Java timezone setting to be used with environmental | ||
* variable $PROMOTED_TIMESTAMP. | ||
* | ||
* Other time zones can be selected if field is filled. | ||
*/ | ||
private String timeZone; | ||
|
||
public GlobalBuildPromotedBuilds() { | ||
load(); | ||
} | ||
|
||
@Override | ||
public boolean configure(StaplerRequest req, JSONObject json) throws FormException { | ||
req.bindJSON(this, json); | ||
save(); | ||
return true; | ||
} | ||
|
||
public String getTimeZone() { | ||
return timeZone; | ||
} | ||
|
||
public void setTimeZone(String timeZone) { | ||
this.timeZone = timeZone; | ||
} | ||
|
||
public String getDateFormat() { | ||
return dateFormat; | ||
} | ||
|
||
public void setDateFormat(String dateFormat) { | ||
this.dateFormat = dateFormat; | ||
} | ||
|
||
public static GlobalBuildPromotedBuilds get() { | ||
return GlobalBuildPromotedBuilds.all().get(GlobalBuildPromotedBuilds.class); | ||
} | ||
} |
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
11 changes: 11 additions & 0 deletions
11
src/main/resources/hudson/plugins/promoted_builds/GlobalBuildPromotedBuilds/config.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,11 @@ | ||
<?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"> | ||
<f:section title="Build Pipeline Plugin"> | ||
<f:entry field="dateFormat" title="Date format"> | ||
<f:textbox /> | ||
</f:entry> | ||
<f:entry field="timeZone" title="Time zone"> | ||
<f:textbox /> | ||
</f:entry> | ||
</f:section> | ||
</j:jelly> |
5 changes: 5 additions & 0 deletions
5
...n/resources/hudson/plugins/promoted_builds/GlobalBuildPromotedBuilds/help-dateFormat.html
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,5 @@ | ||
<div> | ||
Used to specify the date format for $PROMOTED_TIMESTAMP. | ||
<br/> | ||
By default, ISO 8601 formatted presentation of current moment like: 2016-10-12T09:30Z. | ||
</div> |
5 changes: 5 additions & 0 deletions
5
...ain/resources/hudson/plugins/promoted_builds/GlobalBuildPromotedBuilds/help-timeZone.html
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,5 @@ | ||
<div> | ||
Used to determinate the TZ for $PROMOTED_TIMESTAMP. | ||
<br/> | ||
By default, Java time zone. | ||
</div> |