Skip to content

Commit

Permalink
feat:流水线查看和构建详情查看配置界面敏感字段展示优化 TencentBlueKing#11019
Browse files Browse the repository at this point in the history
  • Loading branch information
yjieliang committed Jan 6, 2025
1 parent df9021e commit f1fabac
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1331,8 +1331,6 @@ class PipelineRepositoryService constructor(
projectId = projectId,
pipelineId = pipelineId
)

logger.info("getPipelineResourceVersion checkPermission:$checkPermission")
// 历史数据兼容:
// 1 返回时将别名name补全为id
// 2 填充所有job没有的job id
Expand Down Expand Up @@ -1366,7 +1364,7 @@ class PipelineRepositoryService constructor(
}

// 敏感入参解析
private fun transferSensitiveParam(atomElement: Element) {
fun transferSensitiveParam(atomElement: Element) {
if (atomElement is MarketBuildAtomElement || atomElement is MarketBuildLessAtomElement) {
val atomCode = atomElement.getAtomCode()
val hashKey = if (atomElement.version.contains("*") || atomElement.version.contains("latest")) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,8 @@ class PipelineBuildRecordService @Autowired constructor(
buildInfo: BuildInfo,
executeCount: Int?,
refreshStatus: Boolean = true,
queryDslContext: DSLContext? = null
queryDslContext: DSLContext? = null,
sensitiveFlag: Boolean? = true
): ModelRecord? {
// 直接取构建记录数据,防止接口传错
val projectId = buildInfo.projectId
Expand Down Expand Up @@ -256,6 +257,11 @@ class PipelineBuildRecordService @Autowired constructor(
container.fetchGroupContainers()?.forEach { groupContainer ->
fixContainerDetail(groupContainer)
}
if (sensitiveFlag != true) {
container.elements.forEach { e ->
pipelineRepositoryService.transferSensitiveParam(e)
}
}
}
stage.elapsed = stage.elapsed ?: stage.timeCost?.totalCost
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,12 +139,12 @@ import com.tencent.devops.process.utils.PIPELINE_START_TASK_ID
import com.tencent.devops.process.utils.PipelineVarUtil.recommendVersionKey
import com.tencent.devops.process.yaml.PipelineYamlFacadeService
import com.tencent.devops.quality.api.v2.pojo.ControlPointPosition
import org.slf4j.LoggerFactory
import org.springframework.beans.factory.annotation.Value
import org.springframework.stereotype.Service
import java.util.concurrent.TimeUnit
import javax.ws.rs.core.Response
import javax.ws.rs.core.UriBuilder
import org.slf4j.LoggerFactory
import org.springframework.beans.factory.annotation.Value
import org.springframework.stereotype.Service

/**
*
Expand Down Expand Up @@ -1539,7 +1539,13 @@ class PipelineBuildFacadeService(
pipelineId = pipelineId,
buildId = buildId,
executeCount = null,
channelCode = channelCode
channelCode = channelCode,
sensitiveFlag = pipelinePermissionService.checkPipelinePermission(
userId = userId,
projectId = projectId,
pipelineId = pipelineId,
permission = AuthPermission.EDIT
)
)
}

Expand All @@ -1549,7 +1555,8 @@ class PipelineBuildFacadeService(
buildId: String,
executeCount: Int?,
channelCode: ChannelCode,
archiveFlag: Boolean? = false
archiveFlag: Boolean? = false,
sensitiveFlag: Boolean? = true
): ModelRecord {
val queryDslContext = CommonUtils.getJooqDslContext(archiveFlag, ARCHIVE_SHARDING_DSL_CONTEXT)
val buildInfo = pipelineRuntimeService.getBuildInfo(
Expand Down Expand Up @@ -1607,7 +1614,13 @@ class PipelineBuildFacadeService(
buildId = buildId,
executeCount = executeCount,
channelCode = channelCode,
archiveFlag = archiveFlag
archiveFlag = archiveFlag,
sensitiveFlag = pipelinePermissionService.checkPipelinePermission(
userId = userId,
projectId = projectId,
pipelineId = pipelineId,
permission = AuthPermission.EDIT
)
)
}

Expand Down

0 comments on commit f1fabac

Please sign in to comment.