diff --git a/src/backend/ci/core/buildless/biz-buildless/src/main/kotlin/com/tencent/devops/buildless/ContainerPoolExecutor.kt b/src/backend/ci/core/buildless/biz-buildless/src/main/kotlin/com/tencent/devops/buildless/ContainerPoolExecutor.kt index dee6392e560..61cabcca441 100644 --- a/src/backend/ci/core/buildless/biz-buildless/src/main/kotlin/com/tencent/devops/buildless/ContainerPoolExecutor.kt +++ b/src/backend/ci/core/buildless/biz-buildless/src/main/kotlin/com/tencent/devops/buildless/ContainerPoolExecutor.kt @@ -10,7 +10,7 @@ import com.tencent.devops.buildless.pojo.RejectedExecutionType import com.tencent.devops.buildless.rejected.RejectedExecutionFactory import com.tencent.devops.buildless.service.BuildLessContainerService import com.tencent.devops.buildless.utils.CommonUtils -import com.tencent.devops.buildless.utils.BuildlessRedisUtils +import com.tencent.devops.buildless.utils.RedisUtils import com.tencent.devops.buildless.utils.ThreadPoolName import com.tencent.devops.buildless.utils.ThreadPoolUtils import org.slf4j.LoggerFactory @@ -22,7 +22,7 @@ import java.util.concurrent.locks.ReentrantLock @Component class ContainerPoolExecutor @Autowired constructor( - private val buildlessRedisUtils: BuildlessRedisUtils, + private val redisUtils: RedisUtils, private val buildLessConfig: BuildLessConfig, private val rejectedExecutionFactory: RejectedExecutionFactory, private val buildLessContainerService: BuildLessContainerService @@ -35,7 +35,7 @@ class ContainerPoolExecutor @Autowired constructor( } logger.info("$buildId|$vmSeqId|$executionCount left push buildLessReadyTask") - buildlessRedisUtils.leftPushBuildLessReadyTask( + redisUtils.leftPushBuildLessReadyTask( BuildLessTask( projectId = projectId, pipelineId = pipelineId, @@ -85,7 +85,7 @@ class ContainerPoolExecutor @Autowired constructor( fun getContainerStatus(containerId: String): BuildLessPoolInfo? { synchronized(containerId.intern()) { - return buildlessRedisUtils.getBuildLessPoolContainer(containerId) + return redisUtils.getBuildLessPoolContainer(containerId) } } @@ -124,7 +124,7 @@ class ContainerPoolExecutor @Autowired constructor( } retry@ while (true) { - val idlePoolSize = buildlessRedisUtils.getIdlePoolSize() + val idlePoolSize = redisUtils.getIdlePoolSize() // 无空闲容器时执行拒绝策略 logger.info("${buildLessStartInfo.buildId}|${buildLessStartInfo.vmSeqId} idlePoolSize: $idlePoolSize") @@ -135,10 +135,10 @@ class ContainerPoolExecutor @Autowired constructor( } // 再次check idlePoolSize,有变更则retry - if (idlePoolSize != buildlessRedisUtils.getIdlePoolSize()) continue@retry + if (idlePoolSize != redisUtils.getIdlePoolSize()) continue@retry // 已经进入需求池,资源池减1 - buildlessRedisUtils.increIdlePool(-1) + redisUtils.increIdlePool(-1) return false } } finally { diff --git a/src/backend/ci/core/buildless/biz-buildless/src/main/kotlin/com/tencent/devops/buildless/config/BuildlessScheduleConfig.kt b/src/backend/ci/core/buildless/biz-buildless/src/main/kotlin/com/tencent/devops/buildless/config/ScheduleConfig.kt similarity index 93% rename from src/backend/ci/core/buildless/biz-buildless/src/main/kotlin/com/tencent/devops/buildless/config/BuildlessScheduleConfig.kt rename to src/backend/ci/core/buildless/biz-buildless/src/main/kotlin/com/tencent/devops/buildless/config/ScheduleConfig.kt index 479c3c4900e..e5693b73a46 100644 --- a/src/backend/ci/core/buildless/biz-buildless/src/main/kotlin/com/tencent/devops/buildless/config/BuildlessScheduleConfig.kt +++ b/src/backend/ci/core/buildless/biz-buildless/src/main/kotlin/com/tencent/devops/buildless/config/ScheduleConfig.kt @@ -8,7 +8,7 @@ import java.util.concurrent.ThreadPoolExecutor import java.util.concurrent.TimeUnit @Configuration -class BuildlessScheduleConfig : SchedulingConfigurer { +class ScheduleConfig : SchedulingConfigurer { override fun configureTasks(taskRegistrar: ScheduledTaskRegistrar) { val scheduler = ScheduledThreadPoolExecutor(5) scheduler.maximumPoolSize = 5 diff --git a/src/backend/ci/core/buildless/biz-buildless/src/main/kotlin/com/tencent/devops/buildless/rejected/JumpPolicy.kt b/src/backend/ci/core/buildless/biz-buildless/src/main/kotlin/com/tencent/devops/buildless/rejected/JumpPolicy.kt index ba8dc803c43..cab0aeda40e 100644 --- a/src/backend/ci/core/buildless/biz-buildless/src/main/kotlin/com/tencent/devops/buildless/rejected/JumpPolicy.kt +++ b/src/backend/ci/core/buildless/biz-buildless/src/main/kotlin/com/tencent/devops/buildless/rejected/JumpPolicy.kt @@ -29,19 +29,19 @@ package com.tencent.devops.buildless.rejected import com.tencent.devops.buildless.pojo.BuildLessStartInfo import com.tencent.devops.buildless.pojo.BuildLessTask -import com.tencent.devops.buildless.utils.BuildlessRedisUtils +import com.tencent.devops.buildless.utils.RedisUtils import org.slf4j.LoggerFactory import org.springframework.beans.factory.annotation.Autowired import org.springframework.stereotype.Service @Service class JumpPolicy @Autowired constructor( - private val buildlessRedisUtils: BuildlessRedisUtils + private val redisUtils: RedisUtils ) : RejectedExecutionHandler { override fun rejectedExecution(buildLessStartInfo: BuildLessStartInfo): Boolean { with(buildLessStartInfo) { logger.info("$buildId|$vmSeqId|$executionCount jump allocate container.") - buildlessRedisUtils.rightPushBuildLessReadyTask( + redisUtils.rightPushBuildLessReadyTask( BuildLessTask( projectId = projectId, pipelineId = pipelineId, diff --git a/src/backend/ci/core/buildless/biz-buildless/src/main/kotlin/com/tencent/devops/buildless/schedule/ContainerPoolSchedule.kt b/src/backend/ci/core/buildless/biz-buildless/src/main/kotlin/com/tencent/devops/buildless/schedule/ContainerPoolSchedule.kt index 640e4002ae2..d95223c1b36 100644 --- a/src/backend/ci/core/buildless/biz-buildless/src/main/kotlin/com/tencent/devops/buildless/schedule/ContainerPoolSchedule.kt +++ b/src/backend/ci/core/buildless/biz-buildless/src/main/kotlin/com/tencent/devops/buildless/schedule/ContainerPoolSchedule.kt @@ -28,14 +28,14 @@ package com.tencent.devops.buildless.schedule import com.tencent.devops.buildless.ContainerPoolExecutor -import com.tencent.devops.buildless.utils.BuildlessRedisUtils +import com.tencent.devops.buildless.utils.RedisUtils import org.springframework.beans.factory.annotation.Autowired import org.springframework.scheduling.annotation.Scheduled import org.springframework.stereotype.Component @Component class ContainerPoolSchedule @Autowired constructor( - private val buildlessRedisUtils: BuildlessRedisUtils, + private val redisUtils: RedisUtils, private val containerPoolExecutor: ContainerPoolExecutor ) { /** @@ -44,9 +44,9 @@ class ContainerPoolSchedule @Autowired constructor( @Scheduled(cron = "0 0/1 * * * ?") fun execute() { // 校准空闲池大小 - if (buildlessRedisUtils.getBuildLessReadyTaskSize() == 0L) { - val idleContainerPoolSize = buildlessRedisUtils.getBuildLessPoolContainerIdle() - buildlessRedisUtils.setIdlePool(idleContainerPoolSize) + if (redisUtils.getBuildLessReadyTaskSize() == 0L) { + val idleContainerPoolSize = redisUtils.getBuildLessPoolContainerIdle() + redisUtils.setIdlePool(idleContainerPoolSize) } containerPoolExecutor.addContainer() diff --git a/src/backend/ci/core/buildless/biz-buildless/src/main/kotlin/com/tencent/devops/buildless/schedule/BuildlessSystemInfoRunner.kt b/src/backend/ci/core/buildless/biz-buildless/src/main/kotlin/com/tencent/devops/buildless/schedule/SystemInfoRunner.kt similarity index 98% rename from src/backend/ci/core/buildless/biz-buildless/src/main/kotlin/com/tencent/devops/buildless/schedule/BuildlessSystemInfoRunner.kt rename to src/backend/ci/core/buildless/biz-buildless/src/main/kotlin/com/tencent/devops/buildless/schedule/SystemInfoRunner.kt index a2602d236f2..ada662c20ac 100644 --- a/src/backend/ci/core/buildless/biz-buildless/src/main/kotlin/com/tencent/devops/buildless/schedule/BuildlessSystemInfoRunner.kt +++ b/src/backend/ci/core/buildless/biz-buildless/src/main/kotlin/com/tencent/devops/buildless/schedule/SystemInfoRunner.kt @@ -32,7 +32,7 @@ import org.springframework.scheduling.annotation.Scheduled import org.springframework.stereotype.Component @Component -class BuildlessSystemInfoRunner { +class SystemInfoRunner { @Scheduled(cron = "0/5 * * * * ?") fun startCollect() { diff --git a/src/backend/ci/core/buildless/biz-buildless/src/main/kotlin/com/tencent/devops/buildless/service/BuildLessContainerService.kt b/src/backend/ci/core/buildless/biz-buildless/src/main/kotlin/com/tencent/devops/buildless/service/BuildLessContainerService.kt index 4a1f59a889a..1fc8a5dfb02 100644 --- a/src/backend/ci/core/buildless/biz-buildless/src/main/kotlin/com/tencent/devops/buildless/service/BuildLessContainerService.kt +++ b/src/backend/ci/core/buildless/biz-buildless/src/main/kotlin/com/tencent/devops/buildless/service/BuildLessContainerService.kt @@ -56,7 +56,7 @@ import com.tencent.devops.buildless.utils.ENV_JOB_BUILD_TYPE import com.tencent.devops.buildless.utils.ENV_KEY_BK_TAG import com.tencent.devops.buildless.utils.ENV_KEY_GATEWAY import com.tencent.devops.buildless.utils.RandomUtil -import com.tencent.devops.buildless.utils.BuildlessRedisUtils +import com.tencent.devops.buildless.utils.RedisUtils import com.tencent.devops.common.api.util.ShaUtils import com.tencent.devops.common.service.BkTag import com.tencent.devops.common.service.config.CommonConfig @@ -76,7 +76,7 @@ import kotlin.streams.toList @Service class BuildLessContainerService( private val bkTag: BkTag, - private val buildlessRedisUtils: BuildlessRedisUtils, + private val redisUtils: RedisUtils, private val commonConfig: CommonConfig, private val buildLessConfig: BuildLessConfig ) { @@ -139,8 +139,8 @@ class BuildLessContainerService( httpDockerCli.startContainerCmd(container.id).exec() logger.info("===> created container: $container, containerName: $containerName. ") - buildlessRedisUtils.setBuildLessPoolContainer(container.id, ContainerStatus.IDLE) - buildlessRedisUtils.increIdlePool(1) + redisUtils.setBuildLessPoolContainer(container.id, ContainerStatus.IDLE) + redisUtils.increIdlePool(1) logger.info("===> buildLessPoolKey hset ${container.id} ${ContainerStatus.IDLE.name}.") } catch (e: Exception) { logger.error("===> failed to created container.", e) @@ -181,7 +181,7 @@ class BuildLessContainerService( ignored ) } finally { - buildlessRedisUtils.deleteBuildLessPoolContainer(containerId) + redisUtils.deleteBuildLessPoolContainer(containerId) } } @@ -206,10 +206,10 @@ class BuildLessContainerService( }.toList() // 不在containerIds列表内的同步删除缓存 - val buildLessPoolContainerMap = buildlessRedisUtils.getBuildLessPoolContainerList() + val buildLessPoolContainerMap = redisUtils.getBuildLessPoolContainerList() buildLessPoolContainerMap.forEach { (key, _) -> if (!containerIds.contains(key)) { - buildlessRedisUtils.deleteBuildLessPoolContainer(key) + redisUtils.deleteBuildLessPoolContainer(key) } } @@ -217,7 +217,7 @@ class BuildLessContainerService( containerIds.forEach { if (!buildLessPoolContainerMap.keys.contains(it)) { logger.info("Supplemental cache buildLessPoolKey hset $it ${ContainerStatus.IDLE.name}.") - buildlessRedisUtils.setBuildLessPoolContainer(it, ContainerStatus.IDLE) + redisUtils.setBuildLessPoolContainer(it, ContainerStatus.IDLE) } } } @@ -231,7 +231,7 @@ class BuildLessContainerService( for (container in containerInfo) { val startTime = httpDockerCli.inspectContainerCmd(container.id).exec().state.startedAt // 是否已运行超过12小时 - val buildLessPoolInfo = buildlessRedisUtils.getBuildLessPoolContainer(container.id) + val buildLessPoolInfo = redisUtils.getBuildLessPoolContainer(container.id) if (checkStartTime(startTime) && (buildLessPoolInfo == null || buildLessPoolInfo.status == ContainerStatus.IDLE)) { timeoutContainerList.add(container.id) diff --git a/src/backend/ci/core/buildless/biz-buildless/src/main/kotlin/com/tencent/devops/buildless/service/BuildLessTaskService.kt b/src/backend/ci/core/buildless/biz-buildless/src/main/kotlin/com/tencent/devops/buildless/service/BuildLessTaskService.kt index c06db537b4f..71786bde04a 100644 --- a/src/backend/ci/core/buildless/biz-buildless/src/main/kotlin/com/tencent/devops/buildless/service/BuildLessTaskService.kt +++ b/src/backend/ci/core/buildless/biz-buildless/src/main/kotlin/com/tencent/devops/buildless/service/BuildLessTaskService.kt @@ -31,7 +31,7 @@ import com.tencent.devops.buildless.ContainerPoolExecutor import com.tencent.devops.buildless.client.DispatchClient import com.tencent.devops.buildless.pojo.BuildLessTask import com.tencent.devops.buildless.utils.ContainerStatus -import com.tencent.devops.buildless.utils.BuildlessRedisUtils +import com.tencent.devops.buildless.utils.RedisUtils import org.slf4j.LoggerFactory import org.springframework.scheduling.annotation.Async import org.springframework.scheduling.annotation.AsyncResult @@ -44,7 +44,7 @@ import java.util.concurrent.Future */ @Service class BuildLessTaskService( - private val buildlessRedisUtils: BuildlessRedisUtils, + private val redisUtils: RedisUtils, private val dispatchClient: DispatchClient, private val containerPoolExecutor: ContainerPoolExecutor ) { @@ -60,7 +60,7 @@ class BuildLessTaskService( return AsyncResult(buildLessPoolInfo.buildLessTask) } - val buildLessTask = buildlessRedisUtils.popBuildLessReadyTask() + val buildLessTask = redisUtils.popBuildLessReadyTask() if (buildLessTask != null) { try { logger.info("****> container: $containerId claim buildLessTask: $buildLessTask") @@ -70,14 +70,14 @@ class BuildLessTaskService( ) logger.info("****> claim task buildLessPoolKey hset $containerId ${ContainerStatus.BUSY.name}.") - buildlessRedisUtils.setBuildLessPoolContainer(containerId, ContainerStatus.BUSY, buildLessTask) + redisUtils.setBuildLessPoolContainer(containerId, ContainerStatus.BUSY, buildLessTask) return AsyncResult(buildLessTask) } catch (e: Exception) { // 异常时任务重新回队列 logger.info("****> container: $containerId claim buildLessTask: $buildLessTask get error, " + "retry.", e) - buildlessRedisUtils.leftPushBuildLessReadyTask(buildLessTask) + redisUtils.leftPushBuildLessReadyTask(buildLessTask) continue } @@ -105,7 +105,7 @@ class BuildLessTaskService( return } - val buildLessTask = buildlessRedisUtils.popBuildLessReadyTask() + val buildLessTask = redisUtils.popBuildLessReadyTask() if (buildLessTask != null) { logger.info("****> container: $containerId claim buildLessTask: $buildLessTask") dispatchClient.updateContainerId( @@ -114,7 +114,7 @@ class BuildLessTaskService( ) logger.info("****> claim task buildLessPoolKey hset $containerId ${ContainerStatus.BUSY.name}.") - buildlessRedisUtils.setBuildLessPoolContainer(containerId, ContainerStatus.BUSY, buildLessTask) + redisUtils.setBuildLessPoolContainer(containerId, ContainerStatus.BUSY, buildLessTask) deferredResult.setResult(buildLessTask) return diff --git a/src/backend/ci/core/buildless/biz-buildless/src/main/kotlin/com/tencent/devops/buildless/utils/BuildlessRedisUtils.kt b/src/backend/ci/core/buildless/biz-buildless/src/main/kotlin/com/tencent/devops/buildless/utils/RedisUtils.kt similarity index 97% rename from src/backend/ci/core/buildless/biz-buildless/src/main/kotlin/com/tencent/devops/buildless/utils/BuildlessRedisUtils.kt rename to src/backend/ci/core/buildless/biz-buildless/src/main/kotlin/com/tencent/devops/buildless/utils/RedisUtils.kt index de9d6e6a550..6ef5c5b68fa 100644 --- a/src/backend/ci/core/buildless/biz-buildless/src/main/kotlin/com/tencent/devops/buildless/utils/BuildlessRedisUtils.kt +++ b/src/backend/ci/core/buildless/biz-buildless/src/main/kotlin/com/tencent/devops/buildless/utils/RedisUtils.kt @@ -36,7 +36,7 @@ import org.springframework.beans.factory.annotation.Autowired import org.springframework.stereotype.Component @Component -class BuildlessRedisUtils @Autowired constructor( +class RedisUtils @Autowired constructor( private val redisOperation: RedisOperation, private val objectMapper: ObjectMapper ) { @@ -139,6 +139,6 @@ class BuildlessRedisUtils @Autowired constructor( } companion object { - private val logger = LoggerFactory.getLogger(BuildlessRedisUtils::class.java) + private val logger = LoggerFactory.getLogger(RedisUtils::class.java) } } diff --git a/src/backend/ci/core/dispatch-docker/api-dispatch-docker/src/main/kotlin/com/tencent/devops/dispatch/docker/api/builds/DispatchBuildDockerHostResource.kt b/src/backend/ci/core/dispatch-docker/api-dispatch-docker/src/main/kotlin/com/tencent/devops/dispatch/docker/api/builds/BuildDockerHostResource.kt similarity index 99% rename from src/backend/ci/core/dispatch-docker/api-dispatch-docker/src/main/kotlin/com/tencent/devops/dispatch/docker/api/builds/DispatchBuildDockerHostResource.kt rename to src/backend/ci/core/dispatch-docker/api-dispatch-docker/src/main/kotlin/com/tencent/devops/dispatch/docker/api/builds/BuildDockerHostResource.kt index b699b02ad2f..f09a2c00453 100644 --- a/src/backend/ci/core/dispatch-docker/api-dispatch-docker/src/main/kotlin/com/tencent/devops/dispatch/docker/api/builds/DispatchBuildDockerHostResource.kt +++ b/src/backend/ci/core/dispatch-docker/api-dispatch-docker/src/main/kotlin/com/tencent/devops/dispatch/docker/api/builds/BuildDockerHostResource.kt @@ -47,7 +47,7 @@ import javax.ws.rs.core.MediaType @Path("/dockerhost") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)@Suppress("ALL") -interface DispatchBuildDockerHostResource { +interface BuildDockerHostResource { @GET @Path("/resource-config/pipelines/{pipelineId}/vmSeqs/{vmSeqId}") @ApiOperation("获取蓝盾项目的docker性能配置") diff --git a/src/backend/ci/core/dispatch-docker/api-dispatch-docker/src/main/kotlin/com/tencent/devops/dispatch/docker/api/service/ServiceDispatchDockerHostResource.kt b/src/backend/ci/core/dispatch-docker/api-dispatch-docker/src/main/kotlin/com/tencent/devops/dispatch/docker/api/service/ServiceDockerHostResource.kt similarity index 98% rename from src/backend/ci/core/dispatch-docker/api-dispatch-docker/src/main/kotlin/com/tencent/devops/dispatch/docker/api/service/ServiceDispatchDockerHostResource.kt rename to src/backend/ci/core/dispatch-docker/api-dispatch-docker/src/main/kotlin/com/tencent/devops/dispatch/docker/api/service/ServiceDockerHostResource.kt index 5839a31fd75..877cce5a674 100644 --- a/src/backend/ci/core/dispatch-docker/api-dispatch-docker/src/main/kotlin/com/tencent/devops/dispatch/docker/api/service/ServiceDispatchDockerHostResource.kt +++ b/src/backend/ci/core/dispatch-docker/api-dispatch-docker/src/main/kotlin/com/tencent/devops/dispatch/docker/api/service/ServiceDockerHostResource.kt @@ -54,7 +54,7 @@ import javax.ws.rs.core.MediaType @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) @ServiceInterface("dispatch-docker") // 指明接入到哪个微服务 -interface ServiceDispatchDockerHostResource { +interface ServiceDockerHostResource { @ApiOperation("获取dockerhost列表") @GET diff --git a/src/backend/ci/core/dispatch-docker/biz-dispatch-docker/src/main/kotlin/com/tencent/devops/dispatch/docker/controller/DispatchBuildDockerHostResourceImpl.kt b/src/backend/ci/core/dispatch-docker/biz-dispatch-docker/src/main/kotlin/com/tencent/devops/dispatch/docker/controller/BuildDockerHostResourceImpl.kt similarity index 82% rename from src/backend/ci/core/dispatch-docker/biz-dispatch-docker/src/main/kotlin/com/tencent/devops/dispatch/docker/controller/DispatchBuildDockerHostResourceImpl.kt rename to src/backend/ci/core/dispatch-docker/biz-dispatch-docker/src/main/kotlin/com/tencent/devops/dispatch/docker/controller/BuildDockerHostResourceImpl.kt index f44ad442cad..17dedbbbdcc 100644 --- a/src/backend/ci/core/dispatch-docker/biz-dispatch-docker/src/main/kotlin/com/tencent/devops/dispatch/docker/controller/DispatchBuildDockerHostResourceImpl.kt +++ b/src/backend/ci/core/dispatch-docker/biz-dispatch-docker/src/main/kotlin/com/tencent/devops/dispatch/docker/controller/BuildDockerHostResourceImpl.kt @@ -29,21 +29,21 @@ package com.tencent.devops.dispatch.docker.controller import com.tencent.devops.common.api.pojo.Result import com.tencent.devops.common.web.RestResource -import com.tencent.devops.dispatch.docker.api.builds.DispatchBuildDockerHostResource +import com.tencent.devops.dispatch.docker.api.builds.BuildDockerHostResource import com.tencent.devops.dispatch.docker.pojo.DockerIpInfoVO import com.tencent.devops.dispatch.docker.pojo.resource.DockerResourceOptionsVO import com.tencent.devops.dispatch.docker.service.DispatchDockerService -import com.tencent.devops.dispatch.docker.service.DispatchDockerHostBuildService +import com.tencent.devops.dispatch.docker.service.DockerHostBuildService import com.tencent.devops.dispatch.docker.service.DockerResourceOptionsService import com.tencent.devops.store.pojo.image.response.ImageRepoInfo import org.springframework.beans.factory.annotation.Autowired @RestResource -class DispatchBuildDockerHostResourceImpl @Autowired constructor( - private val dispatchDockerHostBuildService: DispatchDockerHostBuildService, +class BuildDockerHostResourceImpl @Autowired constructor( + private val dockerHostBuildService: DockerHostBuildService, private val dispatchDockerService: DispatchDockerService, private val dockerResourceOptionsService: DockerResourceOptionsService -) : DispatchBuildDockerHostResource { +) : BuildDockerHostResource { override fun getResourceConfig(pipelineId: String, vmSeqId: String): Result { return Result(dockerResourceOptionsService.getDockerResourceConfig(pipelineId, vmSeqId)) @@ -55,11 +55,11 @@ class DispatchBuildDockerHostResourceImpl @Autowired constructor( vmSeqId: String, poolNo: Int ): Result> { - return Result(dispatchDockerHostBuildService.getQpcGitProjectList(projectId, buildId, vmSeqId, poolNo)) + return Result(dockerHostBuildService.getQpcGitProjectList(projectId, buildId, vmSeqId, poolNo)) } override fun log(buildId: String, red: Boolean, message: String, tag: String?, jobId: String?): Result? { - dispatchDockerHostBuildService.log(buildId, red, message, tag, jobId) + dockerHostBuildService.log(buildId, red, message, tag, jobId) return Result(0, "success") } @@ -70,12 +70,12 @@ class DispatchBuildDockerHostResourceImpl @Autowired constructor( tag: String?, jobId: String? ): Result? { - dispatchDockerHostBuildService.log(buildId, red, message, tag, jobId) + dockerHostBuildService.log(buildId, red, message, tag, jobId) return Result(0, "success") } override fun getPublicImages(): Result> { - return dispatchDockerHostBuildService.getPublicImage() + return dockerHostBuildService.getPublicImage() } override fun refresh(dockerIp: String, dockerIpInfoVO: DockerIpInfoVO): Result { diff --git a/src/backend/ci/core/dispatch-docker/biz-dispatch-docker/src/main/kotlin/com/tencent/devops/dispatch/docker/controller/OpDockerBuildResourceImpl.kt b/src/backend/ci/core/dispatch-docker/biz-dispatch-docker/src/main/kotlin/com/tencent/devops/dispatch/docker/controller/OpDockerBuildResourceImpl.kt index 000be5b4b60..8c8153657cd 100644 --- a/src/backend/ci/core/dispatch-docker/biz-dispatch-docker/src/main/kotlin/com/tencent/devops/dispatch/docker/controller/OpDockerBuildResourceImpl.kt +++ b/src/backend/ci/core/dispatch-docker/biz-dispatch-docker/src/main/kotlin/com/tencent/devops/dispatch/docker/controller/OpDockerBuildResourceImpl.kt @@ -30,19 +30,19 @@ package com.tencent.devops.dispatch.docker.controller import com.tencent.devops.common.api.pojo.Result import com.tencent.devops.common.web.RestResource import com.tencent.devops.dispatch.docker.api.op.OpDockerBuildResource -import com.tencent.devops.dispatch.docker.service.DispatchDockerHostBuildService +import com.tencent.devops.dispatch.docker.service.DockerHostBuildService import com.tencent.devops.dispatch.docker.service.DockerHostQpcService import org.springframework.beans.factory.annotation.Autowired @RestResource class OpDockerBuildResourceImpl @Autowired constructor( - private val dispatchDockerHostBuildService: DispatchDockerHostBuildService, + private val dockerHostBuildService: DockerHostBuildService, private val dockerHostQpcService: DockerHostQpcService ) : OpDockerBuildResource { override fun enable(pipelineId: String, vmSeqId: Int?, enable: Boolean): Result { - dispatchDockerHostBuildService.enable(pipelineId, vmSeqId, enable) + dockerHostBuildService.enable(pipelineId, vmSeqId, enable) return Result(true) } diff --git a/src/backend/ci/core/dispatch-docker/biz-dispatch-docker/src/main/kotlin/com/tencent/devops/dispatch/docker/controller/ServiceDispatchDockerHostResourceImpl.kt b/src/backend/ci/core/dispatch-docker/biz-dispatch-docker/src/main/kotlin/com/tencent/devops/dispatch/docker/controller/ServiceDockerHostResourceImpl.kt similarity index 87% rename from src/backend/ci/core/dispatch-docker/biz-dispatch-docker/src/main/kotlin/com/tencent/devops/dispatch/docker/controller/ServiceDispatchDockerHostResourceImpl.kt rename to src/backend/ci/core/dispatch-docker/biz-dispatch-docker/src/main/kotlin/com/tencent/devops/dispatch/docker/controller/ServiceDockerHostResourceImpl.kt index 57299a1fc2d..e447193c9ba 100644 --- a/src/backend/ci/core/dispatch-docker/biz-dispatch-docker/src/main/kotlin/com/tencent/devops/dispatch/docker/controller/ServiceDispatchDockerHostResourceImpl.kt +++ b/src/backend/ci/core/dispatch-docker/biz-dispatch-docker/src/main/kotlin/com/tencent/devops/dispatch/docker/controller/ServiceDockerHostResourceImpl.kt @@ -31,22 +31,22 @@ import com.tencent.devops.common.api.exception.ParamBlankException import com.tencent.devops.common.api.pojo.Page import com.tencent.devops.common.api.pojo.Result import com.tencent.devops.common.web.RestResource -import com.tencent.devops.dispatch.docker.api.service.ServiceDispatchDockerHostResource +import com.tencent.devops.dispatch.docker.api.service.ServiceDockerHostResource import com.tencent.devops.dispatch.docker.pojo.DockerHostZone import com.tencent.devops.dispatch.docker.pojo.DockerIpInfoVO import com.tencent.devops.dispatch.docker.pojo.SpecialDockerHostVO import com.tencent.devops.dispatch.docker.service.DispatchDockerService -import com.tencent.devops.dispatch.docker.service.DispatchDockerHostBuildService +import com.tencent.devops.dispatch.docker.service.DockerHostBuildService import com.tencent.devops.dispatch.docker.service.DockerHostZoneTaskService import org.slf4j.LoggerFactory import org.springframework.beans.factory.annotation.Autowired @RestResource@Suppress("ALL") -class ServiceDispatchDockerHostResourceImpl @Autowired constructor( - private val dispatchDockerHostBuildService: DispatchDockerHostBuildService, +class ServiceDockerHostResourceImpl @Autowired constructor( + private val dockerHostBuildService: DockerHostBuildService, private val dispatchDockerService: DispatchDockerService, private val dockerHostZoneTaskService: DockerHostZoneTaskService -) : ServiceDispatchDockerHostResource { +) : ServiceDockerHostResource { override fun list(page: Int?, pageSize: Int?): Page { checkParams(page, pageSize) val realPage = page ?: 1 @@ -62,7 +62,7 @@ class ServiceDispatchDockerHostResourceImpl @Autowired constructor( } override fun updateContainerId(buildId: String, vmSeqId: Int, containerId: String): Result { - dispatchDockerHostBuildService.updateContainerId(buildId, vmSeqId, containerId) + dockerHostBuildService.updateContainerId(buildId, vmSeqId, containerId) return Result(true) } @@ -78,7 +78,7 @@ class ServiceDispatchDockerHostResourceImpl @Autowired constructor( } companion object { - private val logger = LoggerFactory.getLogger(ServiceDispatchDockerHostResourceImpl::class.java) + private val logger = LoggerFactory.getLogger(ServiceDockerHostResourceImpl::class.java) } fun checkParams(page: Int?, pageSize: Int?) { diff --git a/src/backend/ci/core/dispatch-docker/biz-dispatch-docker/src/main/kotlin/com/tencent/devops/dispatch/docker/controller/UserDockerHostResourceImpl.kt b/src/backend/ci/core/dispatch-docker/biz-dispatch-docker/src/main/kotlin/com/tencent/devops/dispatch/docker/controller/UserDockerHostResourceImpl.kt index 7489d453b36..8d029821acf 100644 --- a/src/backend/ci/core/dispatch-docker/biz-dispatch-docker/src/main/kotlin/com/tencent/devops/dispatch/docker/controller/UserDockerHostResourceImpl.kt +++ b/src/backend/ci/core/dispatch-docker/biz-dispatch-docker/src/main/kotlin/com/tencent/devops/dispatch/docker/controller/UserDockerHostResourceImpl.kt @@ -48,7 +48,7 @@ import com.tencent.devops.dispatch.docker.dao.PipelineDockerTaskSimpleDao import com.tencent.devops.dispatch.docker.pojo.ContainerInfo import com.tencent.devops.dispatch.docker.pojo.DebugStartParam import com.tencent.devops.dispatch.docker.pojo.DockerHostLoad -import com.tencent.devops.dispatch.docker.service.DispatchDockerHostBuildService +import com.tencent.devops.dispatch.docker.service.DockerHostBuildService import com.tencent.devops.dispatch.docker.service.debug.impl.DockerHostDebugServiceImpl import com.tencent.devops.dispatch.docker.utils.DockerHostUtils import com.tencent.devops.dispatch.pojo.enums.PipelineTaskStatus @@ -60,7 +60,7 @@ import org.springframework.beans.factory.annotation.Autowired @RestResource @Suppress("ALL") class UserDockerHostResourceImpl @Autowired constructor( - private val dispatchDockerHostBuildService: DispatchDockerHostBuildService, + private val dockerHostBuildService: DockerHostBuildService, private val dockerHostDebugService: DockerHostDebugServiceImpl, private val bkAuthPermissionApi: AuthPermissionApi, private val pipelineAuthServiceCode: PipelineAuthServiceCode, @@ -185,7 +185,7 @@ class UserDockerHostResourceImpl @Autowired constructor( ): Result? { checkPermission(userId, projectId, pipelineId, vmSeqId) - return dispatchDockerHostBuildService.getContainerInfo(buildId, vmSeqId.toInt()) + return dockerHostBuildService.getContainerInfo(buildId, vmSeqId.toInt()) } override fun getGreyWebConsoleProject(userId: String): Result> { @@ -198,7 +198,7 @@ class UserDockerHostResourceImpl @Autowired constructor( } override fun getDockerHostLoad(userId: String): Result { - return Result(dispatchDockerHostBuildService.getDockerHostLoad(userId)) + return Result(dockerHostBuildService.getDockerHostLoad(userId)) } fun checkParam(userId: String, projectId: String, pipelineId: String, vmSeqId: String) { diff --git a/src/backend/ci/core/dispatch-docker/biz-dispatch-docker/src/main/kotlin/com/tencent/devops/dispatch/docker/listener/DockerVMListener.kt b/src/backend/ci/core/dispatch-docker/biz-dispatch-docker/src/main/kotlin/com/tencent/devops/dispatch/docker/listener/DockerVMListener.kt index 1981f76ab30..3b77386962a 100644 --- a/src/backend/ci/core/dispatch-docker/biz-dispatch-docker/src/main/kotlin/com/tencent/devops/dispatch/docker/listener/DockerVMListener.kt +++ b/src/backend/ci/core/dispatch-docker/biz-dispatch-docker/src/main/kotlin/com/tencent/devops/dispatch/docker/listener/DockerVMListener.kt @@ -51,7 +51,7 @@ import com.tencent.devops.dispatch.docker.dao.PipelineDockerTaskSimpleDao import com.tencent.devops.dispatch.docker.exception.DockerServiceException import com.tencent.devops.dispatch.docker.pojo.Credential import com.tencent.devops.dispatch.docker.pojo.Pool -import com.tencent.devops.dispatch.docker.service.DispatchDockerHostBuildService +import com.tencent.devops.dispatch.docker.service.DockerHostBuildService import com.tencent.devops.dispatch.docker.utils.CommonUtils import com.tencent.devops.dispatch.docker.utils.DockerHostUtils import com.tencent.devops.dispatch.pojo.enums.JobQuotaVmType @@ -71,7 +71,7 @@ class DockerVMListener @Autowired constructor( private val dslContext: DSLContext, private val buildLogPrinter: BuildLogPrinter, private val defaultImageConfig: DefaultImageConfig, - private val dispatchDockerHostBuildService: DispatchDockerHostBuildService, + private val dockerHostBuildService: DockerHostBuildService, private val dockerHostClient: DockerHostClient, private val dockerHostUtils: DockerHostUtils, private val pipelineDockerTaskSimpleDao: PipelineDockerTaskSimpleDao, @@ -117,7 +117,7 @@ class DockerVMListener @Autowired constructor( val dockerRoutingType = dockerRoutingSdkService.getDockerRoutingType(event.projectId) if (dockerRoutingType == DockerRoutingType.VM) { - dispatchDockerHostBuildService.finishDockerBuild(event) + dockerHostBuildService.finishDockerBuild(event) } else { pipelineEventDispatcher.dispatch(event.copy( routeKeySuffix = DispatchRouteKeySuffix.KUBERNETES.routeKeySuffix, diff --git a/src/backend/ci/core/dispatch-docker/biz-dispatch-docker/src/main/kotlin/com/tencent/devops/dispatch/docker/service/DispatchDockerHostBuildService.kt b/src/backend/ci/core/dispatch-docker/biz-dispatch-docker/src/main/kotlin/com/tencent/devops/dispatch/docker/service/DockerHostBuildService.kt similarity index 98% rename from src/backend/ci/core/dispatch-docker/biz-dispatch-docker/src/main/kotlin/com/tencent/devops/dispatch/docker/service/DispatchDockerHostBuildService.kt rename to src/backend/ci/core/dispatch-docker/biz-dispatch-docker/src/main/kotlin/com/tencent/devops/dispatch/docker/service/DockerHostBuildService.kt index c0bba62d933..40a6f577007 100644 --- a/src/backend/ci/core/dispatch-docker/biz-dispatch-docker/src/main/kotlin/com/tencent/devops/dispatch/docker/service/DispatchDockerHostBuildService.kt +++ b/src/backend/ci/core/dispatch-docker/biz-dispatch-docker/src/main/kotlin/com/tencent/devops/dispatch/docker/service/DockerHostBuildService.kt @@ -55,7 +55,7 @@ import org.springframework.scheduling.annotation.Scheduled import org.springframework.stereotype.Service @Service -class DispatchDockerHostBuildService @Autowired constructor( +class DockerHostBuildService @Autowired constructor( private val dslContext: DSLContext, private val dockerHostClient: DockerHostClient, private val pipelineDockerEnableDao: PipelineDockerEnableDao, @@ -349,6 +349,6 @@ class DispatchDockerHostBuildService @Autowired constructor( } companion object { - private val LOG = LoggerFactory.getLogger(DispatchDockerHostBuildService::class.java) + private val LOG = LoggerFactory.getLogger(DockerHostBuildService::class.java) } } diff --git a/src/backend/ci/core/dockerhost/biz-dockerhost/src/main/kotlin/com/tencent/devops/dockerhost/cron/DockerhostSystemInfoRunner.kt b/src/backend/ci/core/dockerhost/biz-dockerhost/src/main/kotlin/com/tencent/devops/dockerhost/cron/SystemInfoRunner.kt similarity index 98% rename from src/backend/ci/core/dockerhost/biz-dockerhost/src/main/kotlin/com/tencent/devops/dockerhost/cron/DockerhostSystemInfoRunner.kt rename to src/backend/ci/core/dockerhost/biz-dockerhost/src/main/kotlin/com/tencent/devops/dockerhost/cron/SystemInfoRunner.kt index b31d7c15748..d7f9073052e 100644 --- a/src/backend/ci/core/dockerhost/biz-dockerhost/src/main/kotlin/com/tencent/devops/dockerhost/cron/DockerhostSystemInfoRunner.kt +++ b/src/backend/ci/core/dockerhost/biz-dockerhost/src/main/kotlin/com/tencent/devops/dockerhost/cron/SystemInfoRunner.kt @@ -32,7 +32,7 @@ import org.springframework.scheduling.annotation.Scheduled import org.springframework.stereotype.Component @Component -class DockerhostSystemInfoRunner { +class SystemInfoRunner { @Scheduled(cron = "0/5 * * * * ?") fun startCollect() { diff --git a/src/backend/ci/core/openapi/biz-openapi/src/main/kotlin/com/tencent/devops/openapi/resources/apigw/v4/ApigwDispatchResourceV4Impl.kt b/src/backend/ci/core/openapi/biz-openapi/src/main/kotlin/com/tencent/devops/openapi/resources/apigw/v4/ApigwDispatchResourceV4Impl.kt index aa78521df8c..87f6e4316c5 100644 --- a/src/backend/ci/core/openapi/biz-openapi/src/main/kotlin/com/tencent/devops/openapi/resources/apigw/v4/ApigwDispatchResourceV4Impl.kt +++ b/src/backend/ci/core/openapi/biz-openapi/src/main/kotlin/com/tencent/devops/openapi/resources/apigw/v4/ApigwDispatchResourceV4Impl.kt @@ -29,7 +29,7 @@ package com.tencent.devops.openapi.resources.apigw.v4 import com.tencent.devops.common.api.pojo.Result import com.tencent.devops.common.client.Client import com.tencent.devops.common.web.RestResource -import com.tencent.devops.dispatch.docker.api.service.ServiceDispatchDockerHostResource +import com.tencent.devops.dispatch.docker.api.service.ServiceDockerHostResource import com.tencent.devops.dispatch.docker.pojo.SpecialDockerHostVO import com.tencent.devops.openapi.api.apigw.v4.ApigwDispatchResourceV4 import org.slf4j.LoggerFactory @@ -47,7 +47,7 @@ class ApigwDispatchResourceV4Impl @Autowired constructor( specialDockerHostVOs: List ): Result { logger.info("OPENAPI_DISPATCH_V4|$userId|create special docker host|$specialDockerHostVOs") - client.get(ServiceDispatchDockerHostResource::class).createSpecialDockerHost( + client.get(ServiceDockerHostResource::class).createSpecialDockerHost( userId = userId, specialDockerHostVOs = specialDockerHostVOs )