From 2365f87a23c5705d0e5018dcf2d1d6358e42a6b1 Mon Sep 17 00:00:00 2001 From: carlyin <449036249@qq.com> Date: Mon, 16 Aug 2021 17:48:48 +0800 Subject: [PATCH] =?UTF-8?q?feat:=E3=80=90=E6=B5=81=E6=B0=B4=E7=BA=BF?= =?UTF-8?q?=E6=8F=92=E4=BB=B6=E3=80=91=E6=94=AF=E6=8C=81=E5=8E=86=E5=8F=B2?= =?UTF-8?q?=E5=A4=A7=E7=89=88=E6=9C=AC=E4=B8=8B=E7=9A=84=E5=B0=8F=E7=89=88?= =?UTF-8?q?=E6=9C=AC=E6=9B=B4=E6=96=B0=20#1841?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../repository/service/RepositoryService.kt | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/backend/ci/core/repository/biz-repository/src/main/kotlin/com/tencent/devops/repository/service/RepositoryService.kt b/src/backend/ci/core/repository/biz-repository/src/main/kotlin/com/tencent/devops/repository/service/RepositoryService.kt index 8967c8eaad8..8adb8c5babc 100644 --- a/src/backend/ci/core/repository/biz-repository/src/main/kotlin/com/tencent/devops/repository/service/RepositoryService.kt +++ b/src/backend/ci/core/repository/biz-repository/src/main/kotlin/com/tencent/devops/repository/service/RepositoryService.kt @@ -1546,6 +1546,30 @@ class RepositoryService @Autowired constructor( ) } + fun createGitTag( + userId: String, + tagName: String, + ref: String, + repositoryConfig: RepositoryConfig, + tokenType: TokenTypeEnum + ): Result { + val repo: CodeGitRepository = serviceGet("", repositoryConfig) as CodeGitRepository + logger.info("the repo is:$repo") + val finalTokenType = generateFinalTokenType(tokenType, repo.projectName) + val getGitTokenResult = getGitToken(finalTokenType, userId) + if (getGitTokenResult.isNotOk()) { + return Result(status = getGitTokenResult.status, message = getGitTokenResult.message ?: "") + } + val token = getGitTokenResult.data!! + return gitService.createGitTag( + repoName = repo.projectName, + tagName = tagName, + ref = ref, + token = token, + tokenType = finalTokenType + ) + } + companion object { private val logger = LoggerFactory.getLogger(RepositoryService::class.java) }