Skip to content

Commit

Permalink
feat:【流水线插件】支持历史大版本下的小版本更新 TencentBlueKing#1841
Browse files Browse the repository at this point in the history
  • Loading branch information
carlyin0801 committed Aug 13, 2021
1 parent 144f1f1 commit 842d4c8
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -369,10 +369,13 @@ abstract class ImageReleaseService {
val requireVersionList =
if (cancelFlag && releaseType == ReleaseTypeEnum.CANCEL_RE_RELEASE) {
listOf(dbVersion)
} else storeCommonService.getRequireVersion(
dbVersion,
releaseType
)
} else {
storeCommonService.getRequireVersion(
reqVersion = version,
dbVersion = dbVersion,
releaseType = releaseType
)
}
if (!requireVersionList.contains(version)) {
return MessageCodeUtil.generateResponseDataObject(
StoreMessageCode.USER_IMAGE_VERSION_IS_INVALID,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ class MarketAtomCommonServiceImpl : MarketAtomCommonService {
if (cancelFlag && releaseType == ReleaseTypeEnum.CANCEL_RE_RELEASE) {
listOf(dbVersion)
} else storeCommonService.getRequireVersion(
reqVersion = version,
dbVersion = dbVersion,
releaseType = requireReleaseType
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ interface StoreCommonService {
* 获取正确的升级版本号
*/
fun getRequireVersion(
reqVersion: String,
dbVersion: String,
releaseType: ReleaseTypeEnum
): List<String>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,14 +109,19 @@ class StoreCommonServiceImpl @Autowired constructor(
* 获取正确的升级版本号
*/
override fun getRequireVersion(
reqVersion: String,
dbVersion: String,
releaseType: ReleaseTypeEnum
): List<String> {
var requireVersionList = listOf(INIT_VERSION)
val dbVersionParts = dbVersion.split(".")
val firstVersionPart = dbVersionParts[0]
val secondVersionPart = dbVersionParts[1]
val thirdVersionPart = dbVersionParts[2]
if (dbVersion.isBlank()) {
return requireVersionList
}
val version = if (releaseType != ReleaseTypeEnum.HIS_VERSION_UPGRADE) dbVersion else reqVersion
val versionParts = version.split(".")
val firstVersionPart = versionParts[0]
val secondVersionPart = versionParts[1]
val thirdVersionPart = versionParts[2]
when (releaseType) {
ReleaseTypeEnum.INCOMPATIBILITY_UPGRADE -> {
requireVersionList = listOf("${firstVersionPart.toInt() + 1}.0.0")
Expand All @@ -131,9 +136,10 @@ class StoreCommonServiceImpl @Autowired constructor(
requireVersionList = listOf(dbVersion)
}
ReleaseTypeEnum.HIS_VERSION_UPGRADE -> {
val dbVersionParts = dbVersion.split(".")
requireVersionList = listOf(
"$firstVersionPart.${secondVersionPart.toInt() + 1}.0",
"$firstVersionPart.$secondVersionPart.${thirdVersionPart.toInt() + 1}"
"${dbVersionParts[0]}.${secondVersionPart.toInt() + 1}.0",
"${dbVersionParts[0]}.$secondVersionPart.${thirdVersionPart.toInt() + 1}"
)
}
else -> {
Expand Down

0 comments on commit 842d4c8

Please sign in to comment.