Skip to content

Commit

Permalink
bug: 创建流水线组失败,导致代码库开启PAC一直显示同步中 TencentBlueKing#11253
Browse files Browse the repository at this point in the history
  • Loading branch information
mingshewhe committed Dec 3, 2024
1 parent 572d36c commit e0c67cc
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ import com.tencent.devops.process.yaml.actions.data.PacRepoSetting
import com.tencent.devops.process.yaml.actions.data.YamlTriggerPipeline
import com.tencent.devops.process.yaml.actions.internal.event.PipelineYamlManualEvent
import com.tencent.devops.process.yaml.common.Constansts
import com.tencent.devops.process.yaml.exception.hanlder.YamlTriggerExceptionUtil
import com.tencent.devops.process.yaml.mq.PipelineYamlEnableEvent
import com.tencent.devops.process.yaml.mq.PipelineYamlTriggerEvent
import com.tencent.devops.process.yaml.v2.enums.StreamObjectKind
Expand Down Expand Up @@ -153,15 +152,13 @@ class PipelineYamlFacadeService @Autowired constructor(
)
)
}
} catch (ignored: Exception) {
logger.error("Failed to enable pac|projectId:$projectId|repoHashId:$repoHashId", ignored)
val (reason, reasonDetail) = YamlTriggerExceptionUtil.getReasonDetail(ignored)
pipelineYamlSyncService.initPacFailed(
} catch (exception: Exception) {
logger.error("Failed to enable pac|projectId:$projectId|repoHashId:$repoHashId", exception)
pipelineYamlSyncService.enablePacFailed(
projectId = projectId,
repoHashId = repoHashId,
reason = reason,
reasonDetail = reasonDetail
repoHashId = repoHashId
)
throw exception
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -674,6 +674,7 @@ class PipelineYamlRepositoryService @Autowired constructor(
directory = directory
)
if (yamlPipelineCnt == 0L) {
logger.info("delete pipeline yaml view|$projectId|$repoHashId|$directory")
pipelineYamlViewService.getPipelineYamlView(
projectId = projectId,
repoHashId = repoHashId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ import com.tencent.devops.common.redis.RedisOperation
import com.tencent.devops.process.engine.dao.PipelineYamlSyncDao
import com.tencent.devops.process.pojo.pipeline.PipelineYamlSyncInfo
import com.tencent.devops.process.pojo.trigger.PipelineTriggerReasonDetail
import com.tencent.devops.process.yaml.common.Constansts
import com.tencent.devops.process.yaml.pojo.YamlPathListEntry
import com.tencent.devops.repository.api.ServiceRepositoryPacResource
import com.tencent.devops.repository.pojo.enums.RepoYamlSyncStatusEnum
Expand Down Expand Up @@ -90,27 +89,10 @@ class PipelineYamlSyncService @Autowired constructor(
)
}

fun initPacFailed(
fun enablePacFailed(
projectId: String,
repoHashId: String,
reason: String,
reasonDetail: PipelineTriggerReasonDetail
repoHashId: String
) {
val syncFileInfoList = listOf(
PipelineYamlSyncInfo(
filePath = Constansts.ciFileDirectoryName,
fileUrl = "",
syncStatus = RepoYamlSyncStatusEnum.FAILED,
reason = reason,
reasonDetail = JsonUtil.toJson(reasonDetail)
)
)
pipelineYamlSyncDao.batchAdd(
dslContext = dslContext,
projectId = projectId,
repoHashId = repoHashId,
syncFileInfoList = syncFileInfoList
)
client.get(ServiceRepositoryPacResource::class).updateYamlSyncStatus(
projectId = projectId,
repoHashId = repoHashId,
Expand Down

0 comments on commit e0c67cc

Please sign in to comment.