Skip to content

Commit

Permalink
Merge pull request #11223 from yongyiduan/issue_8161_fix
Browse files Browse the repository at this point in the history
feat:流水线版本管理机制 #8161 setting表版本号解绑 优化
  • Loading branch information
bkci-bot authored Dec 12, 2024
2 parents 6141a74 + bc7b2ab commit 919dc18
Showing 1 changed file with 14 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -103,20 +103,20 @@ import com.tencent.devops.process.template.service.TemplateService
import com.tencent.devops.process.yaml.PipelineYamlFacadeService
import com.tencent.devops.process.yaml.transfer.aspect.IPipelineTransferAspect
import com.tencent.devops.store.api.template.ServiceTemplateResource
import org.jooq.DSLContext
import org.jooq.impl.DSL
import org.slf4j.LoggerFactory
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.beans.factory.annotation.Value
import org.springframework.dao.DuplicateKeyException
import org.springframework.stereotype.Service
import java.net.URLEncoder
import java.time.LocalDateTime
import java.util.LinkedList
import java.util.concurrent.TimeUnit
import javax.ws.rs.core.MediaType
import javax.ws.rs.core.Response
import javax.ws.rs.core.StreamingOutput
import org.jooq.DSLContext
import org.jooq.impl.DSL
import org.slf4j.LoggerFactory
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.beans.factory.annotation.Value
import org.springframework.dao.DuplicateKeyException
import org.springframework.stereotype.Service

@Suppress("ALL")
@Service
Expand Down Expand Up @@ -941,26 +941,14 @@ class PipelineInfoFacadeService @Autowired constructor(
labels = pipelineCopy.labels
)
modelCheckPlugin.clearUpModel(copyMode)
val newPipelineId = createPipeline(userId, projectId, copyMode, channelCode).pipelineId
val settingInfo = pipelineSettingFacadeService.getSettingInfo(projectId, pipelineId)
if (settingInfo != null) {
// setting pipeline需替换成新流水线的
val newSetting = pipelineSettingFacadeService.rebuildSetting(
oldSetting = settingInfo,
projectId = projectId,
newPipelineId = newPipelineId,
pipelineName = pipelineCopy.name
)
// 复制setting到新流水线
pipelineSettingFacadeService.saveSetting(
userId = userId,
projectId = projectId,
pipelineId = pipelineId,
setting = newSetting,
dispatchPipelineUpdateEvent = false,
updateLabels = false
)
}
val newPipelineId = createPipeline(
userId = userId,
projectId = projectId,
model = copyMode,
channelCode = channelCode,
setting = settingInfo
).pipelineId
return newPipelineId
} catch (e: JsonParseException) {
logger.error("Parse process($pipelineId) fail", e)
Expand Down

0 comments on commit 919dc18

Please sign in to comment.