fix(APPINT-34581) - code refactoring for getting versions

This commit is contained in:
stanislav.bieliaiev
2022-09-21 12:19:06 +03:00
committed by sbieliaievl
parent 4db77aee11
commit b1fca5a99d

View File

@@ -291,7 +291,7 @@ public class PomIdsHelper {
public static String getJobVersion(Property property) {
String version = null;
if (property != null) {
boolean useSnapshot = false;
boolean useSnapshot = false;
if (property.getAdditionalProperties() != null) {
version = (String) property.getAdditionalProperties().get(MavenConstants.NAME_USER_VERSION);
useSnapshot = property.getAdditionalProperties().containsKey(MavenConstants.NAME_PUBLISH_AS_SNAPSHOT);
@@ -307,20 +307,19 @@ public class PomIdsHelper {
}
/**
* @return "<jobVersion>-<projectName>".
* @return "<version>".
*/
public static String getJobFeatureVersion(Property property, String bundleVersion) {
public static String getVersion(Property property, String bundleVersion) {
String version = null;
if (property != null) {
boolean useSnapshot = false;
if (property.getAdditionalProperties() != null) {
version = (String) property.getAdditionalProperties().get(MavenConstants.NAME_USER_VERSION);
// APPINT-34581 - try to take cloud version if custom does not persist
useSnapshot = property.getAdditionalProperties().containsKey(MavenConstants.NAME_PUBLISH_AS_SNAPSHOT);
}
if(version == null) {
version = (String) property.getAdditionalProperties().get(MavenConstants.CLOUD_VERSION);
// APPINT-34581 - try to take cloud version if custom does not persist(CI cloud publish)
version = (String) property.getAdditionalProperties().get(MavenConstants.CLOUD_VERSION);
}
if(version == null) {
version = bundleVersion;