diff --git a/src/backend/ci/core/repository/biz-repository/src/main/kotlin/com/tencent/devops/repository/service/code/CodeGitRepositoryService.kt b/src/backend/ci/core/repository/biz-repository/src/main/kotlin/com/tencent/devops/repository/service/code/CodeGitRepositoryService.kt index a1f3dd923f4..a8a6744a5e8 100644 --- a/src/backend/ci/core/repository/biz-repository/src/main/kotlin/com/tencent/devops/repository/service/code/CodeGitRepositoryService.kt +++ b/src/backend/ci/core/repository/biz-repository/src/main/kotlin/com/tencent/devops/repository/service/code/CodeGitRepositoryService.kt @@ -175,7 +175,7 @@ class CodeGitRepositoryService @Autowired constructor( ).url var gitProjectId: Long? = null // 需要更新gitProjectId - if (sourceUrl != repository.url) { + if (sourceUrl != repository.url || repository.gitProjectId == null || repository.gitProjectId == 0L) { logger.info( "repository url unMatch,need change gitProjectId,sourceUrl=[$sourceUrl] targetUrl=[${repository.url}]" ) diff --git a/src/backend/ci/core/repository/biz-repository/src/main/kotlin/com/tencent/devops/repository/service/code/CodeGithubRepositoryService.kt b/src/backend/ci/core/repository/biz-repository/src/main/kotlin/com/tencent/devops/repository/service/code/CodeGithubRepositoryService.kt index ab5a0362ef3..a92d7e01ab9 100644 --- a/src/backend/ci/core/repository/biz-repository/src/main/kotlin/com/tencent/devops/repository/service/code/CodeGithubRepositoryService.kt +++ b/src/backend/ci/core/repository/biz-repository/src/main/kotlin/com/tencent/devops/repository/service/code/CodeGithubRepositoryService.kt @@ -127,7 +127,7 @@ class CodeGithubRepositoryService @Autowired constructor( repositoryId = repositoryId ).url var gitProjectId: Long? = null - if (sourceUrl != repository.url) { + if (sourceUrl != repository.url || repository.gitProjectId == null || repository.gitProjectId == 0L) { logger.info( "repository url unMatch,need change gitProjectId,sourceUrl=[$sourceUrl] " + "targetUrl=[${repository.url}]" diff --git a/src/backend/ci/core/repository/biz-repository/src/main/kotlin/com/tencent/devops/repository/service/code/CodeGitlabRepositoryService.kt b/src/backend/ci/core/repository/biz-repository/src/main/kotlin/com/tencent/devops/repository/service/code/CodeGitlabRepositoryService.kt index 3746f088acd..1add0515c76 100644 --- a/src/backend/ci/core/repository/biz-repository/src/main/kotlin/com/tencent/devops/repository/service/code/CodeGitlabRepositoryService.kt +++ b/src/backend/ci/core/repository/biz-repository/src/main/kotlin/com/tencent/devops/repository/service/code/CodeGitlabRepositoryService.kt @@ -128,7 +128,7 @@ class CodeGitlabRepositoryService @Autowired constructor( val repositoryId = HashUtil.decodeOtherIdToLong(repositoryHashId) var gitProjectId: Long? = null // 需要更新gitProjectId - if (record.url != repository.url) { + if (record.url != repository.url || repository.gitProjectId == null || repository.gitProjectId == 0L) { logger.info( "repository url unMatch,need change gitProjectId,sourceUrl=[${record.url}] " + "targetUrl=[${repository.url}]" diff --git a/src/backend/ci/core/repository/biz-repository/src/main/kotlin/com/tencent/devops/repository/service/code/CodeTGitRepositoryService.kt b/src/backend/ci/core/repository/biz-repository/src/main/kotlin/com/tencent/devops/repository/service/code/CodeTGitRepositoryService.kt index 5374f049a52..34fcdecd8d9 100644 --- a/src/backend/ci/core/repository/biz-repository/src/main/kotlin/com/tencent/devops/repository/service/code/CodeTGitRepositoryService.kt +++ b/src/backend/ci/core/repository/biz-repository/src/main/kotlin/com/tencent/devops/repository/service/code/CodeTGitRepositoryService.kt @@ -127,7 +127,7 @@ class CodeTGitRepositoryService @Autowired constructor( val repositoryId = HashUtil.decodeOtherIdToLong(repositoryHashId) var gitProjectId: Long? = null // 需要更新gitProjectId - if (record.url != repository.url) { + if (record.url != repository.url || repository.gitProjectId == null || repository.gitProjectId == 0L) { logger.info( "repository url unMatch,need change gitProjectId,sourceUrl=[${record.url}] " + "targetUrl=[${repository.url}]"