Class VersionNumberCommon
- java.lang.Object
-
- org.jvnet.hudson.tools.versionnumber.VersionNumberCommon
-
public class VersionNumberCommon extends Object
Common methods used by freestyle and pipeline jobs.
-
-
Field Summary
Fields Modifier and Type Field Description static String
DEFAULT_DATE_FORMAT_PATTERN
static String
ENV_VAR_PATTERN
static String
WORST_RESULT_ABORTED
static String
WORST_RESULT_FAILURE
static String
WORST_RESULT_NOT_BUILT
static String
WORST_RESULT_SUCCESS
static String
WORST_RESULT_UNSTABLE
-
Constructor Summary
Constructors Constructor Description VersionNumberCommon()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static String
formatVersionNumber(String versionNumberFormatString, Date projectStartDate, VersionNumberBuildInfo info, Map<String,String> enVars, Calendar buildDate)
static Run
getPreviousBuildWithVersionNumber(Run build, String envPrefix)
static VersionNumberBuildInfo
incBuild(Run build, EnvVars vars, Run prevBuild, Result worstResultForIncrement, String overrideBuildsToday, String overrideBuildsThisWeek, String overrideBuildsThisMonth, String overrideBuildsThisYear, String overrideBuildsAllTime)
static String
makeValid(String value)
Checks if the given string contains a valid value and returns that value again if it is valid or returns an empty string if it is not.static Date
parseDate(String dateString)
-
-
-
Field Detail
-
DEFAULT_DATE_FORMAT_PATTERN
public static final String DEFAULT_DATE_FORMAT_PATTERN
- See Also:
- Constant Field Values
-
WORST_RESULT_SUCCESS
public static final String WORST_RESULT_SUCCESS
- See Also:
- Constant Field Values
-
WORST_RESULT_UNSTABLE
public static final String WORST_RESULT_UNSTABLE
- See Also:
- Constant Field Values
-
WORST_RESULT_FAILURE
public static final String WORST_RESULT_FAILURE
- See Also:
- Constant Field Values
-
WORST_RESULT_ABORTED
public static final String WORST_RESULT_ABORTED
- See Also:
- Constant Field Values
-
WORST_RESULT_NOT_BUILT
public static final String WORST_RESULT_NOT_BUILT
- See Also:
- Constant Field Values
-
ENV_VAR_PATTERN
public static final String ENV_VAR_PATTERN
- See Also:
- Constant Field Values
-
-
Method Detail
-
incBuild
public static VersionNumberBuildInfo incBuild(Run build, EnvVars vars, Run prevBuild, Result worstResultForIncrement, String overrideBuildsToday, String overrideBuildsThisWeek, String overrideBuildsThisMonth, String overrideBuildsThisYear, String overrideBuildsAllTime)
-
getPreviousBuildWithVersionNumber
public static Run getPreviousBuildWithVersionNumber(Run build, String envPrefix)
-
formatVersionNumber
public static String formatVersionNumber(String versionNumberFormatString, Date projectStartDate, VersionNumberBuildInfo info, Map<String,String> enVars, Calendar buildDate)
-
makeValid
public static String makeValid(String value)
Checks if the given string contains a valid value and returns that value again if it is valid or returns an empty string if it is not. A valid value encoded in the string must either be a (positive) number, convertible to an integer or a reference to an environment-variable in the form${VARIABLE_NAME}
or$VARIABLE_NAME
.- Parameters:
value
- The (user-provided) string which should either contain a number or a reference to an environment-variable.- Returns:
- The given buildNum if valid or an empty string.
-
-