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 4dd0220 commit 17f2b9d
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,5 +76,7 @@ data class MarketAtomUpdateRequest(
@ApiModelProperty(value = "前端UI渲染方式", required = true)
val frontendType: FrontendTypeEnum = FrontendTypeEnum.NORMAL,
@ApiModelProperty(value = "插件字段校验确认标识", required = false)
val fieldCheckConfirmFlag: Boolean? = false
val fieldCheckConfirmFlag: Boolean? = false,
@ApiModelProperty("分支", required = false)
val branch: String? = null
)
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ enum class ReleaseTypeEnum(val releaseType: Int) {
INCOMPATIBILITY_UPGRADE(1), // 非兼容性升级
COMPATIBILITY_UPGRADE(2), // 兼容性功能更新
COMPATIBILITY_FIX(3), // 兼容性问题修正
CANCEL_RE_RELEASE(4); // 取消发布后重新发布
CANCEL_RE_RELEASE(4), // 取消发布后重新发布
HIS_VERSION_UPGRADE(5); // 历史大版本问题修正

companion object {

Expand All @@ -46,14 +47,12 @@ enum class ReleaseTypeEnum(val releaseType: Int) {
}

fun getReleaseType(releaseType: Int): String {
return when (releaseType) {
0 -> NEW.name
1 -> INCOMPATIBILITY_UPGRADE.name
2 -> COMPATIBILITY_UPGRADE.name
3 -> COMPATIBILITY_FIX.name
4 -> CANCEL_RE_RELEASE.name
else -> NEW.name
values().forEach { enumObj ->
if (enumObj.releaseType == releaseType) {
return enumObj.name
}
}
return NEW.name
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,11 @@ class SampleAtomReleaseServiceImpl : SampleAtomReleaseService, AtomReleaseServic
projectCode: String,
atomCode: String,
atomVersion: String,
repositoryHashId: String,
fileName: String
fileName: String,
repositoryHashId: String?,
branch: String?
): String? {
logger.info("getFileStr projectCode is:$projectCode,atomCode is:$atomCode,atomVersion is:$atomVersion")
logger.info("getFileStr repositoryHashId is:$repositoryHashId,fileName is:$fileName")
logger.info("getFileStr $projectCode|$atomCode|$atomVersion|$fileName|$repositoryHashId|$branch")
val fileStr = marketAtomArchiveService.getFileStr(projectCode, atomCode, atomVersion, fileName)
logger.info("getFileStr fileStr is:$fileStr")
return fileStr
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -316,8 +316,9 @@ abstract class AtomReleaseServiceImpl @Autowired constructor() : AtomReleaseServ
projectCode = projectCode,
atomCode = atomCode,
atomVersion = version,
userId = userId,
repositoryHashId = atomRecord.repositoryHashId,
userId = userId
branch = marketAtomUpdateRequest.branch
)
if (getAtomConfResult.errorCode != "0") {
return MessageCodeUtil.generateResponseDataObject(
Expand Down Expand Up @@ -362,8 +363,9 @@ abstract class AtomReleaseServiceImpl @Autowired constructor() : AtomReleaseServ
atomCode = atomCode,
atomName = marketAtomUpdateRequest.name,
atomVersion = version,
userId = userId,
repositoryHashId = atomRecord.repositoryHashId,
userId = userId
branch = marketAtomUpdateRequest.branch
)
logger.info("update market atom, getAtomQualityResult: $getAtomQualityResult")
if (getAtomQualityResult.errorCode == StoreMessageCode.USER_REPOSITORY_PULL_QUALITY_JSON_FILE_FAIL) {
Expand Down Expand Up @@ -511,16 +513,18 @@ abstract class AtomReleaseServiceImpl @Autowired constructor() : AtomReleaseServ
atomCode: String,
atomName: String,
atomVersion: String,
repositoryHashId: String,
userId: String
userId: String,
repositoryHashId: String? = null,
branch: String? = null
): GetAtomQualityConfigResult {
try {
val qualityJsonStr = getFileStr(
projectCode = projectCode,
atomCode = atomCode,
atomVersion = atomVersion,
fileName = QUALITY_JSON_NAME,
repositoryHashId = repositoryHashId,
fileName = QUALITY_JSON_NAME
branch = branch
)
logger.info("the quality json str is :$qualityJsonStr")
return if (!qualityJsonStr.isNullOrBlank()) {
Expand Down Expand Up @@ -599,8 +603,9 @@ abstract class AtomReleaseServiceImpl @Autowired constructor() : AtomReleaseServ
projectCode: String,
atomCode: String,
atomVersion: String,
repositoryHashId: String,
fileName: String
fileName: String,
repositoryHashId: String? = null,
branch: String? = null
): String?

private fun registerControlPoint(
Expand Down Expand Up @@ -699,8 +704,9 @@ abstract class AtomReleaseServiceImpl @Autowired constructor() : AtomReleaseServ
projectCode: String,
atomCode: String,
atomVersion: String,
repositoryHashId: String,
userId: String
userId: String,
repositoryHashId: String? = null,
branch: String? = null
): GetAtomConfigResult {
// 拉取task.json配置文件校验其合法性
val taskJsonStr: String?
Expand All @@ -709,8 +715,9 @@ abstract class AtomReleaseServiceImpl @Autowired constructor() : AtomReleaseServ
projectCode = projectCode,
atomCode = atomCode,
atomVersion = atomVersion,
fileName = TASK_JSON_NAME,
repositoryHashId = repositoryHashId,
fileName = TASK_JSON_NAME
branch = branch
)
} catch (e: Exception) {
logger.error("getFileContent error is :$e", e)
Expand Down

0 comments on commit 17f2b9d

Please sign in to comment.