Skip to content

Commit

Permalink
[JENKINS-15371] Extended (environment-)variable substition.
Browse files Browse the repository at this point in the history
Environment-variables, used in the version-number's format-string no
longer need to be in format "${MYVAR}", "$MYVAR" work now, too.

However, variables accessing the plugins' variables (e.g. BUILDS_TODAY,
BUILDS_ALL_TIME, etc.) still must be enclosed in braces.
  • Loading branch information
Bagira80 committed Aug 22, 2016
1 parent b7e2f33 commit 30e9ebd
Showing 1 changed file with 5 additions and 5 deletions.
Expand Up @@ -64,10 +64,8 @@ public static VersionNumberBuildInfo incBuild(Run build, Run prevBuild, boolean
VersionNumberBuildInfo info = prevAction.getInfo();

// increment builds per day
if (curCal.get(Calendar.DAY_OF_MONTH) == todayCal
.get(Calendar.DAY_OF_MONTH)
&& curCal.get(Calendar.MONTH) == todayCal
.get(Calendar.MONTH)
if (curCal.get(Calendar.DAY_OF_MONTH) == todayCal.get(Calendar.DAY_OF_MONTH)
&& curCal.get(Calendar.MONTH) == todayCal.get(Calendar.MONTH)
&& curCal.get(Calendar.YEAR) == todayCal.get(Calendar.YEAR)) {
buildsToday = info.getBuildsToday() + buildInc;
} else {
Expand Down Expand Up @@ -143,8 +141,10 @@ public static String formatVersionNumber(String versionNumberFormatString,
VersionNumberBuildInfo info,
Map<String, String> enVars,
Calendar buildDate) {
String vnf = versionNumberFormatString;
// Expand all environment-variables in the format-string.
String vnf = new EnvVars(enVars).expand(versionNumberFormatString);

// Try to expand all remaining (version-number specific) variables.
int blockStart = 0;
do {
// blockStart and blockEnd define the starting and ending positions of the entire block, including
Expand Down

0 comments on commit 30e9ebd

Please sign in to comment.