Skip to content
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

pref:研发商店组件内置打包流水线都归属到统一的平台项目下 #10475 #11046

Open
wants to merge 40 commits into
base: master
Choose a base branch
from

Conversation

yjieliang
Copy link
Collaborator

@yjieliang yjieliang commented Oct 10, 2024

pref:研发商店组件内置打包流水线都归属到统一的平台项目下 #10475

carlyin0801 and others added 25 commits June 5, 2024 11:38
# Conflicts:
#	src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/atom/service/impl/MarketAtomEnvServiceImpl.kt
#	src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/common/service/impl/StoreProjectServiceImpl.kt
@yjieliang yjieliang changed the title Issue 10475 inner pipeline fix yj pref:研发商店组件内置打包流水线都归属到统一的平台项目下 Oct 11, 2024
@yjieliang yjieliang changed the title pref:研发商店组件内置打包流水线都归属到统一的平台项目下 pref:研发商店组件内置打包流水线都归属到统一的平台项目下 #10475 Oct 18, 2024
userId: String,
storeCode: String,
storeType: Byte
): Boolean {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

安装类型的条件不需要加吗

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已调整

pipelineId = it
)
}
logger.info("handleStoreBuildResult pipelineId:${storeBuildInfoRecord?.pipelineId},storeType:$storeType")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这行日志已经包含方法前面一行日志信息,而且这种日志信息打印作用不大,可以考虑去掉

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已调整

)
}
logger.info("handleStoreBuildResult pipelineId:${storeBuildInfoRecord?.pipelineId},storeType:$storeType")
if (storeType == null) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这逻辑没看懂,T_STORE_PIPELINE_REL表会存在storeType为空的情况吗

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已调整

@@ -301,9 +301,10 @@ abstract class StoreCommonServiceImpl : StoreCommonService {
val storeBuildInfoRecord = storePipelineBuildRelDao.getStorePipelineBuildRel(dslContext, storeId)
if (null != storeBuildInfoRecord) {
val pipelineId = storeBuildInfoRecord.pipelineId
val storePipelineRelRecord = storePipelineRelDao.getStorePipelineRelByPipelineId(
val storePipelineRelRecord = storePipelineRelDao.getStorePipelineRelByStoreCode(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

为什么要把getStorePipelineRelByPipelineId方法切换至getStorePipelineRelByStoreCode,原来用流水线ID不是可以正常查出记录吗

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

因为内置流水线归属公共项目管理后storeRel存在多个组件管理同一流水线的情况

@@ -404,6 +407,9 @@ abstract class StoreMemberServiceImpl : StoreMemberService {
* 判断是否为成员
*/
override fun isStoreMember(userId: String, storeCode: String, storeType: Byte): Boolean {
if (userId == storeInnerPipelineConfig.innerPipelineUser) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个逻辑加在这里不合适,innerPipelineUser不一定是组件成员,这个逻辑放在外面去判断,比如userId == storeInnerPipelineConfig.innerPipelineUser || isStoreMember(xxx)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已调整

// 触发执行流水线
val buildIdObj = client.get(ServiceBuildResource::class).manualStartupNew(
userId = innerPipelineUser,
projectId = storePipelineRelRecord?.projectCode ?: innerPipelineProject,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

用这个逻辑,要求流水线都是挂在innerPipelineProject和innerPipelineUser下面

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已调整

lock.lock()
pipelineId = redisOperation.get(pipelineName)
if (pipelineId.isNullOrBlank()) {
val pipelineList = client.get(ServicePipelineResource::class).searchByName(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

把各个组件公共流水线的流水线ID存在配置表和redis不就行了,为什么要搞这么复杂

params = arrayOf(storeCode ?: "$storeType-PIPELINE-BUILD:PUBLIC")
)
logger.info("handleStorePublicPipelineModel pipelineId:$pipelineId|publicPipelineId:$publicPipelineId")
if (storeCode != null && pipelineId == publicPipelineId) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这逻辑什么意思,没看懂

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

对已托管给公共项目的组件刷新内置流水线model时则给组件在公共项目下创建单独的流水线

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants