-
Notifications
You must be signed in to change notification settings - Fork 507
feat:流水线查看和构建详情查看配置界面敏感字段展示优化 #11399
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 30 commits
71d3236
dec31db
f027f34
f8e33b5
17a4b94
fa86d87
89f5f3c
a4c5f76
2c98914
32b29d9
600867b
e64f006
df9021e
f1fabac
3584ef1
0e7331c
3aa44f0
95c6117
dcb79a4
20168f2
4789940
bbf9c51
4376a2f
98793ff
8a707c1
8838f29
65db9a9
e358f41
53ea22a
8a1bac6
e4ead6d
41f9e7f
4256554
44042a3
8ce2802
21e7351
3e0a351
6cff42f
7cd9856
71b364d
65d895c
f165892
89ababf
8e259c4
21ba39b
692f521
e5a835e
0b91532
75a6fe7
4eea1c7
b95bfbb
28d37f3
d5cef5c
faf1791
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,18 +27,64 @@ | |
|
||
package com.tencent.devops.process.engine.service | ||
|
||
import com.tencent.devops.common.api.constant.KEY_VERSION | ||
import com.tencent.devops.common.api.util.JsonUtil | ||
import com.tencent.devops.common.pipeline.pojo.element.Element | ||
import com.tencent.devops.common.pipeline.pojo.element.market.MarketBuildAtomElement | ||
import com.tencent.devops.common.pipeline.pojo.element.market.MarketBuildLessAtomElement | ||
import com.tencent.devops.common.redis.RedisOperation | ||
import com.tencent.devops.process.engine.dao.PipelineInfoDao | ||
import com.tencent.devops.store.pojo.common.ATOM_POST_VERSION_TEST_FLAG_KEY_PREFIX | ||
import com.tencent.devops.store.pojo.common.ATOM_SENSITIVE_PARAM_KEY_PREFIX | ||
import com.tencent.devops.store.pojo.common.STORE_NORMAL_PROJECT_RUN_INFO_KEY_PREFIX | ||
import com.tencent.devops.store.pojo.common.enums.StoreTypeEnum | ||
import org.jooq.DSLContext | ||
import org.springframework.beans.factory.annotation.Autowired | ||
import org.springframework.stereotype.Service | ||
|
||
@Service | ||
class PipelineInfoService @Autowired constructor( | ||
private val dslContext: DSLContext, | ||
private val pipelineInfoDao: PipelineInfoDao | ||
private val pipelineInfoDao: PipelineInfoDao, | ||
private val redisOperation: RedisOperation | ||
) { | ||
|
||
fun getPipelineName(projectId: String, pipelineId: String): String? { | ||
return pipelineInfoDao.getPipelineInfo(dslContext, projectId, pipelineId)?.pipelineName | ||
} | ||
|
||
// 敏感入参解析 | ||
fun transferSensitiveParam(projectTestAtomCodes: List<String>, element: Element) { | ||
if (element is MarketBuildAtomElement || element is MarketBuildLessAtomElement) { | ||
val atomCode = element.getAtomCode() | ||
val version = element.version | ||
val hashKey = if (version.contains(".*")) { | ||
var latestVersion: String? = null | ||
val atomVersionTestFlag = | ||
redisOperation.hget("$ATOM_POST_VERSION_TEST_FLAG_KEY_PREFIX:$atomCode", version) | ||
// 项目下调试插件处理 | ||
if (projectTestAtomCodes.contains(atomCode) && (atomVersionTestFlag == "true")) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. atomVersionTestFlag转成布尔值再使用比atomVersionTestFlag == "true"可读性更好 |
||
latestVersion = version | ||
} | ||
if (latestVersion.isNullOrBlank()) { | ||
val atomRunInfoStr = redisOperation.hget( | ||
key = "$STORE_NORMAL_PROJECT_RUN_INFO_KEY_PREFIX:${StoreTypeEnum.ATOM.name}:$atomCode", | ||
hashKey = version | ||
) | ||
val atomRunInfo = atomRunInfoStr?.let { JsonUtil.toMap(it) } | ||
latestVersion = atomRunInfo?.get(KEY_VERSION).toString() | ||
} | ||
latestVersion | ||
} else { | ||
version | ||
} | ||
val param = redisOperation.hget( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 调试项目下的插件版本(可能有测试版本)和一般的项目不一样,你这样缓存到redis有问题,这个逻辑根本不需要写,你通过com.tencent.devops.store.atom.service.impl.MarketAtomEnvServiceImpl#batchGetAtomRunInfos这个接口就可以拿到对应数据 |
||
key = "$ATOM_SENSITIVE_PARAM_KEY_PREFIX:$atomCode", | ||
hashKey = hashKey | ||
) | ||
if (!param.isNullOrBlank()) { | ||
element.transferSensitiveParam(param.split(",")) | ||
} | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
store的逻辑挪到store去实现,通过service接口调用,另外redis的key值以后避免跨微服务使用,这样以后利于redis拆分