Skip to content

Commit

Permalink
feat:蓝盾本地开发实现 TencentBlueKing#9576
Browse files Browse the repository at this point in the history
  • Loading branch information
fcfang123 committed Mar 20, 2024
1 parent 7beee20 commit 23675b5
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 28 deletions.
2 changes: 1 addition & 1 deletion scripts/bkenv.properties
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ BK_CI_PROJECT_ROUTER_TAG=$BK_CI_CONSUL_DISCOVERY_TAG
# BK_CI_STREAM_URL stream独立页面地址
BK_CI_STREAM_URL=
# BK_CI_GIT_GITHUB_URL stream当前对接的Git源的类型如 CODE_GIT GITHUB 等,参考代码中的ScmType
BK_CI_STREAM_SCM_TYPE=CODE_GIT
BK_CI_STREAM_SCM_TYPE= CODE_GIT
# BK_CI_GIT_GITCODE_URL stream跳转时用到的git url地址
BK_CI_STREAM_GIT_URL=
# BK_CI_STREAM_REPORT_PREFIX stream展示报告时的前置链接
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
tasks.register("multiBootJar") {
val finalServices = System.getProperty("devops.multi.from") ?: localRunMultiModules
val finalServiceList = finalServices.split(",").toMutableList()
val finalModules = System.getProperty("devops.multi.from") ?: localRunMultiModules
val finalModulesList = finalModules.split(",").toMutableList()
rootProject.subprojects.filter {
isSpecifiedModulePath(it.path, finalServiceList)
isSpecifiedModulePath(it.path, finalModulesList)
}.forEach { subProject -> addDependencies(subProject.path) }
dependsOn("copyToRelease")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ package com.tencent.devops.log.service.impl
import com.github.benmanes.caffeine.cache.Caffeine
import com.tencent.devops.common.api.exception.ExecuteException
import com.tencent.devops.common.api.pojo.Page
import com.tencent.devops.common.es.ESClient
import com.tencent.devops.common.es.client.LogClient
import com.tencent.devops.common.log.constant.Constants
import com.tencent.devops.common.log.constant.LogMessageCode.LOG_INDEX_HAS_BEEN_CLEANED
import com.tencent.devops.common.log.pojo.EndPageQueryLogs
import com.tencent.devops.common.log.pojo.LogLine
Expand All @@ -43,7 +45,6 @@ import com.tencent.devops.common.log.pojo.message.LogMessageWithLineNo
import com.tencent.devops.common.redis.RedisLock
import com.tencent.devops.common.redis.RedisOperation
import com.tencent.devops.common.web.utils.I18nUtil
import com.tencent.devops.common.es.ESClient
import com.tencent.devops.log.event.LogOriginEvent
import com.tencent.devops.log.event.LogStatusEvent
import com.tencent.devops.log.event.LogStorageEvent
Expand All @@ -54,17 +55,8 @@ import com.tencent.devops.log.service.IndexService
import com.tencent.devops.log.service.LogService
import com.tencent.devops.log.service.LogStatusService
import com.tencent.devops.log.service.LogTagService
import com.tencent.devops.common.log.constant.Constants
import com.tencent.devops.log.util.ESIndexUtils
import com.tencent.devops.log.util.IndexNameUtils
import java.io.IOException
import java.sql.Date
import java.text.SimpleDateFormat
import java.util.concurrent.TimeUnit
import javax.ws.rs.core.MediaType
import javax.ws.rs.core.Response
import javax.ws.rs.core.StreamingOutput
import kotlin.math.ceil
import org.elasticsearch.ElasticsearchStatusException
import org.elasticsearch.action.admin.indices.open.OpenIndexRequest
import org.elasticsearch.action.bulk.BulkRequest
Expand All @@ -85,7 +77,14 @@ import org.elasticsearch.search.builder.SearchSourceBuilder
import org.elasticsearch.search.fetch.subphase.highlight.HighlightBuilder
import org.elasticsearch.search.sort.SortOrder
import org.slf4j.LoggerFactory
import org.springframework.stereotype.Service
import java.io.IOException
import java.sql.Date
import java.text.SimpleDateFormat
import java.util.concurrent.TimeUnit
import javax.ws.rs.core.MediaType
import javax.ws.rs.core.Response
import javax.ws.rs.core.StreamingOutput
import kotlin.math.ceil

@Suppress(
"LongParameterList",
Expand Down Expand Up @@ -144,7 +143,7 @@ class LogServiceESImpl(
if (doAddMultiLines(buf, event.buildId) == 0) {
throw ExecuteException(
"None of lines is inserted successfully to ES " +
"[${event.buildId}|${event.retryTime}]"
"[${event.buildId}|${event.retryTime}]"
)
} else {
buf.clear()
Expand Down Expand Up @@ -691,7 +690,7 @@ class LogServiceESImpl(
)
logger.info(
"[$index|$buildId|$tag|$subTag|$jobId|$executeCount] " +
"doQueryInitLogs get the query builder: $boolQueryBuilder"
"doQueryInitLogs get the query builder: $boolQueryBuilder"
)

val searchRequest = SearchRequest(index)
Expand Down Expand Up @@ -763,7 +762,7 @@ class LogServiceESImpl(

logger.info(
"[$index|$buildId|$tag|$subTag|$jobId|$executeCount] " +
"doQueryLogsAfterLine get the query builder: $boolQueryBuilder"
"doQueryLogsAfterLine get the query builder: $boolQueryBuilder"
)
val searchRequest = SearchRequest(index)
.source(
Expand Down Expand Up @@ -874,7 +873,7 @@ class LogServiceESImpl(
.must(QueryBuilders.rangeQuery("lineNo").lte(end))
logger.info(
"[$index|$buildId|$tag|$subTag|$jobId|$executeCount] " +
"doQueryLogsBeforeLine get the query builder: $boolQueryBuilder"
"doQueryLogsBeforeLine get the query builder: $boolQueryBuilder"
)
val searchRequest = SearchRequest(index)
.source(
Expand Down Expand Up @@ -1154,7 +1153,7 @@ class LogServiceESImpl(
return try {
logger.info(
"[${createClient.clusterName}][$index]|createIndex|: shards[${createClient.shards}]" +
" replicas[${createClient.replicas}] shardsPerNode[${createClient.shardsPerNode}]"
" replicas[${createClient.replicas}] shardsPerNode[${createClient.shardsPerNode}]"
)
val request = CreateIndexRequest(index)
.settings(
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package com.tencent.devops.multijar

import com.tencent.devops.leaf.plugin.LeafSpringBootProperties
import org.springframework.boot.autoconfigure.AutoConfigureOrder
import org.springframework.context.annotation.Bean
import org.springframework.context.annotation.Configuration
import org.springframework.context.annotation.Primary
import org.springframework.core.Ordered

@Configuration
@AutoConfigureOrder(Ordered.HIGHEST_PRECEDENCE)
class MultijarCommonConfiguration {
@Bean
@Primary
fun leafSpringBootProperties(): LeafSpringBootProperties {
return LeafSpringBootProperties()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
package com.tencent.devops.project.config

import com.tencent.devops.common.redis.RedisOperation
import com.tencent.devops.leaf.plugin.LeafSpringBootProperties
import com.tencent.devops.project.dao.ProjectDao
import com.tencent.devops.project.dao.ProjectLabelRelDao
import com.tencent.devops.project.dispatch.ProjectDispatcher
Expand All @@ -40,7 +39,6 @@ import org.springframework.beans.factory.annotation.Autowired
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean
import org.springframework.context.annotation.Bean
import org.springframework.context.annotation.Configuration
import org.springframework.context.annotation.Primary


@Configuration
Expand All @@ -64,10 +62,4 @@ class OpConfig {
redisOperation = redisOperation,
projectService = projectService
)

@Bean
@Primary
fun leafSpringBootProperties(): LeafSpringBootProperties {
return LeafSpringBootProperties()
}
}

0 comments on commit 23675b5

Please sign in to comment.