├── docs
├── .nojekyll
├── k8s
│ └── deploy.md
├── faq.md
├── dependency
│ ├── versions.md
│ ├── repository.md
│ └── devops-boot-dependencies.md
├── _coverpage.md
├── starter
│ ├── devops-boot-starter-loadbalancer.md
│ ├── devops-boot-starter-circuitbreaker.md
│ ├── devops-boot-starter-api.md
│ └── devops-boot-starter-web.md
├── quick-start.md
├── _sidebar.md
└── index.html
├── version.txt
├── devops-boot-sample
├── gradle.properties
├── boot-java-sample
│ ├── gradle.properties
│ ├── src
│ │ └── main
│ │ │ ├── resources
│ │ │ └── application.yml
│ │ │ └── java
│ │ │ └── com
│ │ │ └── tencent
│ │ │ └── devops
│ │ │ └── sample
│ │ │ └── JavaApplication.java
│ └── build.gradle.kts
├── boot-kotlin-sample
│ ├── .editorconfig
│ ├── build.gradle.kts
│ ├── gradle.properties
│ └── src
│ │ └── main
│ │ ├── resources
│ │ ├── application.yml
│ │ └── bootstrap.yaml
│ │ └── kotlin
│ │ └── com
│ │ └── tencent
│ │ └── devops
│ │ └── sample
│ │ └── KotlinApplication.kt
├── webflux-sample
│ ├── boot-webflux-sample
│ │ ├── build.gradle.kts
│ │ └── src
│ │ │ └── main
│ │ │ ├── resources
│ │ │ ├── application.yml
│ │ │ └── bootstrap.yaml
│ │ │ └── kotlin
│ │ │ └── com
│ │ │ └── tencent
│ │ │ └── devops
│ │ │ └── sample
│ │ │ └── WebFluxApplication.kt
│ ├── api-webflux-sample
│ │ ├── build.gradle.kts
│ │ └── src
│ │ │ └── main
│ │ │ └── kotlin
│ │ │ └── com
│ │ │ └── tencent
│ │ │ └── devops
│ │ │ └── sample
│ │ │ ├── pojo
│ │ │ └── Sample.kt
│ │ │ └── client
│ │ │ └── SampleClient.kt
│ └── biz-webflux-sample
│ │ ├── build.gradle.kts
│ │ └── src
│ │ └── main
│ │ └── kotlin
│ │ └── com
│ │ └── tencent
│ │ └── devops
│ │ └── sample
│ │ ├── config
│ │ ├── GreetingProperties.kt
│ │ ├── RouteConfiguration.kt
│ │ └── BeanConfiguration.kt
│ │ ├── controller
│ │ ├── SampleController.kt
│ │ └── TestController.kt
│ │ ├── filter
│ │ ├── LogWebFilter.kt
│ │ └── SampleHandlerFilterFunction.kt
│ │ └── handler
│ │ └── SampleHandler.kt
├── gradle
│ └── wrapper
│ │ ├── gradle-wrapper.jar
│ │ └── gradle-wrapper.properties
├── plugin-printer
│ ├── gradle.properties
│ ├── src
│ │ └── main
│ │ │ └── kotlin
│ │ │ └── com.tencent.devops.sample
│ │ │ └── SystemIoPrintExtension.kt
│ └── build.gradle.kts
├── api-kotlin-sample
│ ├── build.gradle.kts
│ └── src
│ │ └── main
│ │ └── kotlin
│ │ └── com
│ │ └── tencent
│ │ └── devops
│ │ └── sample
│ │ ├── pojo
│ │ └── Sample.kt
│ │ ├── extension
│ │ └── PrintExtension.kt
│ │ └── client
│ │ └── SampleClient.kt
├── boot-schedule-server-sample
│ ├── build.gradle.kts
│ └── src
│ │ └── main
│ │ ├── resources
│ │ └── bootstrap.yaml
│ │ └── kotlin
│ │ └── com
│ │ └── tencent
│ │ └── devops
│ │ └── schedule
│ │ └── sample
│ │ └── CloudServerApplication.kt
├── boot-schedule-worker-cloud-sample
│ ├── build.gradle.kts
│ └── src
│ │ └── main
│ │ ├── resources
│ │ └── bootstrap.yaml
│ │ └── kotlin
│ │ └── com
│ │ └── tencent
│ │ └── devops
│ │ └── schedule
│ │ └── sample
│ │ ├── CloudWorkerApplication.kt
│ │ └── handler
│ │ └── SampleJobHandler.kt
├── biz-kotlin-sample
│ ├── build.gradle.kts
│ └── src
│ │ └── main
│ │ └── kotlin
│ │ └── com
│ │ └── tencent
│ │ └── devops
│ │ └── sample
│ │ ├── config
│ │ └── GreetingProperties.kt
│ │ └── controller
│ │ ├── SampleController.kt
│ │ └── TestController.kt
├── build.gradle.kts
└── settings.gradle.kts
├── .github
├── config
│ └── changelog-generator.yml
└── workflows
│ ├── build-on-pr.yml
│ ├── create-release.yml
│ └── publish-snapshot.yml
├── devops-boot-project
├── devops-boot-core
│ ├── devops-plugin
│ │ ├── build.gradle.kts
│ │ ├── devops-plugin-api
│ │ │ ├── build.gradle.kts
│ │ │ └── src
│ │ │ │ └── main
│ │ │ │ └── kotlin
│ │ │ │ └── com
│ │ │ │ └── tencent
│ │ │ │ └── devops
│ │ │ │ └── plugin
│ │ │ │ └── api
│ │ │ │ ├── PluginConstants.kt
│ │ │ │ ├── ExtensionPoint.kt
│ │ │ │ ├── Extension.kt
│ │ │ │ ├── ExtensionType.kt
│ │ │ │ ├── PluginScanner.kt
│ │ │ │ ├── PluginManagerExtensions.kt
│ │ │ │ ├── PluginInfo.kt
│ │ │ │ ├── PluginMetadata.kt
│ │ │ │ └── PluginManager.kt
│ │ ├── devops-plugin-processor
│ │ │ ├── src
│ │ │ │ └── main
│ │ │ │ │ ├── resources
│ │ │ │ │ └── META-INF
│ │ │ │ │ │ └── services
│ │ │ │ │ │ └── javax.annotation.processing.Processor
│ │ │ │ │ └── kotlin
│ │ │ │ │ └── com
│ │ │ │ │ └── tencent
│ │ │ │ │ └── devops
│ │ │ │ │ └── plugin
│ │ │ │ │ └── processor
│ │ │ │ │ └── ExtensionFiles.kt
│ │ │ └── build.gradle.kts
│ │ └── devops-plugin-core
│ │ │ ├── src
│ │ │ └── main
│ │ │ │ ├── resources
│ │ │ │ └── META-INF
│ │ │ │ │ └── spring
│ │ │ │ │ └── org.springframework.boot.autoconfigure.AutoConfiguration.imports
│ │ │ │ └── kotlin
│ │ │ │ └── com
│ │ │ │ └── tencent
│ │ │ │ └── devops
│ │ │ │ └── plugin
│ │ │ │ ├── config
│ │ │ │ └── PluginProperties.kt
│ │ │ │ ├── core
│ │ │ │ └── PluginClassLoader.kt
│ │ │ │ └── spring
│ │ │ │ └── PluginEndpointAutoConfiguration.kt
│ │ │ └── build.gradle.kts
│ ├── devops-schedule
│ │ ├── build.gradle.kts
│ │ ├── devops-schedule-server
│ │ │ ├── src
│ │ │ │ └── main
│ │ │ │ │ ├── resources
│ │ │ │ │ ├── frontend
│ │ │ │ │ │ ├── .eslintignore
│ │ │ │ │ │ ├── .env.development
│ │ │ │ │ │ ├── src
│ │ │ │ │ │ │ ├── layout
│ │ │ │ │ │ │ │ └── components
│ │ │ │ │ │ │ │ │ ├── index.js
│ │ │ │ │ │ │ │ │ ├── Sidebar
│ │ │ │ │ │ │ │ │ ├── FixiOSBug.js
│ │ │ │ │ │ │ │ │ ├── Link.vue
│ │ │ │ │ │ │ │ │ └── Item.vue
│ │ │ │ │ │ │ │ │ └── AppMain.vue
│ │ │ │ │ │ │ ├── App.vue
│ │ │ │ │ │ │ ├── assets
│ │ │ │ │ │ │ │ └── 404_images
│ │ │ │ │ │ │ │ │ ├── 404.png
│ │ │ │ │ │ │ │ │ └── 404_cloud.png
│ │ │ │ │ │ │ ├── views
│ │ │ │ │ │ │ │ ├── dashboard
│ │ │ │ │ │ │ │ │ └── index.vue
│ │ │ │ │ │ │ │ └── group
│ │ │ │ │ │ │ │ │ └── index.vue
│ │ │ │ │ │ │ ├── store
│ │ │ │ │ │ │ │ ├── getters.js
│ │ │ │ │ │ │ │ ├── index.js
│ │ │ │ │ │ │ │ └── modules
│ │ │ │ │ │ │ │ │ ├── settings.js
│ │ │ │ │ │ │ │ │ └── app.js
│ │ │ │ │ │ │ ├── icons
│ │ │ │ │ │ │ │ ├── svg
│ │ │ │ │ │ │ │ │ ├── link.svg
│ │ │ │ │ │ │ │ │ ├── user.svg
│ │ │ │ │ │ │ │ │ ├── example.svg
│ │ │ │ │ │ │ │ │ ├── table.svg
│ │ │ │ │ │ │ │ │ ├── password.svg
│ │ │ │ │ │ │ │ │ ├── nested.svg
│ │ │ │ │ │ │ │ │ ├── eye.svg
│ │ │ │ │ │ │ │ │ └── eye-open.svg
│ │ │ │ │ │ │ │ ├── index.js
│ │ │ │ │ │ │ │ └── svgo.yml
│ │ │ │ │ │ │ ├── api
│ │ │ │ │ │ │ │ ├── log.js
│ │ │ │ │ │ │ │ ├── user.js
│ │ │ │ │ │ │ │ ├── group.js
│ │ │ │ │ │ │ │ └── job.js
│ │ │ │ │ │ │ ├── utils
│ │ │ │ │ │ │ │ ├── get-page-title.js
│ │ │ │ │ │ │ │ ├── auth.js
│ │ │ │ │ │ │ │ └── validate.js
│ │ │ │ │ │ │ ├── settings.js
│ │ │ │ │ │ │ ├── styles
│ │ │ │ │ │ │ │ ├── mixin.scss
│ │ │ │ │ │ │ │ ├── variables.scss
│ │ │ │ │ │ │ │ ├── element-ui.scss
│ │ │ │ │ │ │ │ ├── transition.scss
│ │ │ │ │ │ │ │ └── index.scss
│ │ │ │ │ │ │ ├── main.js
│ │ │ │ │ │ │ └── components
│ │ │ │ │ │ │ │ └── basic-container
│ │ │ │ │ │ │ │ └── main.vue
│ │ │ │ │ │ ├── jsconfig.json
│ │ │ │ │ │ ├── public
│ │ │ │ │ │ │ ├── favicon.ico
│ │ │ │ │ │ │ └── index.html
│ │ │ │ │ │ ├── postcss.config.js
│ │ │ │ │ │ ├── .editorconfig
│ │ │ │ │ │ ├── babel.config.js
│ │ │ │ │ │ └── build
│ │ │ │ │ │ │ └── index.js
│ │ │ │ │ └── META-INF
│ │ │ │ │ │ └── spring
│ │ │ │ │ │ └── org.springframework.boot.autoconfigure.AutoConfiguration.imports
│ │ │ │ │ └── kotlin
│ │ │ │ │ └── com
│ │ │ │ │ └── tencent
│ │ │ │ │ └── devops
│ │ │ │ │ └── schedule
│ │ │ │ │ ├── pojo
│ │ │ │ │ ├── UserInfo.kt
│ │ │ │ │ ├── TokenInfo.kt
│ │ │ │ │ └── UserLoginRequest.kt
│ │ │ │ │ ├── scheduler
│ │ │ │ │ ├── event
│ │ │ │ │ │ ├── JobEvent.kt
│ │ │ │ │ │ ├── JobMisfireEvent.kt
│ │ │ │ │ │ └── JobTriggerEvent.kt
│ │ │ │ │ └── JobTriggerContext.kt
│ │ │ │ │ ├── router
│ │ │ │ │ ├── WorkerRouteRandom.kt
│ │ │ │ │ ├── WorkerRouter.kt
│ │ │ │ │ └── WorkerRouteLeastJob.kt
│ │ │ │ │ ├── remote
│ │ │ │ │ └── RemoteWorkerRpcClient.kt
│ │ │ │ │ ├── utils
│ │ │ │ │ └── ScheduleUtils.kt
│ │ │ │ │ └── config
│ │ │ │ │ └── ScheduleServerWebUiConfigurer.kt
│ │ │ └── build.gradle.kts
│ │ ├── devops-schedule-model-mongodb
│ │ │ ├── src
│ │ │ │ └── main
│ │ │ │ │ ├── resources
│ │ │ │ │ └── META-INF
│ │ │ │ │ │ └── spring
│ │ │ │ │ │ └── org.springframework.boot.autoconfigure.AutoConfiguration.imports
│ │ │ │ │ └── kotlin
│ │ │ │ │ └── com
│ │ │ │ │ └── tencent
│ │ │ │ │ └── devops
│ │ │ │ │ └── schedule
│ │ │ │ │ └── mongo
│ │ │ │ │ ├── repository
│ │ │ │ │ ├── JobRepository.kt
│ │ │ │ │ ├── LockRepository.kt
│ │ │ │ │ ├── LogRepository.kt
│ │ │ │ │ ├── WorkerGroupRepository.kt
│ │ │ │ │ └── WorkerRepository.kt
│ │ │ │ │ └── model
│ │ │ │ │ ├── TLockInfo.kt
│ │ │ │ │ ├── TWorker.kt
│ │ │ │ │ └── TWorkerGroup.kt
│ │ │ └── build.gradle.kts
│ │ ├── devops-schedule-common
│ │ │ ├── src
│ │ │ │ └── main
│ │ │ │ │ └── kotlin
│ │ │ │ │ └── com
│ │ │ │ │ └── tencent
│ │ │ │ │ └── devops
│ │ │ │ │ └── schedule
│ │ │ │ │ ├── pojo
│ │ │ │ │ ├── worker
│ │ │ │ │ │ ├── WorkerGroupName.kt
│ │ │ │ │ │ ├── WorkerGroupCreateRequest.kt
│ │ │ │ │ │ ├── WorkerGroupQueryParam.kt
│ │ │ │ │ │ ├── WorkerInfo.kt
│ │ │ │ │ │ └── WorkerGroup.kt
│ │ │ │ │ ├── page
│ │ │ │ │ │ ├── BasePageRequest.kt
│ │ │ │ │ │ └── Page.kt
│ │ │ │ │ ├── trigger
│ │ │ │ │ │ ├── HeartBeatParam.kt
│ │ │ │ │ │ └── TriggerParam.kt
│ │ │ │ │ ├── job
│ │ │ │ │ │ ├── JobQueryParam.kt
│ │ │ │ │ │ └── JobExecutionResult.kt
│ │ │ │ │ ├── log
│ │ │ │ │ │ └── LogQueryParam.kt
│ │ │ │ │ └── ScheduleResponse.kt
│ │ │ │ │ ├── enums
│ │ │ │ │ ├── DictItem.kt
│ │ │ │ │ ├── WorkerStatusEnum.kt
│ │ │ │ │ ├── TriggerCodeEnum.kt
│ │ │ │ │ ├── TriggerTypeEnum.kt
│ │ │ │ │ ├── DictItemSerializable.kt
│ │ │ │ │ ├── BlockStrategyEnum.kt
│ │ │ │ │ ├── ExecutionCodeEnum.kt
│ │ │ │ │ ├── TriggerStatusEnum.kt
│ │ │ │ │ ├── AlarmStatusEnum.kt
│ │ │ │ │ ├── DiscoveryTypeEnum.kt
│ │ │ │ │ ├── MisfireStrategyEnum.kt
│ │ │ │ │ ├── RouteStrategyEnum.kt
│ │ │ │ │ ├── ScheduleTypeEnum.kt
│ │ │ │ │ └── JobModeEnum.kt
│ │ │ │ │ ├── api
│ │ │ │ │ ├── WorkerRpcClient.kt
│ │ │ │ │ ├── ServerRpcClient.kt
│ │ │ │ │ ├── RpcAuthRequestInterceptor.kt
│ │ │ │ │ └── RpcAuthWebInterceptor.kt
│ │ │ │ │ ├── constants
│ │ │ │ │ ├── ApiConstants.kt
│ │ │ │ │ └── JobConstants.kt
│ │ │ │ │ └── utils
│ │ │ │ │ ├── Preconditions.kt
│ │ │ │ │ └── ThreadUtils.kt
│ │ │ └── build.gradle.kts
│ │ ├── devops-schedule-model
│ │ │ ├── build.gradle.kts
│ │ │ └── src
│ │ │ │ └── main
│ │ │ │ └── kotlin
│ │ │ │ └── com
│ │ │ │ └── tencent
│ │ │ │ └── devops
│ │ │ │ └── schedule
│ │ │ │ ├── provider
│ │ │ │ └── LockProvider.kt
│ │ │ │ └── utils
│ │ │ │ └── Conventions.kt
│ │ └── devops-schedule-worker
│ │ │ ├── src
│ │ │ └── main
│ │ │ │ ├── resources
│ │ │ │ └── META-INF
│ │ │ │ │ └── spring
│ │ │ │ │ └── org.springframework.boot.autoconfigure.AutoConfiguration.imports
│ │ │ │ └── kotlin
│ │ │ │ └── com
│ │ │ │ └── tencent
│ │ │ │ └── devops
│ │ │ │ └── schedule
│ │ │ │ ├── hearbeat
│ │ │ │ ├── NoOpHeartbeat.kt
│ │ │ │ ├── Heartbeat.kt
│ │ │ │ └── AbstractHeartbeat.kt
│ │ │ │ ├── k8s
│ │ │ │ ├── K8sProperties.kt
│ │ │ │ ├── ResourceLimitProperties.kt
│ │ │ │ ├── K8sExtensions.kt
│ │ │ │ └── K8sHelper.kt
│ │ │ │ ├── thread
│ │ │ │ ├── TriggerTask.kt
│ │ │ │ └── JobThreadGroup.kt
│ │ │ │ ├── constants
│ │ │ │ └── WorkerRegistryMode.kt
│ │ │ │ ├── executor
│ │ │ │ ├── JobExecutor.kt
│ │ │ │ ├── JobHandler.kt
│ │ │ │ └── JobContext.kt
│ │ │ │ ├── handler
│ │ │ │ └── JobSystemEnv.kt
│ │ │ │ └── config
│ │ │ │ ├── ScheduleWorkerWebConfiguration.kt
│ │ │ │ └── ScheduleWorkerWebAuthConfigurer.kt
│ │ │ └── build.gradle.kts
│ ├── devops-circuitbreaker
│ │ ├── src
│ │ │ └── main
│ │ │ │ ├── resources
│ │ │ │ ├── common-circuitbreaker.properties
│ │ │ │ └── META-INF
│ │ │ │ │ └── spring
│ │ │ │ │ └── org.springframework.boot.autoconfigure.AutoConfiguration.imports
│ │ │ │ └── kotlin
│ │ │ │ └── com
│ │ │ │ └── tencent
│ │ │ │ └── devops
│ │ │ │ └── circuitbreaker
│ │ │ │ └── CircuitBreakerAutoConfiguration.kt
│ │ └── build.gradle.kts
│ ├── devops-webmvc
│ │ ├── src
│ │ │ └── main
│ │ │ │ ├── resources
│ │ │ │ ├── common-webmvc.properties
│ │ │ │ └── META-INF
│ │ │ │ │ └── spring
│ │ │ │ │ └── org.springframework.boot.autoconfigure.AutoConfiguration.imports
│ │ │ │ └── kotlin
│ │ │ │ └── com
│ │ │ │ └── tencent
│ │ │ │ └── devops
│ │ │ │ └── webmvc
│ │ │ │ └── WebMvcAutoConfiguration.kt
│ │ └── build.gradle.kts
│ ├── devops-common
│ │ ├── build.gradle.kts
│ │ └── src
│ │ │ └── main
│ │ │ └── kotlin
│ │ │ └── com
│ │ │ └── tencent
│ │ │ └── devops
│ │ │ └── common
│ │ │ └── time
│ │ │ └── TimeExtensions.kt
│ ├── devops-boot
│ │ ├── build.gradle.kts
│ │ └── src
│ │ │ └── main
│ │ │ └── kotlin
│ │ │ └── com
│ │ │ └── tencent
│ │ │ └── devops
│ │ │ └── boot
│ │ │ └── DevOpsApplicationExtensions.kt
│ ├── devops-pulsar
│ │ ├── src
│ │ │ └── main
│ │ │ │ └── resources
│ │ │ │ └── META-INF
│ │ │ │ ├── spring.binders
│ │ │ │ └── spring
│ │ │ │ └── org.springframework.boot.autoconfigure.AutoConfiguration.imports
│ │ └── build.gradle.kts
│ ├── devops-web
│ │ ├── src
│ │ │ └── main
│ │ │ │ ├── resources
│ │ │ │ ├── META-INF
│ │ │ │ │ ├── spring
│ │ │ │ │ │ └── org.springframework.boot.autoconfigure.AutoConfiguration.imports
│ │ │ │ │ └── spring.factories
│ │ │ │ ├── common-web.properties
│ │ │ │ └── banner.txt
│ │ │ │ └── kotlin
│ │ │ │ └── com
│ │ │ │ └── tencent
│ │ │ │ └── devops
│ │ │ │ └── web
│ │ │ │ ├── banner
│ │ │ │ └── DevOpsBannerInitializer.kt
│ │ │ │ ├── WebAutoConfiguration.kt
│ │ │ │ └── jackson
│ │ │ │ └── JacksonConfiguration.kt
│ │ └── build.gradle.kts
│ ├── devops-service
│ │ ├── src
│ │ │ └── main
│ │ │ │ ├── resources
│ │ │ │ └── META-INF
│ │ │ │ │ ├── spring
│ │ │ │ │ └── org.springframework.boot.autoconfigure.AutoConfiguration.imports
│ │ │ │ │ └── spring.factories
│ │ │ │ └── kotlin
│ │ │ │ └── com
│ │ │ │ └── tencent
│ │ │ │ └── devops
│ │ │ │ └── service
│ │ │ │ ├── ServiceAutoConfiguration.kt
│ │ │ │ └── config
│ │ │ │ └── ServiceProperties.kt
│ │ └── build.gradle.kts
│ ├── devops-logging
│ │ ├── src
│ │ │ └── main
│ │ │ │ ├── resources
│ │ │ │ ├── META-INF
│ │ │ │ │ ├── spring
│ │ │ │ │ │ └── org.springframework.boot.autoconfigure.AutoConfiguration.imports
│ │ │ │ │ └── spring.factories
│ │ │ │ └── logback-spring.xml
│ │ │ │ └── kotlin
│ │ │ │ └── com
│ │ │ │ └── tencent
│ │ │ │ └── devops
│ │ │ │ └── logging
│ │ │ │ ├── enums
│ │ │ │ └── LogType.kt
│ │ │ │ ├── system
│ │ │ │ ├── java
│ │ │ │ │ ├── DevopsJavaLoggingSystem.kt
│ │ │ │ │ └── DevopsJavaSystemProperties.kt
│ │ │ │ ├── log4j
│ │ │ │ │ ├── DevopsLog4J2LoggingSystem.kt
│ │ │ │ │ └── DevopsLog4J2SystemProperties.kt
│ │ │ │ ├── logback
│ │ │ │ │ ├── DevopsLogbackLoggingSystem.kt
│ │ │ │ │ └── DevopsLogbackSystemProperties.kt
│ │ │ │ └── DevopsLoggingApplicationListener.kt
│ │ │ │ ├── LoggingAutoConfiguration.kt
│ │ │ │ └── props
│ │ │ │ └── DevopsLoggingProperties.kt
│ │ └── build.gradle.kts
│ ├── devops-loadbalancer
│ │ ├── src
│ │ │ └── main
│ │ │ │ ├── resources
│ │ │ │ └── META-INF
│ │ │ │ │ └── spring
│ │ │ │ │ └── org.springframework.boot.autoconfigure.AutoConfiguration.imports
│ │ │ │ └── kotlin
│ │ │ │ └── com
│ │ │ │ └── tencent
│ │ │ │ └── devops
│ │ │ │ └── loadbalancer
│ │ │ │ ├── LoadBalancerAutoConfiguration.kt
│ │ │ │ └── config
│ │ │ │ └── DevOpsLoadBalancerProperties.kt
│ │ └── build.gradle.kts
│ ├── devops-service-servlet
│ │ ├── src
│ │ │ └── main
│ │ │ │ ├── resources
│ │ │ │ ├── META-INF
│ │ │ │ │ └── spring
│ │ │ │ │ │ └── org.springframework.boot.autoconfigure.AutoConfiguration.imports
│ │ │ │ └── common-service.properties
│ │ │ │ └── kotlin
│ │ │ │ └── com
│ │ │ │ └── tencent
│ │ │ │ └── devops
│ │ │ │ └── service
│ │ │ │ └── feign
│ │ │ │ └── FeignFilterRequestMappingHandlerMapping.kt
│ │ └── build.gradle.kts
│ ├── devops-service-reactive
│ │ ├── src
│ │ │ └── main
│ │ │ │ ├── resources
│ │ │ │ └── META-INF
│ │ │ │ │ └── spring
│ │ │ │ │ └── org.springframework.boot.autoconfigure.AutoConfiguration.imports
│ │ │ │ └── kotlin
│ │ │ │ └── com
│ │ │ │ └── tencent
│ │ │ │ └── devops
│ │ │ │ └── service
│ │ │ │ ├── feign
│ │ │ │ └── FeignFilterRequestMappingHandlerMapping.kt
│ │ │ │ └── ServiceReactiveAutoConfiguration.kt
│ │ └── build.gradle.kts
│ ├── devops-api
│ │ ├── build.gradle.kts
│ │ └── src
│ │ │ └── main
│ │ │ └── kotlin
│ │ │ └── com
│ │ │ └── tencent
│ │ │ └── devops
│ │ │ └── api
│ │ │ └── http
│ │ │ └── MediaTypes.kt
│ ├── devops-webflux
│ │ ├── build.gradle.kts
│ │ └── src
│ │ │ └── main
│ │ │ └── kotlin
│ │ │ └── com
│ │ │ └── tencent
│ │ │ └── devops
│ │ │ └── webflux
│ │ │ └── filter
│ │ │ ├── CoHandlerFilterFunction.kt
│ │ │ └── CoWebFilter.kt
│ └── devops-utils
│ │ └── build.gradle.kts
├── devops-boot-tools
│ ├── devops-gradle-plugin-common
│ │ └── build.gradle.kts
│ ├── build.gradle.kts
│ ├── devops-boot-gradle-plugin
│ │ ├── src
│ │ │ └── main
│ │ │ │ └── kotlin
│ │ │ │ └── com
│ │ │ │ └── tencent
│ │ │ │ └── devops
│ │ │ │ ├── enums
│ │ │ │ └── AssemblyMode.kt
│ │ │ │ ├── conventions
│ │ │ │ ├── JUnitConvention.kt
│ │ │ │ ├── JavaConvention.kt
│ │ │ │ └── SpringBootConvention.kt
│ │ │ │ └── actions
│ │ │ │ ├── KtLintCheckAction.kt
│ │ │ │ ├── KtLintFormatAction.kt
│ │ │ │ └── CopyToReleaseAction.kt
│ │ └── build.gradle.kts
│ ├── devops-release-gradle-plugin
│ │ ├── src
│ │ │ └── main
│ │ │ │ └── kotlin
│ │ │ │ └── com
│ │ │ │ └── tencent
│ │ │ │ └── devops
│ │ │ │ └── dsl
│ │ │ │ └── DevOpsReleasePluginExtension.kt
│ │ └── build.gradle.kts
│ └── devops-publish-gradle-plugin
│ │ └── build.gradle.kts
└── devops-boot-starters
│ ├── devops-boot-starter-api
│ └── build.gradle.kts
│ ├── devops-boot-starter-logging
│ └── build.gradle.kts
│ ├── devops-boot-starter-loadbalancer
│ └── build.gradle.kts
│ ├── devops-boot-starter-plugin
│ └── build.gradle.kts
│ ├── devops-boot-starter-circuitbreaker
│ └── build.gradle.kts
│ ├── devops-boot-starter-schedule-worker
│ └── build.gradle.kts
│ ├── devops-boot-starter-schedule-server
│ └── build.gradle.kts
│ ├── devops-boot-starter-stream
│ └── build.gradle.kts
│ ├── devops-boot-starter-web
│ └── build.gradle.kts
│ ├── devops-boot-starter-webflux
│ └── build.gradle.kts
│ ├── devops-boot-starter-service
│ └── build.gradle.kts
│ ├── devops-boot-starter-service-reactive
│ └── build.gradle.kts
│ └── build.gradle.kts
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradle.properties
├── .gitignore
├── settings.gradle.kts
└── LICENSE
/docs/.nojekyll:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/version.txt:
--------------------------------------------------------------------------------
1 | 1.1.1-SNAPSHOT
--------------------------------------------------------------------------------
/docs/k8s/deploy.md:
--------------------------------------------------------------------------------
1 | # 云原生部署
2 | ?> 待补充
3 |
--------------------------------------------------------------------------------
/docs/faq.md:
--------------------------------------------------------------------------------
1 | # 常见问题
2 | 本篇整理大家经常遇到的一些问题,如有补充,欢迎提交pr
3 |
4 | ---
5 |
--------------------------------------------------------------------------------
/devops-boot-sample/gradle.properties:
--------------------------------------------------------------------------------
1 | kotlin.internal.mpp12x.deprecation.suppress=true
--------------------------------------------------------------------------------
/devops-boot-sample/boot-java-sample/gradle.properties:
--------------------------------------------------------------------------------
1 | devops.kotlin=false
2 | devops.javaVersion=17
3 |
--------------------------------------------------------------------------------
/devops-boot-sample/boot-kotlin-sample/.editorconfig:
--------------------------------------------------------------------------------
1 | [*.{kt,kts}]
2 | disabled_rules=import-ordering
3 |
--------------------------------------------------------------------------------
/.github/config/changelog-generator.yml:
--------------------------------------------------------------------------------
1 | changelog:
2 | repository: bkdevops-projects/devops-framework
3 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-plugin/build.gradle.kts:
--------------------------------------------------------------------------------
1 | description = "DevOps Boot Plugin"
2 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-schedule/build.gradle.kts:
--------------------------------------------------------------------------------
1 | description = "DevOps Boot Schedule"
2 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-plugin/devops-plugin-api/build.gradle.kts:
--------------------------------------------------------------------------------
1 | description = "DevOps Boot Plugin Api"
2 |
--------------------------------------------------------------------------------
/devops-boot-sample/boot-kotlin-sample/build.gradle.kts:
--------------------------------------------------------------------------------
1 | dependencies {
2 | implementation(project(":biz-kotlin-sample"))
3 | }
4 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bkdevops-projects/devops-framework/HEAD/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-circuitbreaker/src/main/resources/common-circuitbreaker.properties:
--------------------------------------------------------------------------------
1 | feign.circuitbreaker.enabled=true
2 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-webmvc/src/main/resources/common-webmvc.properties:
--------------------------------------------------------------------------------
1 | spring.mvc.pathmatch.matching-strategy=ANT_PATH_MATCHER
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-schedule/devops-schedule-server/src/main/resources/frontend/.eslintignore:
--------------------------------------------------------------------------------
1 | build/*.js
2 | src/assets
3 | public
4 | dist
5 |
--------------------------------------------------------------------------------
/devops-boot-sample/boot-kotlin-sample/gradle.properties:
--------------------------------------------------------------------------------
1 | devops.kotlin=true
2 | devops.javaVersion=17
3 | devops.copyWithVersion=false
4 | devops.assemblyMode=consul
5 |
--------------------------------------------------------------------------------
/devops-boot-sample/webflux-sample/boot-webflux-sample/build.gradle.kts:
--------------------------------------------------------------------------------
1 | dependencies {
2 | implementation(project(":webflux-sample:biz-webflux-sample"))
3 | }
4 |
--------------------------------------------------------------------------------
/devops-boot-sample/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bkdevops-projects/devops-framework/HEAD/devops-boot-sample/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-common/build.gradle.kts:
--------------------------------------------------------------------------------
1 | description = "DevOps Boot Common"
2 |
3 | dependencies {
4 | api("com.tencent.bk.sdk:crypto-java-sdk")
5 | }
--------------------------------------------------------------------------------
/devops-boot-sample/boot-java-sample/src/main/resources/application.yml:
--------------------------------------------------------------------------------
1 | spring:
2 | application:
3 | name: java-sample
4 | cloud:
5 | consul:
6 | enabled: false
7 |
--------------------------------------------------------------------------------
/devops-boot-sample/plugin-printer/gradle.properties:
--------------------------------------------------------------------------------
1 | pluginId=demo
2 | pluginVersion=1.0.0
3 | pluginScope=*
4 | pluginAuthor=carrypan
5 | pluginDescription=plugin demonstration
6 |
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | org.gradle.caching=true
2 | org.gradle.parallel=true
3 | org.gradle.jvmargs=-Xms1g -Xmx2g
4 | org.gradle.daemon.idletimeout=60000
5 | kapt.incremental.apt=false
6 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-boot/build.gradle.kts:
--------------------------------------------------------------------------------
1 | description = "DevOps Boot"
2 |
3 | dependencies {
4 | compileOnly("org.springframework.boot:spring-boot")
5 | }
6 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-pulsar/src/main/resources/META-INF/spring.binders:
--------------------------------------------------------------------------------
1 | pulsar:com.tencent.devops.stream.binder.pulsar.autoconfigurate.PulsarBinderAutoConfiguration
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-tools/devops-gradle-plugin-common/build.gradle.kts:
--------------------------------------------------------------------------------
1 | description = "DevOps Gradle Plugin Common"
2 |
3 | dependencies {
4 | api(gradleApi())
5 | }
6 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-web/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports:
--------------------------------------------------------------------------------
1 | com.tencent.devops.web.WebAutoConfiguration
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-service/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports:
--------------------------------------------------------------------------------
1 | com.tencent.devops.service.ServiceAutoConfiguration
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-webmvc/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports:
--------------------------------------------------------------------------------
1 | com.tencent.devops.webmvc.WebMvcAutoConfiguration
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-logging/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports:
--------------------------------------------------------------------------------
1 | com.tencent.devops.logging.LoggingAutoConfiguration
2 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-loadbalancer/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports:
--------------------------------------------------------------------------------
1 | com.tencent.devops.loadbalancer.LoadBalancerAutoConfiguration
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-plugin/devops-plugin-processor/src/main/resources/META-INF/services/javax.annotation.processing.Processor:
--------------------------------------------------------------------------------
1 | com.tencent.devops.plugin.processor.ExtensionAnnotationProcessor
2 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-service-servlet/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports:
--------------------------------------------------------------------------------
1 | com.tencent.devops.service.ServiceServletAutoConfiguration
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-web/src/main/resources/META-INF/spring.factories:
--------------------------------------------------------------------------------
1 | org.springframework.context.ApplicationContextInitializer=\
2 | com.tencent.devops.web.banner.DevOpsBannerInitializer
3 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-circuitbreaker/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports:
--------------------------------------------------------------------------------
1 | com.tencent.devops.circuitbreaker.CircuitBreakerAutoConfiguration
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-logging/src/main/resources/META-INF/spring.factories:
--------------------------------------------------------------------------------
1 | org.springframework.context.ApplicationListener=\
2 | com.tencent.devops.logging.system.DevopsLoggingApplicationListener
3 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-service-reactive/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports:
--------------------------------------------------------------------------------
1 | com.tencent.devops.service.ServiceReactiveAutoConfiguration
--------------------------------------------------------------------------------
/devops-boot-sample/boot-java-sample/build.gradle.kts:
--------------------------------------------------------------------------------
1 | dependencies {
2 | implementation("com.tencent.devops:devops-boot-starter-service")
3 | implementation("com.tencent.devops:devops-boot-starter-logging")
4 | }
5 |
--------------------------------------------------------------------------------
/docs/dependency/versions.md:
--------------------------------------------------------------------------------
1 | # 依赖版本列表
2 |
3 | ?> 请参考[build.gradle.kts](https://github.com/bkdevops-projects/devops-framework/blob/master/devops-boot-project/devops-boot-dependencies/build.gradle.kts)的`constraints`列表
4 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-loadbalancer/build.gradle.kts:
--------------------------------------------------------------------------------
1 | description = "DevOps Boot Load Balancer"
2 |
3 | dependencies {
4 | api("org.springframework.cloud:spring-cloud-starter-loadbalancer")
5 | }
6 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-service/src/main/resources/META-INF/spring.factories:
--------------------------------------------------------------------------------
1 | org.springframework.boot.env.EnvironmentPostProcessor=\
2 | com.tencent.devops.service.ServiceBootstrapEnvironmentPostProcessor
3 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-api/build.gradle.kts:
--------------------------------------------------------------------------------
1 | description = "DevOps Boot Api"
2 |
3 | dependencies {
4 | api("io.swagger.core.v3:swagger-annotations")
5 | api("io.swagger.core.v3:swagger-models")
6 | }
7 |
--------------------------------------------------------------------------------
/devops-boot-sample/webflux-sample/api-webflux-sample/build.gradle.kts:
--------------------------------------------------------------------------------
1 | dependencies {
2 | api("com.tencent.devops:devops-boot-starter-api")
3 | compileOnly("org.springframework.cloud:spring-cloud-openfeign-core")
4 | }
5 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-schedule/devops-schedule-server/src/main/resources/frontend/.env.development:
--------------------------------------------------------------------------------
1 | # just a flag
2 | ENV = 'development'
3 |
4 | # base api
5 | VUE_APP_BASE_API = 'http://localhost:8080/api/v1/'
6 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-starters/devops-boot-starter-api/build.gradle.kts:
--------------------------------------------------------------------------------
1 | description = "Starter for DevOps Boot Api"
2 |
3 | dependencies {
4 | api(project(":devops-boot-project:devops-boot-core:devops-api"))
5 | }
6 |
7 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-circuitbreaker/build.gradle.kts:
--------------------------------------------------------------------------------
1 | description = "DevOps Boot Circuit Breaker"
2 |
3 | dependencies {
4 | api("org.springframework.cloud:spring-cloud-starter-circuitbreaker-resilience4j")
5 | }
6 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-schedule/devops-schedule-server/src/main/kotlin/com/tencent/devops/schedule/pojo/UserInfo.kt:
--------------------------------------------------------------------------------
1 | package com.tencent.devops.schedule.pojo
2 |
3 | data class UserInfo(
4 | val name: String
5 | )
6 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-plugin/devops-plugin-api/src/main/kotlin/com/tencent/devops/plugin/api/PluginConstants.kt:
--------------------------------------------------------------------------------
1 | package com.tencent.devops.plugin.api
2 |
3 | const val EXTENSION_LOCATION = "META-INF/extensions.factories"
4 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-schedule/devops-schedule-server/src/main/kotlin/com/tencent/devops/schedule/pojo/TokenInfo.kt:
--------------------------------------------------------------------------------
1 | package com.tencent.devops.schedule.pojo
2 |
3 | data class TokenInfo(
4 | val token: String
5 | )
6 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-starters/devops-boot-starter-logging/build.gradle.kts:
--------------------------------------------------------------------------------
1 | description = "Starter for DevOps Boot Logging"
2 |
3 | dependencies {
4 | api(project(":devops-boot-project:devops-boot-core:devops-logging"))
5 | }
6 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-schedule/devops-schedule-model-mongodb/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports:
--------------------------------------------------------------------------------
1 | com.tencent.devops.schedule.mongo.config.MongoModelAutoConfiguration
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-plugin/devops-plugin-api/src/main/kotlin/com/tencent/devops/plugin/api/ExtensionPoint.kt:
--------------------------------------------------------------------------------
1 | package com.tencent.devops.plugin.api
2 |
3 | /**
4 | * 扩展点
5 | * 插件中的扩展类需要实现该接口
6 | */
7 | interface ExtensionPoint
8 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-pulsar/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports:
--------------------------------------------------------------------------------
1 | com.tencent.devops.stream.binder.pulsar.autoconfigurate.ExtendedBindingHandlerMappingsProviderConfiguration
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-starters/devops-boot-starter-loadbalancer/build.gradle.kts:
--------------------------------------------------------------------------------
1 | description = "Starter for DevOps Boot Load Balancer"
2 |
3 | dependencies {
4 | api(project(":devops-boot-project:devops-boot-core:devops-loadbalancer"))
5 | }
6 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-starters/devops-boot-starter-plugin/build.gradle.kts:
--------------------------------------------------------------------------------
1 | description = "Starter for DevOps Boot Plugin"
2 |
3 | dependencies {
4 | api(project(":devops-boot-project:devops-boot-core:devops-plugin:devops-plugin-core"))
5 | }
6 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionBase=GRADLE_USER_HOME
2 | distributionPath=wrapper/dists
3 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-logging/build.gradle.kts:
--------------------------------------------------------------------------------
1 | description = "DevOps Boot Logging"
2 |
3 | dependencies {
4 | api("org.springframework.boot:spring-boot-starter-logging")
5 | api("org.springframework.boot:spring-boot-starter")
6 | }
7 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-starters/devops-boot-starter-circuitbreaker/build.gradle.kts:
--------------------------------------------------------------------------------
1 | description = "Starter for DevOps Boot Circuit Breaker"
2 |
3 | dependencies {
4 | api(project(":devops-boot-project:devops-boot-core:devops-circuitbreaker"))
5 | }
6 |
--------------------------------------------------------------------------------
/devops-boot-sample/api-kotlin-sample/build.gradle.kts:
--------------------------------------------------------------------------------
1 | dependencies {
2 | api("com.tencent.devops:devops-boot-starter-api")
3 | api("com.tencent.devops:devops-plugin-api")
4 | compileOnly("org.springframework.cloud:spring-cloud-openfeign-core")
5 | }
6 |
--------------------------------------------------------------------------------
/devops-boot-sample/boot-schedule-server-sample/build.gradle.kts:
--------------------------------------------------------------------------------
1 | dependencies {
2 | api("com.tencent.devops:devops-boot-starter-service")
3 | api("com.tencent.devops:devops-boot-starter-schedule-server")
4 | api("io.micrometer:micrometer-registry-prometheus")
5 | }
6 |
--------------------------------------------------------------------------------
/devops-boot-sample/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionBase=GRADLE_USER_HOME
2 | distributionPath=wrapper/dists
3 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-plugin/devops-plugin-core/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports:
--------------------------------------------------------------------------------
1 | com.tencent.devops.plugin.PluginAutoConfiguration
2 | com.tencent.devops.plugin.spring.PluginEndpointAutoConfiguration
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-schedule/devops-schedule-server/src/main/resources/frontend/src/layout/components/index.js:
--------------------------------------------------------------------------------
1 | export { default as Navbar } from './Navbar'
2 | export { default as Sidebar } from './Sidebar'
3 | export { default as AppMain } from './AppMain'
4 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-starters/devops-boot-starter-schedule-worker/build.gradle.kts:
--------------------------------------------------------------------------------
1 | description = "Starter for DevOps Boot Schedule Worker"
2 |
3 | dependencies {
4 | api(project(":devops-boot-project:devops-boot-core:devops-schedule:devops-schedule-worker"))
5 | }
6 |
--------------------------------------------------------------------------------
/devops-boot-sample/boot-schedule-worker-cloud-sample/build.gradle.kts:
--------------------------------------------------------------------------------
1 | dependencies {
2 | api("com.tencent.devops:devops-boot-starter-service")
3 | api("com.tencent.devops:devops-boot-starter-schedule-worker")
4 | api("io.micrometer:micrometer-registry-prometheus")
5 | }
6 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-schedule/devops-schedule-server/src/main/kotlin/com/tencent/devops/schedule/pojo/UserLoginRequest.kt:
--------------------------------------------------------------------------------
1 | package com.tencent.devops.schedule.pojo
2 |
3 | data class UserLoginRequest(
4 | val username: String,
5 | val password: String,
6 | )
7 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-schedule/devops-schedule-server/src/main/resources/frontend/src/App.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
12 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-schedule/devops-schedule-common/src/main/kotlin/com/tencent/devops/schedule/pojo/worker/WorkerGroupName.kt:
--------------------------------------------------------------------------------
1 | package com.tencent.devops.schedule.pojo.worker
2 |
3 | data class WorkerGroupName(
4 | val id: String,
5 | val name: String,
6 | )
7 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-schedule/devops-schedule-server/src/main/kotlin/com/tencent/devops/schedule/scheduler/event/JobEvent.kt:
--------------------------------------------------------------------------------
1 | package com.tencent.devops.schedule.scheduler.event
2 |
3 | /**
4 | * 任务事件
5 | * */
6 | open class JobEvent(
7 | val jobId: String,
8 | )
9 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-schedule/devops-schedule-server/src/main/resources/frontend/jsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "baseUrl": "./",
4 | "paths": {
5 | "@/*": ["src/*"]
6 | }
7 | },
8 | "exclude": ["node_modules", "dist"]
9 | }
10 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-service-reactive/build.gradle.kts:
--------------------------------------------------------------------------------
1 | description = "DevOps Boot Service"
2 |
3 | dependencies {
4 | api(project(":devops-boot-project:devops-boot-core:devops-service"))
5 | api(project(":devops-boot-project:devops-boot-core:devops-webflux"))
6 | }
7 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-schedule/devops-schedule-server/src/main/kotlin/com/tencent/devops/schedule/scheduler/event/JobMisfireEvent.kt:
--------------------------------------------------------------------------------
1 | package com.tencent.devops.schedule.scheduler.event
2 |
3 | /**
4 | * 任务调度错过事件
5 | * */
6 | class JobMisfireEvent(jobId: String) : JobEvent(jobId)
7 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-schedule/devops-schedule-common/src/main/kotlin/com/tencent/devops/schedule/pojo/page/BasePageRequest.kt:
--------------------------------------------------------------------------------
1 | package com.tencent.devops.schedule.pojo.page
2 |
3 | abstract class BasePageRequest(
4 | var pageNumber: Int = 1,
5 | var pageSize: Int = 20
6 | )
7 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-schedule/devops-schedule-server/src/main/resources/frontend/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bkdevops-projects/devops-framework/HEAD/devops-boot-project/devops-boot-core/devops-schedule/devops-schedule-server/src/main/resources/frontend/public/favicon.ico
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-web/src/main/resources/common-web.properties:
--------------------------------------------------------------------------------
1 | spring.output.ansi.enabled=ALWAYS
2 | management.endpoints.web.exposure.include=*
3 | management.endpoints.jmx.exposure.exclude=*
4 | management.endpoint.health.show-details=always
5 | management.endpoint.shutdown.enabled=true
6 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-schedule/devops-schedule-common/src/main/kotlin/com/tencent/devops/schedule/pojo/trigger/HeartBeatParam.kt:
--------------------------------------------------------------------------------
1 | package com.tencent.devops.schedule.pojo.trigger
2 |
3 | data class HeartBeatParam(
4 | val group: String,
5 | val address: String,
6 | val status: Int,
7 | )
8 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-plugin/devops-plugin-processor/build.gradle.kts:
--------------------------------------------------------------------------------
1 | description = "DevOps Boot Plugin Processor"
2 |
3 | dependencies {
4 | implementation(project(":devops-boot-project:devops-boot-core:devops-plugin:devops-plugin-api"))
5 | implementation("org.springframework:spring-webmvc")
6 | }
7 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-schedule/devops-schedule-model/build.gradle.kts:
--------------------------------------------------------------------------------
1 | description = "DevOps Boot Schedule Model"
2 |
3 | dependencies {
4 | api(project(":devops-boot-project:devops-boot-core:devops-schedule:devops-schedule-common"))
5 | compileOnly("org.springframework.data:spring-data-commons")
6 | }
7 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-schedule/devops-schedule-server/src/main/resources/frontend/src/assets/404_images/404.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bkdevops-projects/devops-framework/HEAD/devops-boot-project/devops-boot-core/devops-schedule/devops-schedule-server/src/main/resources/frontend/src/assets/404_images/404.png
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-schedule/devops-schedule-server/src/main/resources/frontend/src/views/dashboard/index.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 | 调度报表页面,待开发
4 |
5 |
6 |
7 |
12 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-plugin/devops-plugin-api/src/main/kotlin/com/tencent/devops/plugin/api/Extension.kt:
--------------------------------------------------------------------------------
1 | package com.tencent.devops.plugin.api
2 |
3 | /**
4 | * 用于标记扩展类
5 | */
6 | @Retention(AnnotationRetention.SOURCE)
7 | @Target(AnnotationTarget.CLASS)
8 | @MustBeDocumented
9 | annotation class Extension
10 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-schedule/devops-schedule-server/src/main/resources/frontend/src/assets/404_images/404_cloud.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bkdevops-projects/devops-framework/HEAD/devops-boot-project/devops-boot-core/devops-schedule/devops-schedule-server/src/main/resources/frontend/src/assets/404_images/404_cloud.png
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-schedule/devops-schedule-server/src/main/resources/frontend/postcss.config.js:
--------------------------------------------------------------------------------
1 | // https://github.com/michael-ciniawsky/postcss-load-config
2 |
3 | module.exports = {
4 | 'plugins': {
5 | // to edit target browsers: use "browserslist" field in package.json
6 | 'autoprefixer': {}
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-schedule/devops-schedule-model-mongodb/build.gradle.kts:
--------------------------------------------------------------------------------
1 | description = "DevOps Boot Schedule Model MongoDB"
2 |
3 | dependencies {
4 | api(project(":devops-boot-project:devops-boot-core:devops-schedule:devops-schedule-model"))
5 | api("org.springframework.boot:spring-boot-starter-data-mongodb")
6 | }
7 |
--------------------------------------------------------------------------------
/devops-boot-sample/webflux-sample/biz-webflux-sample/build.gradle.kts:
--------------------------------------------------------------------------------
1 | dependencies {
2 | api(project(":webflux-sample:api-webflux-sample"))
3 | api("com.tencent.devops:devops-boot-starter-service-reactive")
4 | api("com.tencent.devops:devops-boot-starter-circuitbreaker")
5 | api("com.tencent.devops:devops-boot-starter-logging")
6 | }
7 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-schedule/devops-schedule-common/build.gradle.kts:
--------------------------------------------------------------------------------
1 | description = "DevOps Boot Schedule Common"
2 |
3 | dependencies {
4 | api(project(":devops-boot-project:devops-boot-core:devops-webmvc"))
5 | api(project(":devops-boot-project:devops-boot-core:devops-api"))
6 | api("com.squareup.okhttp3:okhttp")
7 | }
8 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-schedule/devops-schedule-common/src/main/kotlin/com/tencent/devops/schedule/pojo/worker/WorkerGroupCreateRequest.kt:
--------------------------------------------------------------------------------
1 | package com.tencent.devops.schedule.pojo.worker
2 |
3 | data class WorkerGroupCreateRequest(
4 | val name: String,
5 | val discoveryType: Int,
6 | val description: String? = null,
7 | )
8 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-service-servlet/src/main/resources/common-service.properties:
--------------------------------------------------------------------------------
1 | feign.okhttp.enabled=true
2 | feign.httpclient.enabled=false
3 | feign.client.config.default.connectTimeout=15000
4 | feign.client.config.default.readTimeout=15000
5 | feign.compression.request.enabled=true
6 | feign.compression.response.enabled=true
7 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-schedule/devops-schedule-common/src/main/kotlin/com/tencent/devops/schedule/pojo/worker/WorkerGroupQueryParam.kt:
--------------------------------------------------------------------------------
1 | package com.tencent.devops.schedule.pojo.worker
2 |
3 | import com.tencent.devops.schedule.pojo.page.BasePageRequest
4 |
5 | class WorkerGroupQueryParam(
6 | var name: String? = null
7 | ): BasePageRequest()
8 |
--------------------------------------------------------------------------------
/devops-boot-sample/biz-kotlin-sample/build.gradle.kts:
--------------------------------------------------------------------------------
1 | dependencies {
2 | api(project(":api-kotlin-sample"))
3 | api("com.tencent.devops:devops-boot-starter-service")
4 | api("com.tencent.devops:devops-boot-starter-circuitbreaker")
5 | api("com.tencent.devops:devops-boot-starter-plugin")
6 | api("com.tencent.devops:devops-boot-starter-logging")
7 | }
8 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-common/src/main/kotlin/com/tencent/devops/common/time/TimeExtensions.kt:
--------------------------------------------------------------------------------
1 | package com.tencent.devops.common.time
2 |
3 | import java.time.LocalDateTime
4 | import java.time.ZoneId
5 |
6 | fun LocalDateTime.toEpochMilli(zoneId: ZoneId = ZoneId.systemDefault()): Long {
7 | return this.atZone(zoneId).toInstant().toEpochMilli()
8 | }
9 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-schedule/devops-schedule-server/src/main/resources/frontend/src/store/getters.js:
--------------------------------------------------------------------------------
1 | const getters = {
2 | sidebar: state => state.app.sidebar,
3 | device: state => state.app.device,
4 | token: state => state.user.token,
5 | avatar: state => state.user.avatar,
6 | name: state => state.user.name
7 | }
8 | export default getters
9 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-service/build.gradle.kts:
--------------------------------------------------------------------------------
1 | description = "DevOps Boot Service"
2 |
3 | dependencies {
4 | api(project(":devops-boot-project:devops-boot-core:devops-web"))
5 | api("com.squareup.okhttp3:okhttp")
6 | api("org.springframework.cloud:spring-cloud-commons")
7 | api("org.springframework.cloud:spring-cloud-starter-bootstrap")
8 | }
9 |
--------------------------------------------------------------------------------
/devops-boot-sample/boot-kotlin-sample/src/main/resources/application.yml:
--------------------------------------------------------------------------------
1 | logging:
2 | level:
3 | com.tencent: debug
4 | devops:
5 | logging:
6 | path: D://
7 | app-file: sample.log
8 | error-file: sample-error.log
9 | loadbalancer:
10 | gray:
11 | enabled: true
12 | meta-key: env
13 | local-prior:
14 | enabled: true
15 |
16 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-starters/devops-boot-starter-schedule-server/build.gradle.kts:
--------------------------------------------------------------------------------
1 | description = "Starter for DevOps Boot Schedule Server"
2 |
3 | dependencies {
4 | api(project(":devops-boot-project:devops-boot-core:devops-schedule:devops-schedule-server"))
5 | api(project(":devops-boot-project:devops-boot-core:devops-schedule:devops-schedule-model-mongodb"))
6 | }
7 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-starters/devops-boot-starter-stream/build.gradle.kts:
--------------------------------------------------------------------------------
1 | description = "Stream Starter for DevOps Boot"
2 |
3 | dependencies {
4 | api(project(":devops-boot-project:devops-boot-core:devops-pulsar"))
5 | api("org.springframework.cloud:spring-cloud-starter-stream-kafka")
6 | api("org.springframework.cloud:spring-cloud-starter-stream-rabbit")
7 | }
8 |
--------------------------------------------------------------------------------
/devops-boot-sample/api-kotlin-sample/src/main/kotlin/com/tencent/devops/sample/pojo/Sample.kt:
--------------------------------------------------------------------------------
1 | package com.tencent.devops.sample.pojo
2 |
3 | import io.swagger.v3.oas.annotations.media.Schema
4 |
5 | @Schema(description = "样例")
6 | data class Sample(
7 | @Schema(description = "id")
8 | val id: Long,
9 | @Schema(description = "名称")
10 | val name: String
11 | )
12 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-schedule/devops-schedule-server/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports:
--------------------------------------------------------------------------------
1 | com.tencent.devops.schedule.config.ScheduleServerAutoConfiguration
2 | com.tencent.devops.schedule.config.ScheduleServerRpcAutoConfiguration
3 | com.tencent.devops.schedule.config.ScheduleServerDiscoveryAutoConfiguration
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-schedule/devops-schedule-worker/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports:
--------------------------------------------------------------------------------
1 | com.tencent.devops.schedule.config.ScheduleWorkerAutoConfiguration
2 | com.tencent.devops.schedule.config.ScheduleWorkerRpcAutoConfiguration
3 | com.tencent.devops.schedule.config.ScheduleWorkerDiscoveryAutoConfiguration
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-webmvc/src/main/kotlin/com/tencent/devops/webmvc/WebMvcAutoConfiguration.kt:
--------------------------------------------------------------------------------
1 | package com.tencent.devops.webmvc
2 |
3 | import org.springframework.context.annotation.Configuration
4 | import org.springframework.context.annotation.PropertySource
5 |
6 | @Configuration
7 | @PropertySource("classpath:common-webmvc.properties")
8 | class WebMvcAutoConfiguration
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-webflux/build.gradle.kts:
--------------------------------------------------------------------------------
1 | description = "DevOps Boot WebFlux"
2 |
3 | dependencies {
4 | api(project(":devops-boot-project:devops-boot-core:devops-web"))
5 | api("org.springframework.boot:spring-boot-starter-webflux")
6 | api("org.jetbrains.kotlinx:kotlinx-coroutines-core")
7 | api("org.jetbrains.kotlinx:kotlinx-coroutines-reactor")
8 | }
9 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-schedule/devops-schedule-server/src/main/resources/frontend/src/icons/svg/link.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-schedule/devops-schedule-worker/src/main/kotlin/com/tencent/devops/schedule/hearbeat/NoOpHeartbeat.kt:
--------------------------------------------------------------------------------
1 | package com.tencent.devops.schedule.hearbeat
2 |
3 | import com.tencent.devops.schedule.enums.WorkerStatusEnum
4 |
5 | class NoOpHeartbeat: Heartbeat {
6 | override fun beat(status: WorkerStatusEnum) {
7 | // do nothing
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-schedule/devops-schedule-server/src/main/resources/frontend/src/api/log.js:
--------------------------------------------------------------------------------
1 | import request from '@/utils/request'
2 |
3 | export const list = (data) => request({
4 | url: '/log/list',
5 | method: 'get',
6 | params: data
7 | })
8 |
9 | export const del = (id) => request({
10 | url: '/log/delete',
11 | method: 'delete',
12 | params: { id }
13 | })
14 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-schedule/devops-schedule-server/src/main/resources/frontend/src/utils/get-page-title.js:
--------------------------------------------------------------------------------
1 | import defaultSettings from '@/settings'
2 |
3 | const title = defaultSettings.title || 'Vue Admin Template'
4 |
5 | export default function getPageTitle(pageTitle) {
6 | if (pageTitle) {
7 | return `${pageTitle} - ${title}`
8 | }
9 | return `${title}`
10 | }
11 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-schedule/devops-schedule-worker/src/main/kotlin/com/tencent/devops/schedule/k8s/K8sProperties.kt:
--------------------------------------------------------------------------------
1 | package com.tencent.devops.schedule.k8s
2 |
3 | data class K8sProperties(
4 | var namespace: String = "default",
5 | var apiServer: String? = null,
6 | var token: String? = null,
7 | var limit: ResourceLimitProperties = ResourceLimitProperties(),
8 | )
9 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-service/src/main/kotlin/com/tencent/devops/service/ServiceAutoConfiguration.kt:
--------------------------------------------------------------------------------
1 | package com.tencent.devops.service
2 |
3 | import com.tencent.devops.service.config.ServiceProperties
4 | import org.springframework.boot.context.properties.EnableConfigurationProperties
5 |
6 | @EnableConfigurationProperties(ServiceProperties::class)
7 | class ServiceAutoConfiguration
8 |
--------------------------------------------------------------------------------
/devops-boot-sample/webflux-sample/api-webflux-sample/src/main/kotlin/com/tencent/devops/sample/pojo/Sample.kt:
--------------------------------------------------------------------------------
1 | package com.tencent.devops.sample.pojo
2 |
3 | import io.swagger.v3.oas.annotations.media.Schema
4 |
5 |
6 | @Schema(description = "样例")
7 | data class Sample(
8 | @Schema(description = "id")
9 | val id: Long,
10 | @Schema(description = "名称")
11 | val name: String,
12 | )
13 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-service-servlet/build.gradle.kts:
--------------------------------------------------------------------------------
1 | description = "DevOps Boot Service"
2 |
3 | dependencies {
4 | api(project(":devops-boot-project:devops-boot-core:devops-service"))
5 | api(project(":devops-boot-project:devops-boot-core:devops-webmvc"))
6 | api("io.github.openfeign:feign-okhttp")
7 | api("org.springframework.cloud:spring-cloud-starter-openfeign")
8 | }
9 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-webmvc/build.gradle.kts:
--------------------------------------------------------------------------------
1 | description = "DevOps Boot Web"
2 |
3 | dependencies {
4 | api(project(":devops-boot-project:devops-boot-core:devops-web"))
5 | api("org.springframework.boot:spring-boot-starter-web") {
6 | exclude(module = "spring-boot-starter-tomcat")
7 | }
8 | api("org.springframework.boot:spring-boot-starter-undertow")
9 | }
10 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-starters/devops-boot-starter-web/build.gradle.kts:
--------------------------------------------------------------------------------
1 | description = "Starter for DevOps Boot Web"
2 |
3 | dependencies {
4 | api(project(":devops-boot-project:devops-boot-core:devops-webmvc"))
5 | api(project(":devops-boot-project:devops-boot-starters:devops-boot-starter-api"))
6 | api(project(":devops-boot-project:devops-boot-starters:devops-boot-starter-logging"))
7 | }
8 |
--------------------------------------------------------------------------------
/devops-boot-sample/boot-schedule-worker-cloud-sample/src/main/resources/bootstrap.yaml:
--------------------------------------------------------------------------------
1 | spring:
2 | application:
3 | name: discovery-test
4 | server:
5 | port: 8082
6 | logging:
7 | level:
8 | com.tencent: debug
9 |
10 | devops:
11 | schedule:
12 | worker:
13 | mode: DISCOVERY
14 | server:
15 | address: http://schedule-server-sample
16 | access-token: xxx
17 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-starters/devops-boot-starter-webflux/build.gradle.kts:
--------------------------------------------------------------------------------
1 | description = "Starter for DevOps Boot WebFlux"
2 |
3 | dependencies {
4 | api(project(":devops-boot-project:devops-boot-core:devops-webflux"))
5 | api(project(":devops-boot-project:devops-boot-starters:devops-boot-starter-api"))
6 | api(project(":devops-boot-project:devops-boot-starters:devops-boot-starter-logging"))
7 | }
8 |
--------------------------------------------------------------------------------
/devops-boot-sample/boot-schedule-server-sample/src/main/resources/bootstrap.yaml:
--------------------------------------------------------------------------------
1 | server:
2 | port: 8080
3 | spring:
4 | application:
5 | name: schedule-server-sample
6 | # data:
7 | # mongodb:
8 | # uri: mongodb://localhost/schedule_local
9 | logging:
10 | level:
11 | com.tencent: debug
12 |
13 | devops:
14 | schedule:
15 | server:
16 | auth:
17 | access-token: xxx
18 |
19 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-schedule/devops-schedule-common/src/main/kotlin/com/tencent/devops/schedule/pojo/job/JobQueryParam.kt:
--------------------------------------------------------------------------------
1 | package com.tencent.devops.schedule.pojo.job
2 |
3 | import com.tencent.devops.schedule.pojo.page.BasePageRequest
4 |
5 | class JobQueryParam(
6 | var name: String? = null,
7 | var groupId: String? = null,
8 | var triggerStatus: Int? = null
9 | ): BasePageRequest()
10 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-plugin/devops-plugin-core/src/main/kotlin/com/tencent/devops/plugin/config/PluginProperties.kt:
--------------------------------------------------------------------------------
1 | package com.tencent.devops.plugin.config
2 |
3 | import org.springframework.boot.context.properties.ConfigurationProperties
4 |
5 | @ConfigurationProperties("plugin")
6 | data class PluginProperties(
7 | /**
8 | * 插件路径
9 | */
10 | var path: String = "plugins"
11 | )
12 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-pulsar/build.gradle.kts:
--------------------------------------------------------------------------------
1 | description = "DevOps Boot Pulsar"
2 |
3 | dependencies {
4 | api("org.springframework.cloud:spring-cloud-stream")
5 | api("org.springframework.boot:spring-boot-actuator")
6 | api("org.springframework.boot:spring-boot-actuator-autoconfigure")
7 | api("org.apache.pulsar:pulsar-client")
8 | api("com.google.protobuf:protobuf-java")
9 | }
10 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-starters/devops-boot-starter-service/build.gradle.kts:
--------------------------------------------------------------------------------
1 | description = "Starter for DevOps Boot Service"
2 |
3 | dependencies {
4 | api(project(":devops-boot-project:devops-boot-core:devops-service-servlet"))
5 | api(project(":devops-boot-project:devops-boot-starters:devops-boot-starter-web"))
6 | api(project(":devops-boot-project:devops-boot-starters:devops-boot-starter-loadbalancer"))
7 | }
8 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-schedule/devops-schedule-common/src/main/kotlin/com/tencent/devops/schedule/enums/DictItem.kt:
--------------------------------------------------------------------------------
1 | package com.tencent.devops.schedule.enums
2 |
3 | import com.fasterxml.jackson.databind.annotation.JsonSerialize
4 |
5 | /**
6 | * 阻塞处理策略
7 | */
8 | @JsonSerialize(using = DictItemSerializable::class)
9 | interface DictItem {
10 | fun code(): Int
11 | fun description(): String
12 | }
13 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-schedule/devops-schedule-server/src/main/resources/frontend/src/icons/index.js:
--------------------------------------------------------------------------------
1 | import Vue from 'vue'
2 | import SvgIcon from '@/components/SvgIcon'// svg component
3 |
4 | // register globally
5 | Vue.component('svg-icon', SvgIcon)
6 |
7 | const req = require.context('./svg', false, /\.svg$/)
8 | const requireAll = requireContext => requireContext.keys().map(requireContext)
9 | requireAll(req)
10 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-schedule/devops-schedule-worker/build.gradle.kts:
--------------------------------------------------------------------------------
1 | description = "DevOps Boot Schedule Worker"
2 |
3 | dependencies {
4 | api(project(":devops-boot-project:devops-boot-core:devops-schedule:devops-schedule-common"))
5 | api(project(":devops-boot-project:devops-boot-core:devops-common"))
6 | api("io.kubernetes:client-java")
7 | compileOnly("org.springframework.cloud:spring-cloud-starter")
8 | }
9 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-schedule/devops-schedule-worker/src/main/kotlin/com/tencent/devops/schedule/hearbeat/Heartbeat.kt:
--------------------------------------------------------------------------------
1 | package com.tencent.devops.schedule.hearbeat
2 |
3 | import com.tencent.devops.schedule.enums.WorkerStatusEnum
4 |
5 | /**
6 | * 维持和调度中心的心跳,定时上报状态
7 | */
8 | interface Heartbeat {
9 |
10 | /**
11 | * @param status 自身状态
12 | */
13 | fun beat(status: WorkerStatusEnum)
14 |
15 | }
16 |
--------------------------------------------------------------------------------
/devops-boot-sample/biz-kotlin-sample/src/main/kotlin/com/tencent/devops/sample/config/GreetingProperties.kt:
--------------------------------------------------------------------------------
1 | package com.tencent.devops.sample.config
2 |
3 | import org.springframework.boot.context.properties.ConfigurationProperties
4 | import org.springframework.context.annotation.Configuration
5 |
6 | @Configuration
7 | @ConfigurationProperties("greeting")
8 | data class GreetingProperties(
9 | var message: String = "default"
10 | )
11 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-schedule/devops-schedule-worker/src/main/kotlin/com/tencent/devops/schedule/thread/TriggerTask.kt:
--------------------------------------------------------------------------------
1 | package com.tencent.devops.schedule.thread
2 |
3 | import com.tencent.devops.schedule.executor.JobHandler
4 | import com.tencent.devops.schedule.pojo.trigger.TriggerParam
5 |
6 | data class TriggerTask(
7 | val jobId: String,
8 | val jobHandler: JobHandler,
9 | val param: TriggerParam,
10 | )
11 |
--------------------------------------------------------------------------------
/devops-boot-sample/api-kotlin-sample/src/main/kotlin/com/tencent/devops/sample/extension/PrintExtension.kt:
--------------------------------------------------------------------------------
1 | package com.tencent.devops.sample.extension
2 |
3 | import com.tencent.devops.plugin.api.ExtensionPoint
4 |
5 | /**
6 | * 定义扩展点
7 | */
8 | interface PrintExtension : ExtensionPoint {
9 |
10 | /**
11 | * print content
12 | * 可以通过插件自定义实现打印逻辑,如System IO、Logger、Printer等
13 | */
14 | fun print(content: String)
15 | }
16 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-starters/devops-boot-starter-service-reactive/build.gradle.kts:
--------------------------------------------------------------------------------
1 | description = "Starter for DevOps Boot Service Reactive"
2 |
3 | dependencies {
4 | api(project(":devops-boot-project:devops-boot-core:devops-service-reactive"))
5 | api(project(":devops-boot-project:devops-boot-starters:devops-boot-starter-webflux"))
6 | api(project(":devops-boot-project:devops-boot-starters:devops-boot-starter-loadbalancer"))
7 | }
8 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-plugin/devops-plugin-api/src/main/kotlin/com/tencent/devops/plugin/api/ExtensionType.kt:
--------------------------------------------------------------------------------
1 | package com.tencent.devops.plugin.api
2 |
3 | /**
4 | * 扩展类型
5 | */
6 | enum class ExtensionType(val identifier: String) {
7 | /**
8 | * 扩展controller,可以通过插件实现新增接口
9 | */
10 | CONTROLLER("ExtensionController"),
11 |
12 | /**
13 | * 扩展点,可以通过插件实现新增逻辑
14 | */
15 | POINT("ExtensionPoint")
16 | }
17 |
--------------------------------------------------------------------------------
/devops-boot-sample/boot-schedule-server-sample/src/main/kotlin/com/tencent/devops/schedule/sample/CloudServerApplication.kt:
--------------------------------------------------------------------------------
1 | package com.tencent.devops.schedule.sample
2 |
3 | import org.springframework.boot.autoconfigure.SpringBootApplication
4 | import org.springframework.boot.runApplication
5 |
6 | @SpringBootApplication
7 | class CloudServerApplication
8 |
9 | fun main(args: Array) {
10 | runApplication(*args)
11 | }
12 |
--------------------------------------------------------------------------------
/devops-boot-sample/webflux-sample/biz-webflux-sample/src/main/kotlin/com/tencent/devops/sample/config/GreetingProperties.kt:
--------------------------------------------------------------------------------
1 | package com.tencent.devops.sample.config
2 |
3 | import org.springframework.boot.context.properties.ConfigurationProperties
4 | import org.springframework.context.annotation.Configuration
5 |
6 | @Configuration
7 | @ConfigurationProperties("greeting")
8 | data class GreetingProperties(
9 | var message: String = "default",
10 | )
11 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-schedule/devops-schedule-server/src/main/resources/frontend/src/icons/svgo.yml:
--------------------------------------------------------------------------------
1 | # replace default config
2 |
3 | # multipass: true
4 | # full: true
5 |
6 | plugins:
7 |
8 | # - name
9 | #
10 | # or:
11 | # - name: false
12 | # - name: true
13 | #
14 | # or:
15 | # - name:
16 | # param1: 1
17 | # param2: 2
18 |
19 | - removeAttrs:
20 | attrs:
21 | - 'fill'
22 | - 'fill-rule'
23 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-schedule/devops-schedule-server/src/main/resources/frontend/src/utils/auth.js:
--------------------------------------------------------------------------------
1 | import Cookies from 'js-cookie'
2 |
3 | const TokenKey = 'vue_admin_template_token'
4 |
5 | export function getToken() {
6 | return Cookies.get(TokenKey)
7 | }
8 |
9 | export function setToken(token) {
10 | return Cookies.set(TokenKey, token)
11 | }
12 |
13 | export function removeToken() {
14 | return Cookies.remove(TokenKey)
15 | }
16 |
--------------------------------------------------------------------------------
/devops-boot-sample/boot-schedule-worker-cloud-sample/src/main/kotlin/com/tencent/devops/schedule/sample/CloudWorkerApplication.kt:
--------------------------------------------------------------------------------
1 | package com.tencent.devops.schedule.sample
2 |
3 | import org.springframework.boot.autoconfigure.SpringBootApplication
4 | import org.springframework.boot.runApplication
5 |
6 | @SpringBootApplication
7 | class CloudWorkerApplication
8 |
9 | fun main(args: Array) {
10 | runApplication(*args)
11 | }
12 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-schedule/devops-schedule-server/src/main/resources/frontend/src/settings.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 |
3 | title: 'Schedule Server',
4 |
5 | /**
6 | * @type {boolean} true | false
7 | * @description Whether fix the header
8 | */
9 | fixedHeader: false,
10 |
11 | /**
12 | * @type {boolean} true | false
13 | * @description Whether show the logo in sidebar
14 | */
15 | sidebarLogo: true
16 |
17 | }
18 |
--------------------------------------------------------------------------------
/docs/_coverpage.md:
--------------------------------------------------------------------------------
1 | # DevOps Boot
2 | 
3 | 
4 | 
5 |
6 | > 基于Spring Boot的微服务快速开发框架
7 |
8 | [GitHub](https://github.com/bkdevops-projects/devops-framework/)
9 | [Get Started](/index)
10 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-schedule/devops-schedule-model-mongodb/src/main/kotlin/com/tencent/devops/schedule/mongo/repository/JobRepository.kt:
--------------------------------------------------------------------------------
1 | package com.tencent.devops.schedule.mongo.repository
2 |
3 | import com.tencent.devops.schedule.mongo.model.TJobInfo
4 | import org.springframework.data.mongodb.repository.MongoRepository
5 | import org.springframework.stereotype.Repository
6 |
7 | @Repository
8 | interface JobRepository: MongoRepository
9 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-schedule/devops-schedule-model-mongodb/src/main/kotlin/com/tencent/devops/schedule/mongo/repository/LockRepository.kt:
--------------------------------------------------------------------------------
1 | package com.tencent.devops.schedule.mongo.repository
2 |
3 | import com.tencent.devops.schedule.mongo.model.TLockInfo
4 | import org.springframework.data.mongodb.repository.MongoRepository
5 | import org.springframework.stereotype.Repository
6 |
7 | @Repository
8 | interface LockRepository: MongoRepository
9 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-schedule/devops-schedule-server/src/main/resources/frontend/.editorconfig:
--------------------------------------------------------------------------------
1 | # http://editorconfig.org
2 | root = true
3 |
4 | [*]
5 | charset = utf-8
6 | end_of_line = lf
7 | indent_size = 2
8 | indent_style = space
9 | insert_final_newline = true
10 | max_line_length = 100
11 | trim_trailing_whitespace = true
12 |
13 | [*.md]
14 | max_line_length = 0
15 | trim_trailing_whitespace = false
16 |
17 | [COMMIT_EDITMSG]
18 | max_line_length = 0
--------------------------------------------------------------------------------
/devops-boot-sample/build.gradle.kts:
--------------------------------------------------------------------------------
1 | plugins {
2 | id("com.tencent.devops.boot")
3 | }
4 |
5 | allprojects {
6 | group="com.tencent.devops.sample"
7 | version="1.0.0-SNAPSHOT"
8 |
9 | // for debug devops-boot locally
10 | repositories {
11 | mavenLocal()
12 | }
13 |
14 | apply(plugin = "com.tencent.devops.boot")
15 |
16 | configurations.all {
17 | resolutionStrategy.cacheChangingModulesFor(0, TimeUnit.MINUTES)
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-plugin/devops-plugin-core/build.gradle.kts:
--------------------------------------------------------------------------------
1 | description = "DevOps Boot Plugin Core"
2 |
3 | dependencies {
4 | api(project(":devops-boot-project:devops-boot-core:devops-plugin:devops-plugin-api"))
5 | api("org.springframework.boot:spring-boot-starter")
6 | api("org.springframework:spring-webmvc")
7 | api("org.springframework.boot:spring-boot-loader")
8 | compileOnly("org.springframework.boot:spring-boot-starter-actuator")
9 | }
10 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-schedule/devops-schedule-common/src/main/kotlin/com/tencent/devops/schedule/api/WorkerRpcClient.kt:
--------------------------------------------------------------------------------
1 | package com.tencent.devops.schedule.api
2 |
3 | import com.tencent.devops.schedule.pojo.ScheduleResponse
4 | import com.tencent.devops.schedule.pojo.trigger.TriggerParam
5 |
6 | /**
7 | * 远程调用客户端
8 | */
9 | interface WorkerRpcClient {
10 |
11 | /**
12 | * 运行任务
13 | */
14 | fun runJob(param: TriggerParam): ScheduleResponse
15 | }
16 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-schedule/devops-schedule-server/src/main/kotlin/com/tencent/devops/schedule/router/WorkerRouteRandom.kt:
--------------------------------------------------------------------------------
1 | package com.tencent.devops.schedule.router
2 |
3 | import com.tencent.devops.schedule.pojo.trigger.TriggerParam
4 |
5 | /**
6 | * 随机路由
7 | */
8 | class WorkerRouteRandom : WorkerRouter {
9 |
10 | override fun route(triggerParam: TriggerParam, addressList: List): String {
11 | return addressList.random()
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-circuitbreaker/src/main/kotlin/com/tencent/devops/circuitbreaker/CircuitBreakerAutoConfiguration.kt:
--------------------------------------------------------------------------------
1 | package com.tencent.devops.circuitbreaker
2 |
3 | import org.springframework.context.annotation.Configuration
4 | import org.springframework.context.annotation.PropertySource
5 |
6 | /**
7 | * 客户端熔断器自动配置
8 | */
9 | @Configuration(proxyBeanMethods = false)
10 | @PropertySource("classpath:common-circuitbreaker.properties")
11 | class CircuitBreakerAutoConfiguration
12 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-schedule/devops-schedule-worker/src/main/kotlin/com/tencent/devops/schedule/constants/WorkerRegistryMode.kt:
--------------------------------------------------------------------------------
1 | package com.tencent.devops.schedule.constants
2 |
3 | /**
4 | * worker注册模式
5 | */
6 | enum class WorkerRegistryMode {
7 | /**
8 | * 自动注册,worker启动后自动注册到调度中心
9 | */
10 | AUTO,
11 | /**
12 | * 手动注册,由调度中心手动注册worker
13 | */
14 | MANUAL,
15 | /**
16 | * 自动发现,依赖spring-cloud的服务发现
17 | */
18 | DISCOVERY;
19 | }
20 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-schedule/devops-schedule-server/src/main/resources/frontend/src/store/index.js:
--------------------------------------------------------------------------------
1 | import Vue from 'vue'
2 | import Vuex from 'vuex'
3 | import getters from './getters'
4 | import app from './modules/app'
5 | import settings from './modules/settings'
6 | import user from './modules/user'
7 |
8 | Vue.use(Vuex)
9 |
10 | const store = new Vuex.Store({
11 | modules: {
12 | app,
13 | settings,
14 | user
15 | },
16 | getters
17 | })
18 |
19 | export default store
20 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-tools/build.gradle.kts:
--------------------------------------------------------------------------------
1 | import org.jetbrains.kotlin.gradle.dsl.JvmTarget
2 | import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
3 |
4 | description = "Tools for DevOps Boot"
5 |
6 | subprojects {
7 | apply(plugin = "org.jetbrains.kotlin.jvm")
8 |
9 | tasks {
10 | getByName("compileKotlin") {
11 | compilerOptions {
12 | jvmTarget.set(JvmTarget.fromTarget(Versions.Java))
13 | }
14 | }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-schedule/devops-schedule-worker/src/main/kotlin/com/tencent/devops/schedule/executor/JobExecutor.kt:
--------------------------------------------------------------------------------
1 | package com.tencent.devops.schedule.executor
2 |
3 | import com.tencent.devops.schedule.pojo.ScheduleResponse
4 | import com.tencent.devops.schedule.pojo.trigger.TriggerParam
5 |
6 | /**
7 | * 任务执行器接口
8 | */
9 | interface JobExecutor {
10 | /**
11 | * 提交任务
12 | * @param param 任务触发参数
13 | */
14 | fun execute(param: TriggerParam): ScheduleResponse
15 | }
16 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-web/build.gradle.kts:
--------------------------------------------------------------------------------
1 | description = "DevOps Boot Web"
2 |
3 | dependencies {
4 | api(project(":devops-boot-project:devops-boot-core:devops-boot"))
5 | api(project(":devops-boot-project:devops-boot-core:devops-logging"))
6 | api(project(":devops-boot-project:devops-boot-core:devops-utils"))
7 | api("org.springframework:spring-web")
8 | api("org.springframework.boot:spring-boot-starter-actuator")
9 | api("org.springdoc:springdoc-openapi-starter-webmvc-ui")
10 | }
11 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-schedule/devops-schedule-model-mongodb/src/main/kotlin/com/tencent/devops/schedule/mongo/repository/LogRepository.kt:
--------------------------------------------------------------------------------
1 | package com.tencent.devops.schedule.mongo.repository
2 |
3 | import com.tencent.devops.schedule.mongo.model.TJobLog
4 | import org.springframework.data.mongodb.repository.MongoRepository
5 | import org.springframework.stereotype.Repository
6 |
7 | @Repository
8 | interface LogRepository : MongoRepository {
9 | fun deleteByJobId(jobId: String)
10 | }
11 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-webflux/src/main/kotlin/com/tencent/devops/webflux/filter/CoHandlerFilterFunction.kt:
--------------------------------------------------------------------------------
1 | package com.tencent.devops.webflux.filter
2 |
3 | import org.springframework.web.reactive.function.server.ServerRequest
4 | import org.springframework.web.reactive.function.server.ServerResponse
5 |
6 | /**
7 | * 协程版HandlerFilterFunction
8 | * */
9 | interface CoHandlerFilterFunction {
10 |
11 | suspend fun filter(request: ServerRequest, next: suspend (ServerRequest) -> ServerResponse): ServerResponse
12 | }
13 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-schedule/devops-schedule-server/src/main/resources/frontend/src/icons/svg/user.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-utils/build.gradle.kts:
--------------------------------------------------------------------------------
1 | description = "DevOps Boot Utils"
2 |
3 | dependencies {
4 | api("com.fasterxml.jackson.module:jackson-module-kotlin")
5 | api("com.fasterxml.jackson.datatype:jackson-datatype-jdk8")
6 | api("com.fasterxml.jackson.datatype:jackson-datatype-jsr310")
7 | api("com.fasterxml.jackson.dataformat:jackson-dataformat-yaml")
8 | api("com.fasterxml.jackson.dataformat:jackson-dataformat-xml")
9 | api("com.fasterxml.jackson.module:jackson-module-parameter-names")
10 | }
11 |
--------------------------------------------------------------------------------
/devops-boot-sample/plugin-printer/src/main/kotlin/com.tencent.devops.sample/SystemIoPrintExtension.kt:
--------------------------------------------------------------------------------
1 | package com.tencent.devops.sample
2 |
3 | import com.tencent.devops.plugin.api.Extension
4 | import com.tencent.devops.sample.extension.PrintExtension
5 |
6 | @Extension
7 | class SystemIoPrintExtension : PrintExtension {
8 | override fun print(content: String) {
9 | val loaded = javaClass.classLoader.loadClass("org.bytedeco.ffmpeg.global.avformat") != null
10 | println("lib sdk loaded:$loaded, $content")
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-schedule/devops-schedule-common/src/main/kotlin/com/tencent/devops/schedule/pojo/worker/WorkerInfo.kt:
--------------------------------------------------------------------------------
1 | package com.tencent.devops.schedule.pojo.worker
2 |
3 | import java.time.LocalDateTime
4 |
5 | data class WorkerInfo(
6 | var id: String? = null,
7 |
8 | /**
9 | * 地址,格式ip:port
10 | */
11 | var address: String,
12 |
13 | /**
14 | * 工作组名称
15 | */
16 | var group: String,
17 |
18 | /**
19 | * 状态更新时间
20 | */
21 | var updateTime: LocalDateTime,
22 | )
23 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-schedule/devops-schedule-server/src/main/resources/frontend/src/views/group/index.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
9 |
10 |
11 |
12 |
22 |
24 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-plugin/devops-plugin-api/src/main/kotlin/com/tencent/devops/plugin/api/PluginScanner.kt:
--------------------------------------------------------------------------------
1 | package com.tencent.devops.plugin.api
2 |
3 | import java.nio.file.Path
4 |
5 | /**
6 | * 插件扫描器
7 | */
8 | interface PluginScanner {
9 |
10 | /**
11 | * 扫描插件路径
12 | * @return 插件路径集合
13 | */
14 | fun scan(): List
15 |
16 | /**
17 | * 扫描指定插件路径
18 | * 此方法要求插件必须按照指定格式命名:plugin-xxx-1.0.0.jar,其中xxx代表插件id
19 | * @param id 插件id
20 | */
21 | fun scan(id: String): Path?
22 | }
23 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-tools/devops-boot-gradle-plugin/src/main/kotlin/com/tencent/devops/enums/AssemblyMode.kt:
--------------------------------------------------------------------------------
1 | package com.tencent.devops.enums
2 |
3 | import java.util.Locale
4 |
5 | enum class AssemblyMode {
6 | NONE,
7 | CONSUL,
8 | K8S,
9 | KUBERNETES,
10 | ;
11 |
12 | companion object {
13 | fun ofValueOrDefault(value: String): AssemblyMode {
14 | val upperCase = value.uppercase(Locale.getDefault())
15 | return entries.find { it.name == upperCase } ?: CONSUL
16 | }
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-api/src/main/kotlin/com/tencent/devops/api/http/MediaTypes.kt:
--------------------------------------------------------------------------------
1 | package com.tencent.devops.api.http
2 |
3 | /**
4 | * HTTP Media Type常量
5 | */
6 | object MediaTypes {
7 | const val APPLICATION_OCTET_STREAM = "application/octet-stream"
8 | const val APPLICATION_JSON = "application/json; charset=utf-8"
9 | const val TEXT_HTML = "text/html"
10 | const val APPLICATION_YAML = "application/x-yaml"
11 | const val APPLICATION_TGZ = "application/x-tar"
12 | const val APPLICATION_ICO = "image/x-icon"
13 | }
14 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-schedule/devops-schedule-server/src/main/resources/frontend/src/utils/validate.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Created by PanJiaChen on 16/11/18.
3 | */
4 |
5 | /**
6 | * @param {string} path
7 | * @returns {Boolean}
8 | */
9 | export function isExternal(path) {
10 | return /^(https?:|mailto:|tel:)/.test(path)
11 | }
12 |
13 | /**
14 | * @param {string} str
15 | * @returns {Boolean}
16 | */
17 | export function validUsername(str) {
18 | const valid_map = ['admin', 'editor']
19 | return valid_map.indexOf(str.trim()) >= 0
20 | }
21 |
--------------------------------------------------------------------------------
/devops-boot-sample/webflux-sample/boot-webflux-sample/src/main/resources/application.yml:
--------------------------------------------------------------------------------
1 | logging:
2 | level:
3 | com.tencent: debug
4 | devops:
5 | logging:
6 | path: D://
7 | app-file: sample.log
8 | error-file: sample-error.log
9 | loadbalancer:
10 | gray:
11 | enabled: true
12 | meta-key: env
13 | local-prior:
14 | enabled: true
15 | context:
16 | initializer:
17 | classes: com.tencent.devops.sample.config.BeansInitializer
18 | management:
19 | endpoints:
20 | web:
21 | exposure:
22 | include: "*"
23 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-schedule/devops-schedule-model-mongodb/src/main/kotlin/com/tencent/devops/schedule/mongo/model/TLockInfo.kt:
--------------------------------------------------------------------------------
1 | package com.tencent.devops.schedule.mongo.model
2 |
3 | import org.springframework.data.mongodb.core.mapping.Document
4 |
5 | /**
6 | * 分布式锁模型类
7 | */
8 | @Document(collection = "distributed_lock")
9 | data class TLockInfo(
10 |
11 | var id: String? = null,
12 |
13 | /**
14 | * 过期时间
15 | */
16 | var expireAt: Long,
17 |
18 | /**
19 | * 锁 token
20 | */
21 | var token: String
22 | )
23 |
--------------------------------------------------------------------------------
/docs/dependency/repository.md:
--------------------------------------------------------------------------------
1 | # Maven仓库配置
2 |
3 | ## 优先级
4 | ```
5 | 自定义库
6 | release库
7 | snapshot库
8 | mavenLocal()
9 | ```
10 |
11 | #### 一. 自定义库
12 | 可选值 , 使用 `-DmavenRepoUrl="xxx"` 引入
13 |
14 | #### 二. release库
15 | - 当编译环境为Github Action时 , 使用
16 | ```
17 | mavenCentral()
18 | gradlePluginPortal()
19 | ```
20 | - 其他情况 , 使用
21 | ```
22 | https://mirrors.tencent.com/nexus/repository/maven-public/
23 | https://mirrors.tencent.com/nexus/repository/gradle-plugins/
24 | ```
25 | #### 三. snapshot库
26 | ```
27 | https://central.sonatype.com/repository/maven-snapshots/
28 | ```
29 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-schedule/devops-schedule-server/src/main/kotlin/com/tencent/devops/schedule/router/WorkerRouter.kt:
--------------------------------------------------------------------------------
1 | package com.tencent.devops.schedule.router
2 |
3 | import com.tencent.devops.schedule.pojo.trigger.TriggerParam
4 |
5 | /**
6 | * worker路由类
7 | */
8 | interface WorkerRouter {
9 | /**
10 | * 任务路由
11 | * @param triggerParam 任务触发参数
12 | * @param addressList worker地址列表
13 | *
14 | * @return 路由地址,可能为null
15 | */
16 | fun route(triggerParam: TriggerParam, addressList: List): String?
17 |
18 | }
19 |
--------------------------------------------------------------------------------
/devops-boot-sample/webflux-sample/boot-webflux-sample/src/main/resources/bootstrap.yaml:
--------------------------------------------------------------------------------
1 | service:
2 | prefix: devops-
3 | spring:
4 | application:
5 | name: kotlin-sample
6 | cloud:
7 | consul:
8 | discovery:
9 | tags: env=xxx, a=b
10 | metadata:
11 | env: aaa
12 | enabled: false
13 |
14 | resilience4j:
15 | thread-pool-bulkhead:
16 | instances:
17 | backendA:
18 | maxThreadPoolSize: 1
19 | coreThreadPoolSize: 1
20 | bulkhead:
21 | instances:
22 | backendB:
23 | maxConcurrentCalls: 10
24 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-schedule/devops-schedule-common/src/main/kotlin/com/tencent/devops/schedule/api/ServerRpcClient.kt:
--------------------------------------------------------------------------------
1 | package com.tencent.devops.schedule.api
2 |
3 | import com.tencent.devops.schedule.pojo.job.JobExecutionResult
4 | import com.tencent.devops.schedule.pojo.trigger.HeartBeatParam
5 |
6 | /**
7 | * 远程调用客户端
8 | */
9 | interface ServerRpcClient {
10 |
11 | /**
12 | * 运行任务
13 | */
14 | fun submitResult(result: JobExecutionResult)
15 |
16 | /**
17 | * 心跳
18 | */
19 | fun heartBeat(param: HeartBeatParam)
20 | }
21 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-schedule/devops-schedule-server/src/main/resources/frontend/src/api/user.js:
--------------------------------------------------------------------------------
1 | import request from '@/utils/request'
2 |
3 | export function login(data) {
4 | return request({
5 | url: '/user/login',
6 | method: 'post',
7 | data
8 | })
9 | }
10 |
11 | export function getInfo(token) {
12 | return request({
13 | url: '/user/info',
14 | method: 'get',
15 | params: { token }
16 | })
17 | }
18 |
19 | export function logout() {
20 | return request({
21 | url: '/user/logout',
22 | method: 'post'
23 | })
24 | }
25 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-tools/devops-release-gradle-plugin/src/main/kotlin/com/tencent/devops/dsl/DevOpsReleasePluginExtension.kt:
--------------------------------------------------------------------------------
1 | package com.tencent.devops.dsl
2 |
3 | import org.gradle.api.provider.Property
4 |
5 | interface DevOpsReleasePluginExtension {
6 | /**
7 | * scm url
8 | * */
9 | val scmUrl: Property
10 |
11 | /**
12 | * 开发版本的快照后缀
13 | * */
14 | val snapshotSuffix: Property
15 |
16 | /**
17 | * SemVer的增长策略
18 | * 可选值MAJOR, MINOR, PATCH
19 | * */
20 | val incrementPolicy: Property
21 | }
22 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-schedule/devops-schedule-common/src/main/kotlin/com/tencent/devops/schedule/constants/ApiConstants.kt:
--------------------------------------------------------------------------------
1 | package com.tencent.devops.schedule.constants
2 |
3 | /**
4 | * server api
5 | */
6 | const val SERVER_BASE_PATH = "\${devops.schedule.server.context-path:/}"
7 | const val SERVER_API_V1 = "/api/v1"
8 | const val SERVER_RPC_V1 = "/rpc/v1"
9 | const val RPC_SUBMIT_RESULT = "/job/submit"
10 | const val RPC_HEART_BEAT = "/heartbeat"
11 |
12 | /**
13 | * worker api
14 | */
15 | const val WORKER_RPC_V1 = "/rpc/v1"
16 | const val RPC_RUN_JOB = "/job/run"
17 |
--------------------------------------------------------------------------------
/devops-boot-sample/boot-kotlin-sample/src/main/resources/bootstrap.yaml:
--------------------------------------------------------------------------------
1 | service:
2 | prefix: devops-
3 | spring:
4 | application:
5 | name: kotlin-sample
6 | cloud:
7 | consul:
8 | discovery:
9 | tags: env=xxx, a=b
10 | metadata:
11 | env: aaa
12 | enabled: false
13 | server:
14 | port: 8080
15 |
16 | resilience4j:
17 | thread-pool-bulkhead:
18 | instances:
19 | backendA:
20 | maxThreadPoolSize: 1
21 | coreThreadPoolSize: 1
22 | bulkhead:
23 | instances:
24 | backendB:
25 | maxConcurrentCalls: 10
26 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-boot/src/main/kotlin/com/tencent/devops/boot/DevOpsApplicationExtensions.kt:
--------------------------------------------------------------------------------
1 | package com.tencent.devops.boot
2 |
3 | import org.springframework.boot.SpringApplication
4 | import org.springframework.context.ConfigurableApplicationContext
5 |
6 | /**
7 | * SpringBoot 提供的runApplication(vararg args: String)方法使用了kotlin的变长参数传递,会导致detekt提示`SpreadOperator`问题
8 | * 利用数组传递可以避免此问题
9 | */
10 | inline fun runApplication(args: Array): ConfigurableApplicationContext {
11 | return SpringApplication.run(arrayOf(T::class.java), args)
12 | }
13 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-plugin/devops-plugin-api/src/main/kotlin/com/tencent/devops/plugin/api/PluginManagerExtensions.kt:
--------------------------------------------------------------------------------
1 | package com.tencent.devops.plugin.api
2 |
3 | /**
4 | * 查找扩展点, kotlin风格扩展函数
5 | */
6 | inline fun PluginManager.find(): List {
7 | return this.findExtensionPoints(T::class.java)
8 | }
9 |
10 | /**
11 | * 查找扩展点并遍历执行扩展逻辑
12 | */
13 | inline fun PluginManager.applyExtension(block: T.() -> Unit) {
14 | this.findExtensionPoints(T::class.java).forEach {
15 | block(it)
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-web/src/main/kotlin/com/tencent/devops/web/banner/DevOpsBannerInitializer.kt:
--------------------------------------------------------------------------------
1 | package com.tencent.devops.web.banner
2 |
3 | import org.springframework.context.ApplicationContextInitializer
4 | import org.springframework.context.ConfigurableApplicationContext
5 |
6 | class DevOpsBannerInitializer : ApplicationContextInitializer {
7 | override fun initialize(applicationContext: ConfigurableApplicationContext) {
8 | System.setProperty("devops-boot.version", DevOpsBootVersion.getVersion().orEmpty())
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-schedule/devops-schedule-server/src/main/resources/frontend/src/icons/svg/example.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-schedule/devops-schedule-common/src/main/kotlin/com/tencent/devops/schedule/pojo/log/LogQueryParam.kt:
--------------------------------------------------------------------------------
1 | package com.tencent.devops.schedule.pojo.log
2 |
3 | import com.tencent.devops.schedule.pojo.page.BasePageRequest
4 | import java.time.LocalDateTime
5 |
6 | class LogQueryParam(
7 | var jobId: String? = null,
8 | var triggerTime: List? = null,
9 | var executionCode: Int? = null,
10 | var triggerCode: Int? = null,
11 | var triggerTimeFrom: LocalDateTime? = null,
12 | var triggerTimeTo: LocalDateTime? = null,
13 | ) : BasePageRequest()
14 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-schedule/devops-schedule-worker/src/main/kotlin/com/tencent/devops/schedule/k8s/ResourceLimitProperties.kt:
--------------------------------------------------------------------------------
1 | package com.tencent.devops.schedule.k8s
2 |
3 | /**
4 | * 资源限制
5 | * */
6 | data class ResourceLimitProperties(
7 | val limitMem: Long = 32 * GB,
8 | val limitStorage: Long = 128 * GB,
9 | val limitCpu: Double = 16.0,
10 | val requestMem: Long = 16 * GB,
11 | val requestStorage: Long = 16 * GB,
12 | val requestCpu: Double = 4.0,
13 | ) {
14 | companion object {
15 | private const val GB = 1024 * 1024 * 1024L
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/docs/starter/devops-boot-starter-loadbalancer.md:
--------------------------------------------------------------------------------
1 | # devops-boot-starter-loadbalancer
2 |
3 | `starter-loadbalancer`组件帮助开发者完成微服务客户端负载均衡的配置
4 |
5 | ## 功能介绍
6 | ?> 待完善
7 |
8 | ## 使用方式
9 | - **build.gradle.kts**
10 |
11 | ```kotlin
12 | implementation("com.tencent.devops:devops-boot-starter-loadbalancer")
13 | ```
14 |
15 | - **build.gradle**
16 |
17 | ```groovy
18 | implementation 'com.tencent.devops:devops-boot-starter-loadbalancer'
19 | ```
20 |
21 | ## 配置属性
22 |
23 | | 属性 | 类型 | 默认值 | 说明 |
24 | | ------------------ | ------- | ------ | ------------------ |
25 |
26 | ## 说明
27 |
28 |
--------------------------------------------------------------------------------
/.github/workflows/build-on-pr.yml:
--------------------------------------------------------------------------------
1 | # Trigger building on pull request event
2 | name: Build
3 | on:
4 | pull_request:
5 | paths-ignore:
6 | - '.github/**'
7 | - 'docs/**'
8 |
9 | jobs:
10 | build:
11 | runs-on: ubuntu-latest
12 | steps:
13 | - uses: actions/checkout@v2
14 | - name: Set up JDK 17
15 | uses: actions/setup-java@v1
16 | with:
17 | java-version: 17
18 | - name: Set up Node JS
19 | uses: actions/setup-node@v2
20 | with:
21 | node-version: 14
22 | - name: Build with Gradle
23 | run: ./gradlew build
24 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-logging/src/main/kotlin/com/tencent/devops/logging/enums/LogType.kt:
--------------------------------------------------------------------------------
1 | package com.tencent.devops.logging.enums
2 |
3 | import com.tencent.devops.logging.system.java.DevopsJavaLoggingSystem
4 | import com.tencent.devops.logging.system.log4j.DevopsLog4J2LoggingSystem
5 | import com.tencent.devops.logging.system.logback.DevopsLogbackLoggingSystem
6 |
7 | enum class LogType(val className: String) {
8 | LOGBACK(DevopsLogbackLoggingSystem::class.java.name),
9 | LOG4J2(DevopsLog4J2LoggingSystem::class.java.name),
10 | JAVA(DevopsJavaLoggingSystem::class.java.name)
11 | }
12 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-plugin/devops-plugin-api/src/main/kotlin/com/tencent/devops/plugin/api/PluginInfo.kt:
--------------------------------------------------------------------------------
1 | package com.tencent.devops.plugin.api
2 |
3 | /**
4 | * 插件信息
5 | */
6 | class PluginInfo(
7 | /**
8 | * 插件id
9 | */
10 | val id: String,
11 | /**
12 | * 插件元数据信息
13 | */
14 | val metadata: PluginMetadata,
15 | /**
16 | * 文件摘要
17 | */
18 | val digest: String,
19 | /**
20 | * 插件扩展点
21 | */
22 | val extensionPoints: List,
23 | /**
24 | * 扩展controller
25 | */
26 | val extensionControllers: List
27 | )
28 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-schedule/devops-schedule-server/src/main/resources/frontend/src/styles/mixin.scss:
--------------------------------------------------------------------------------
1 | @mixin clearfix {
2 | &:after {
3 | content: "";
4 | display: table;
5 | clear: both;
6 | }
7 | }
8 |
9 | @mixin scrollBar {
10 | &::-webkit-scrollbar-track-piece {
11 | background: #d3dce6;
12 | }
13 |
14 | &::-webkit-scrollbar {
15 | width: 6px;
16 | }
17 |
18 | &::-webkit-scrollbar-thumb {
19 | background: #99a9bf;
20 | border-radius: 20px;
21 | }
22 | }
23 |
24 | @mixin relative {
25 | position: relative;
26 | width: 100%;
27 | height: 100%;
28 | }
29 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-schedule/devops-schedule-worker/src/main/kotlin/com/tencent/devops/schedule/handler/JobSystemEnv.kt:
--------------------------------------------------------------------------------
1 | package com.tencent.devops.schedule.handler
2 |
3 | /**
4 | * 任务系统环境变量
5 | * */
6 | object JobSystemEnv {
7 | const val JOB_ID = "DEVOPS_SCHEDULE_JOB_ID"
8 | const val JOB_PARAMETERS = "DEVOPS_SCHEDULE_JOB_PARAMETERS"
9 | const val LOG_ID = "DEVOPS_SCHEDULE_LOG_ID"
10 | const val TRIGGER_TIME = "DEVOPS_SCHEDULE_TRIGGER_TIME"
11 | const val BROADCAST_INDEX = "DEVOPS_SCHEDULE_BROADCAST_INDEX"
12 | const val BROADCAST_TOTAL = "DEVOPS_SCHEDULE_BROADCAST_TOTAL"
13 | }
14 |
--------------------------------------------------------------------------------
/docs/starter/devops-boot-starter-circuitbreaker.md:
--------------------------------------------------------------------------------
1 | # devops-boot-starter-circuitbreaker
2 |
3 | `starter-circuitbreaker`组件帮助开发者完成微服务客户端熔断器&限流的配置
4 |
5 | ## 功能介绍
6 | ?> 待完善
7 |
8 | ## 使用方式
9 | - **build.gradle.kts**
10 |
11 | ```kotlin
12 | implementation("com.tencent.devops:devops-boot-starter-circuitbreaker")
13 | ```
14 |
15 | - **build.gradle**
16 |
17 | ```groovy
18 | implementation 'com.tencent.devops:devops-boot-starter-circuitbreaker'
19 | ```
20 |
21 | ## 配置属性
22 |
23 | | 属性 | 类型 | 默认值 | 说明 |
24 | | ------------------ | ------- | ------ | ------------------ |
25 |
26 | ## 说明
27 |
28 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-schedule/devops-schedule-model-mongodb/src/main/kotlin/com/tencent/devops/schedule/mongo/repository/WorkerGroupRepository.kt:
--------------------------------------------------------------------------------
1 | package com.tencent.devops.schedule.mongo.repository
2 |
3 | import com.tencent.devops.schedule.mongo.model.TWorkerGroup
4 | import org.springframework.data.mongodb.repository.MongoRepository
5 | import org.springframework.stereotype.Repository
6 |
7 | @Repository
8 | interface WorkerGroupRepository: MongoRepository {
9 | fun findByName(name: String): TWorkerGroup?
10 | fun findAllGroupByDiscoveryType(type: Int): List
11 | }
12 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-schedule/devops-schedule-common/src/main/kotlin/com/tencent/devops/schedule/pojo/worker/WorkerGroup.kt:
--------------------------------------------------------------------------------
1 | package com.tencent.devops.schedule.pojo.worker
2 |
3 | import java.time.LocalDateTime
4 |
5 | data class WorkerGroup(
6 | var id: String? = null,
7 |
8 | /**
9 | * 工作组名称,全局唯一
10 | */
11 | var name: String,
12 |
13 | /**
14 | * 地址发现类型
15 | */
16 | var discoveryType: Int,
17 |
18 | /**
19 | * 状态更新时间
20 | */
21 | var updateTime: LocalDateTime,
22 |
23 | /**
24 | * 执行器地址列表
25 | */
26 | var registryList: List
27 | )
28 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-schedule/devops-schedule-worker/src/main/kotlin/com/tencent/devops/schedule/executor/JobHandler.kt:
--------------------------------------------------------------------------------
1 | package com.tencent.devops.schedule.executor
2 |
3 | import com.tencent.devops.schedule.pojo.job.JobExecutionResult
4 |
5 | /**
6 | * 任务处理器,调度中心自动调用JobHandler的execute方法
7 | */
8 | interface JobHandler {
9 | /**
10 | * 任务执行逻辑
11 | * @param context 任务context,可以获取任务参数,任务id,执行记录id等信息
12 | * @return 任务记录执行结果
13 | * JobExecutionResult.success() 执行成功
14 | * JobExecutionResult.failed(message) 执行失败
15 | */
16 | fun execute(context: JobContext): JobExecutionResult
17 | }
18 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-starters/build.gradle.kts:
--------------------------------------------------------------------------------
1 | plugins {
2 | kotlin("jvm")
3 | id("io.spring.dependency-management")
4 | }
5 |
6 | description = "Starter for DevOps Boot"
7 |
8 | subprojects {
9 | apply(plugin = "java-library")
10 | apply(plugin = "io.spring.dependency-management")
11 |
12 | dependencyManagement {
13 | imports {
14 | mavenBom(MavenBom.SpringBoot)
15 | mavenBom(MavenBom.SpringCloud)
16 | }
17 | pomCustomizationSettings.isEnabled = false
18 | }
19 |
20 | dependencies {
21 | implementation(platform(project(MavenBom.DevOpsBoot)))
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-schedule/devops-schedule-model-mongodb/src/main/kotlin/com/tencent/devops/schedule/mongo/repository/WorkerRepository.kt:
--------------------------------------------------------------------------------
1 | package com.tencent.devops.schedule.mongo.repository
2 |
3 | import com.tencent.devops.schedule.mongo.model.TWorker
4 | import org.springframework.data.mongodb.repository.MongoRepository
5 | import org.springframework.stereotype.Repository
6 | import java.time.LocalDateTime
7 |
8 | @Repository
9 | interface WorkerRepository: MongoRepository {
10 | fun deleteByUpdateTimeLessThan(time: LocalDateTime): Long
11 | fun findAllByUpdateTimeGreaterThan(time: LocalDateTime): List
12 | }
13 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-schedule/devops-schedule-common/src/main/kotlin/com/tencent/devops/schedule/utils/Preconditions.kt:
--------------------------------------------------------------------------------
1 | package com.tencent.devops.schedule.utils
2 |
3 | inline fun validate(block: () -> R): R {
4 | return validate(block) { "Failed requirement." }
5 | }
6 |
7 | /**
8 | * 验证参数执行正确, 顺利则返回验证方法的结果,出现异常则抛[IllegalArgumentException]
9 | * @param block 验证方法
10 | * @return R
11 | */
12 | inline fun validate(block: () -> R, lazyMessage: () -> Any): R {
13 | try {
14 | return block()
15 | } catch (t: Throwable) {
16 | val message = lazyMessage()
17 | throw IllegalArgumentException(message.toString())
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/devops-boot-sample/webflux-sample/biz-webflux-sample/src/main/kotlin/com/tencent/devops/sample/config/RouteConfiguration.kt:
--------------------------------------------------------------------------------
1 | package com.tencent.devops.sample.config
2 |
3 | import com.tencent.devops.sample.filter.SampleHandlerFilterFunction
4 | import com.tencent.devops.sample.handler.SampleHandler
5 | import org.springframework.web.reactive.function.server.coRouter
6 |
7 | class RouteConfiguration(
8 | val sampleHandler: SampleHandler,
9 | val sampleHandlerFilterFunction: SampleHandlerFilterFunction,
10 | ) {
11 |
12 | fun router() = coRouter {
13 | filter(sampleHandlerFilterFunction::filter)
14 | GET("/test/{name}", sampleHandler::getSample)
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-schedule/devops-schedule-server/src/main/resources/frontend/src/icons/svg/table.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-plugin/devops-plugin-api/src/main/kotlin/com/tencent/devops/plugin/api/PluginMetadata.kt:
--------------------------------------------------------------------------------
1 | package com.tencent.devops.plugin.api
2 |
3 | /**
4 | * 插件metadata信息
5 | */
6 | data class PluginMetadata(
7 | /**
8 | * 插件id,要求唯一
9 | */
10 | val id: String,
11 | /**
12 | * 插件名称,要求唯一,先保持和id一致
13 | */
14 | val name: String,
15 | /**
16 | * 插件版本,语义化版本格式
17 | */
18 | val version: String,
19 | /**
20 | * 插件生效范围
21 | */
22 | val scope: List,
23 | /**
24 | * 插件作者
25 | */
26 | val author: String? = null,
27 | /**
28 | * 插件描述
29 | */
30 | val description: String? = null
31 | )
32 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-schedule/devops-schedule-common/src/main/kotlin/com/tencent/devops/schedule/enums/WorkerStatusEnum.kt:
--------------------------------------------------------------------------------
1 | package com.tencent.devops.schedule.enums
2 |
3 | /**
4 | * worker中台枚举
5 | */
6 | enum class WorkerStatusEnum(
7 | private val code: Int,
8 | private val label: String
9 | ): DictItem {
10 |
11 | STOP(0, "停止"),
12 | RUNNING(1, "正常");
13 |
14 | override fun code() = code
15 | override fun description() = label
16 |
17 | companion object {
18 | /**
19 | * 根据[code]查找对应的枚举类型
20 | */
21 | fun ofCode(code: Int): WorkerStatusEnum? {
22 | return values().find { it.code == code }
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-schedule/devops-schedule-model-mongodb/src/main/kotlin/com/tencent/devops/schedule/mongo/model/TWorker.kt:
--------------------------------------------------------------------------------
1 | package com.tencent.devops.schedule.mongo.model
2 |
3 | import org.springframework.data.mongodb.core.mapping.Document
4 | import java.time.LocalDateTime
5 |
6 | /**
7 | * worker registry
8 | * job执行器注册表
9 | */
10 | @Document(collection = "worker_info")
11 | data class TWorker(
12 |
13 | var id: String? = null,
14 |
15 | /**
16 | * 地址,格式ip:port
17 | */
18 | var address: String,
19 |
20 | /**
21 | * 工作组名称
22 | */
23 | var group: String,
24 |
25 | /**
26 | * 状态更新时间
27 | */
28 | var updateTime: LocalDateTime,
29 | )
30 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-schedule/devops-schedule-server/src/main/resources/frontend/babel.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | presets: [
3 | // https://github.com/vuejs/vue-cli/tree/master/packages/@vue/babel-preset-app
4 | '@vue/cli-plugin-babel/preset'
5 | ],
6 | 'env': {
7 | 'development': {
8 | // babel-plugin-dynamic-import-node plugin only does one thing by converting all import() to require().
9 | // This plugin can significantly increase the speed of hot updates, when you have a large number of pages.
10 | // https://panjiachen.github.io/vue-element-admin-site/guide/advanced/lazy-loading.html
11 | 'plugins': ['dynamic-import-node']
12 | }
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-schedule/devops-schedule-common/src/main/kotlin/com/tencent/devops/schedule/pojo/ScheduleResponse.kt:
--------------------------------------------------------------------------------
1 | package com.tencent.devops.schedule.pojo
2 |
3 | import com.tencent.devops.schedule.enums.TriggerCodeEnum
4 |
5 | /**
6 | * 调度结果
7 | */
8 | data class ScheduleResponse(
9 | val code: Int,
10 | val message: String? = null
11 | ) {
12 | companion object {
13 |
14 | /**
15 | * 执行成功
16 | */
17 | fun success() = ScheduleResponse(TriggerCodeEnum.SUCCESS.code())
18 |
19 | /**
20 | * 执行失败
21 | */
22 | fun failed(message: String) = ScheduleResponse(TriggerCodeEnum.FAILED.code(), message)
23 | }
24 | }
25 |
26 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-schedule/devops-schedule-server/src/main/resources/frontend/src/icons/svg/password.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-schedule/devops-schedule-common/src/main/kotlin/com/tencent/devops/schedule/pojo/page/Page.kt:
--------------------------------------------------------------------------------
1 | package com.tencent.devops.schedule.pojo.page
2 |
3 | import kotlin.math.ceil
4 |
5 | data class Page(
6 | val pageNumber: Int,
7 | val pageSize: Int,
8 | val totalRecords: Long,
9 | val totalPages: Long,
10 | val records: List
11 | ) {
12 | constructor(pageNumber: Int, pageSize: Int, totalRecords: Long, records: List) : this(
13 | pageNumber = pageNumber,
14 | pageSize = pageSize,
15 | totalRecords = totalRecords,
16 | totalPages = ceil(totalRecords * 1.0 / pageSize).toLong(),
17 | records = records
18 | )
19 | }
20 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | HELP.md
2 | .gradle
3 | build/
4 | !gradle/wrapper/gradle-wrapper.jar
5 | !**/src/main/**/build/
6 | !**/src/test/**/build/
7 | ### STS ###
8 | .apt_generated
9 | .classpath
10 | .factorypath
11 | .project
12 | .settings
13 | .springBeans
14 | .sts4-cache
15 | ### IntelliJ IDEA ###
16 | .idea
17 | *.iws
18 | *.iml
19 | *.ipr
20 | out/
21 | !**/src/main/**/out/
22 | !**/src/test/**/out/
23 | ### NetBeans ###
24 | /nbproject/private/
25 | /nbbuild/
26 | /dist/
27 | /nbdist/
28 | /.nb-gradle/
29 | ### VS Code ###
30 | .vscode/
31 | ### NodeJS ###
32 | .DS_Store
33 | node_modules/
34 | dist/
35 | npm-debug.log*
36 | yarn-debug.log*
37 | yarn-error.log*
38 | package-lock.json
39 | tests/**/coverage/
40 |
41 | logs/
42 | release/
43 |
--------------------------------------------------------------------------------
/devops-boot-sample/boot-java-sample/src/main/java/com/tencent/devops/sample/JavaApplication.java:
--------------------------------------------------------------------------------
1 | package com.tencent.devops.sample;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 | import org.springframework.web.bind.annotation.RequestMapping;
6 | import org.springframework.web.bind.annotation.RestController;
7 |
8 | @SpringBootApplication
9 | @RestController
10 | public class JavaApplication {
11 |
12 | @RequestMapping
13 | public String greeting() {
14 | return "Hello, Devops!";
15 | }
16 |
17 |
18 | public static void main(String[] args) {
19 | SpringApplication.run(JavaApplication.class, args);
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-logging/src/main/kotlin/com/tencent/devops/logging/system/java/DevopsJavaLoggingSystem.kt:
--------------------------------------------------------------------------------
1 | package com.tencent.devops.logging.system.java
2 |
3 | import org.springframework.boot.logging.LoggingSystemProperties
4 | import org.springframework.boot.logging.java.JavaLoggingSystem
5 | import org.springframework.core.env.ConfigurableEnvironment
6 |
7 | /**
8 | * devops-framework在java框架下的log system
9 | */
10 | class DevopsJavaLoggingSystem(
11 | classLoader: ClassLoader
12 | ) : JavaLoggingSystem(classLoader) {
13 |
14 | override fun getSystemProperties(environment: ConfigurableEnvironment): LoggingSystemProperties {
15 | return DevopsJavaSystemProperties(environment)
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-schedule/devops-schedule-server/src/main/kotlin/com/tencent/devops/schedule/scheduler/JobTriggerContext.kt:
--------------------------------------------------------------------------------
1 | package com.tencent.devops.schedule.scheduler
2 |
3 | import com.tencent.devops.schedule.pojo.job.JobInfo
4 |
5 | /**
6 | * 任务触发上下文
7 | * */
8 | data class JobTriggerContext(
9 | /**
10 | * 任务信息
11 | * */
12 | val job: JobInfo,
13 | /**
14 | * 触发时间
15 | * */
16 | val fireTime: Long,
17 | /**
18 | * 上次触发时间
19 | * */
20 | val prevFireTime: Long? = null,
21 | /**
22 | * 下次触发时间
23 | * */
24 | val nextFireTime: Long? = null,
25 | /**
26 | * 调度触发时间
27 | * */
28 | val scheduledFireTime: Long? = null,
29 | )
30 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-schedule/devops-schedule-common/src/main/kotlin/com/tencent/devops/schedule/enums/TriggerCodeEnum.kt:
--------------------------------------------------------------------------------
1 | package com.tencent.devops.schedule.enums
2 |
3 | /**
4 | * 运行模式
5 | */
6 | enum class TriggerCodeEnum(
7 | private val code: Int,
8 | private val label: String
9 | ): DictItem {
10 |
11 | INITIALED(0, "未触发"),
12 | SUCCESS(1, "触发成功"),
13 | FAILED(-1, "触发失败");
14 |
15 | override fun code() = code
16 | override fun description() = label
17 |
18 | companion object {
19 | /**
20 | * 根据[code]查找对应的枚举类型
21 | */
22 | fun ofCode(code: Int): TriggerCodeEnum? {
23 | return values().find { it.code == code }
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-logging/src/main/kotlin/com/tencent/devops/logging/system/log4j/DevopsLog4J2LoggingSystem.kt:
--------------------------------------------------------------------------------
1 | package com.tencent.devops.logging.system.log4j
2 |
3 | import org.springframework.boot.logging.LoggingSystemProperties
4 | import org.springframework.boot.logging.log4j2.Log4J2LoggingSystem
5 | import org.springframework.core.env.ConfigurableEnvironment
6 |
7 | /**
8 | * devops-framework在log4j2框架下的log system
9 | */
10 | class DevopsLog4J2LoggingSystem(
11 | classLoader: ClassLoader
12 | ) : Log4J2LoggingSystem(classLoader) {
13 |
14 | override fun getSystemProperties(environment: ConfigurableEnvironment): LoggingSystemProperties {
15 | return DevopsLog4J2SystemProperties(environment)
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-logging/src/main/kotlin/com/tencent/devops/logging/system/logback/DevopsLogbackLoggingSystem.kt:
--------------------------------------------------------------------------------
1 | package com.tencent.devops.logging.system.logback
2 |
3 | import org.springframework.boot.logging.LoggingSystemProperties
4 | import org.springframework.boot.logging.logback.LogbackLoggingSystem
5 | import org.springframework.core.env.ConfigurableEnvironment
6 |
7 | /**
8 | * devops-framework在logback框架下的log system
9 | */
10 | class DevopsLogbackLoggingSystem(
11 | classLoader: ClassLoader
12 | ) : LogbackLoggingSystem(classLoader) {
13 |
14 | override fun getSystemProperties(environment: ConfigurableEnvironment): LoggingSystemProperties {
15 | return DevopsLogbackSystemProperties(environment)
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-schedule/devops-schedule-common/src/main/kotlin/com/tencent/devops/schedule/enums/TriggerTypeEnum.kt:
--------------------------------------------------------------------------------
1 | package com.tencent.devops.schedule.enums
2 |
3 | enum class TriggerTypeEnum(
4 | private val code: Int,
5 | private val label: String
6 | ): DictItem {
7 | MANUAL(0, "手动触发"),
8 | CRON(1, "CRON触发"),
9 | RETRY(2, "失败重试"),
10 | API(3, "API触发"),
11 | MISFIRE(4, "过期补偿");
12 |
13 | override fun code() = code
14 | override fun description() = label
15 |
16 | companion object {
17 | /**
18 | * 根据[code]查找对应的枚举类型
19 | */
20 | fun ofCode(code: Int): TriggerTypeEnum? {
21 | return values().find { it.code == code }
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-logging/src/main/kotlin/com/tencent/devops/logging/LoggingAutoConfiguration.kt:
--------------------------------------------------------------------------------
1 | package com.tencent.devops.logging
2 |
3 | import com.tencent.devops.logging.props.DevopsLoggingProperties
4 | import com.tencent.devops.logging.system.DevopsLoggingApplicationListener
5 | import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication
6 | import org.springframework.boot.context.properties.EnableConfigurationProperties
7 | import org.springframework.context.annotation.Bean
8 | import org.springframework.context.annotation.Configuration
9 |
10 | @Configuration(proxyBeanMethods = false)
11 | @ConditionalOnWebApplication
12 | @EnableConfigurationProperties(DevopsLoggingProperties::class)
13 | class LoggingAutoConfiguration
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-service/src/main/kotlin/com/tencent/devops/service/config/ServiceProperties.kt:
--------------------------------------------------------------------------------
1 | package com.tencent.devops.service.config
2 |
3 | import com.tencent.devops.service.config.ServiceProperties.Companion.PREFIX
4 | import org.springframework.boot.context.properties.ConfigurationProperties
5 |
6 | @ConfigurationProperties(PREFIX)
7 | data class ServiceProperties(
8 | /**
9 | * 服务名称前缀,如prefix-,默认为空
10 | *
11 | * 用于服务注册与获取配置时,添加服务前缀
12 | */
13 | var prefix: String = "",
14 |
15 | /**
16 | * 服务名称后缀, 如-suffix,默认为空
17 | *
18 | * 用于服务注册与获取配置时,添加服务前缀
19 | */
20 | var suffix: String = "",
21 | ) {
22 | companion object {
23 | const val PREFIX = "service"
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/devops-boot-sample/boot-schedule-worker-cloud-sample/src/main/kotlin/com/tencent/devops/schedule/sample/handler/SampleJobHandler.kt:
--------------------------------------------------------------------------------
1 | package com.tencent.devops.schedule.sample.handler
2 |
3 | import com.tencent.devops.schedule.executor.JobContext
4 | import com.tencent.devops.schedule.executor.JobHandler
5 | import com.tencent.devops.schedule.pojo.job.JobExecutionResult
6 | import org.springframework.stereotype.Component
7 |
8 | @Component("com.tencent.devops.schedule.sample.SampleJobHandler")
9 | class SampleJobHandler : JobHandler {
10 | override fun execute(context: JobContext): JobExecutionResult {
11 | val name = context.jobParamMap["name"].toString()
12 | println("Hello, $name!")
13 | return JobExecutionResult.success()
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-schedule/devops-schedule-common/src/main/kotlin/com/tencent/devops/schedule/enums/DictItemSerializable.kt:
--------------------------------------------------------------------------------
1 | package com.tencent.devops.schedule.enums
2 |
3 | import com.fasterxml.jackson.core.JsonGenerator
4 | import com.fasterxml.jackson.databind.JsonSerializer
5 | import com.fasterxml.jackson.databind.SerializerProvider
6 |
7 | /**
8 | * [DictItem]自定义序列化
9 | */
10 | class DictItemSerializable: JsonSerializer() {
11 | override fun serialize(value: DictItem, gen: JsonGenerator, serializers: SerializerProvider) {
12 | gen.writeStartObject()
13 | gen.writeNumberField("value", value.code())
14 | gen.writeStringField("label", value.description())
15 | gen.writeEndObject()
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-plugin/devops-plugin-api/src/main/kotlin/com/tencent/devops/plugin/api/PluginManager.kt:
--------------------------------------------------------------------------------
1 | package com.tencent.devops.plugin.api
2 |
3 | /**
4 | * 插件管理器
5 | */
6 | interface PluginManager {
7 |
8 | /**
9 | * 加载所有插件
10 | */
11 | fun load()
12 |
13 | /**
14 | * 加载插件
15 | * @param id 插件id
16 | */
17 | fun load(id: String)
18 |
19 | /**
20 | * 卸载插件
21 | * @param id 插件id
22 | */
23 | fun unload(id: String)
24 |
25 | /**
26 | * 查找扩展点列表
27 | * @param clazz 扩展点类型
28 | */
29 | fun findExtensionPoints(clazz: Class): List
30 |
31 | /**
32 | * 获取注册的插件列表
33 | */
34 | fun getPluginMap(): Map
35 | }
36 |
--------------------------------------------------------------------------------
/settings.gradle.kts:
--------------------------------------------------------------------------------
1 | rootProject.name = "devops-framework"
2 |
3 | fun File.directories() = listFiles()?.filter { it.isDirectory && it.name != "build" }?.toList() ?: emptyList()
4 |
5 | fun includeAll(module: String) {
6 | include(module)
7 | val name = module.replace(":", "/")
8 | file("$rootDir/$name/").directories().forEach {
9 | include("$module:${it.name}")
10 | }
11 | }
12 |
13 | includeAll("devops-boot-project:devops-boot-core")
14 | includeAll("devops-boot-project:devops-boot-dependencies")
15 | includeAll("devops-boot-project:devops-boot-starters")
16 | includeAll("devops-boot-project:devops-boot-tools")
17 |
18 | includeAll("devops-boot-project:devops-boot-core:devops-plugin")
19 | includeAll("devops-boot-project:devops-boot-core:devops-schedule")
20 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-schedule/devops-schedule-common/src/main/kotlin/com/tencent/devops/schedule/enums/BlockStrategyEnum.kt:
--------------------------------------------------------------------------------
1 | package com.tencent.devops.schedule.enums
2 |
3 | /**
4 | * 阻塞处理策略
5 | */
6 | enum class BlockStrategyEnum(
7 | private val code: Int,
8 | private val label: String,
9 | ) : DictItem {
10 |
11 | SERIAL_EXECUTION(1, "串行"),
12 | DISCARD_LATER(2, "丢弃最后"),
13 | COVER_EARLY(3, "覆盖之前"),
14 | ;
15 |
16 | override fun code() = code
17 | override fun description() = label
18 |
19 | companion object {
20 | /**
21 | * 根据[code]查找对应的枚举类型
22 | */
23 | fun ofCode(code: Int): BlockStrategyEnum? {
24 | return values().find { it.code == code }
25 | }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-schedule/devops-schedule-common/src/main/kotlin/com/tencent/devops/schedule/enums/ExecutionCodeEnum.kt:
--------------------------------------------------------------------------------
1 | package com.tencent.devops.schedule.enums
2 |
3 | /**
4 | * 任务状态
5 | */
6 | enum class ExecutionCodeEnum(
7 | private val code: Int,
8 | private val label: String
9 | ): DictItem {
10 |
11 | INITIALED(0, "未执行"),
12 | RUNNING(1, "正在执行"),
13 | SUCCESS(2, "执行成功"),
14 | FAILED(-1, "执行失败");
15 |
16 | override fun code() = code
17 | override fun description() = label
18 |
19 | companion object {
20 | /**
21 | * 根据[code]查找对应的枚举类型
22 | */
23 | fun ofCode(code: Int): ExecutionCodeEnum? {
24 | return values().find { it.code == code }
25 | }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-web/src/main/resources/banner.txt:
--------------------------------------------------------------------------------
1 | ${AnsiColor.CYAN}
2 | ____ _ _ ___ ____ ___
3 | | __ )| |_ _ ___| |/ (_)_ __ __ _ | _ \ _____ __/ _ \ _ __ ___
4 | | _ \| | | | |/ _ \ ' /| | '_ \ / _` | | | | |/ _ \ \ / / | | | '_ \/ __|
5 | | |_) | | |_| | __/ . \| | | | | (_| | | |_| | __/\ V /| |_| | |_) \__ \
6 | |____/|_|\__,_|\___|_|\_\_|_| |_|\__, | |____/ \___| \_/ \___/| .__/|___/
7 | |___/ |_|
8 | ${AnsiColor.GREEN}Spring Boot Version: ${spring-boot.version}
9 | ${AnsiColor.GREEN}Devops Boot Version: ${devops-boot.version}
10 | ${AnsiColor.GREEN}Application Version: ${application.version}${AnsiColor.DEFAULT}
11 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-webflux/src/main/kotlin/com/tencent/devops/webflux/filter/CoWebFilter.kt:
--------------------------------------------------------------------------------
1 | package com.tencent.devops.webflux.filter
2 |
3 | import kotlinx.coroutines.reactor.mono
4 | import org.springframework.web.server.ServerWebExchange
5 | import org.springframework.web.server.WebFilter
6 | import org.springframework.web.server.WebFilterChain
7 | import reactor.core.publisher.Mono
8 |
9 | /**
10 | * 协程版WebFilter
11 | * */
12 | interface CoWebFilter : WebFilter {
13 |
14 | override fun filter(exchange: ServerWebExchange, chain: WebFilterChain): Mono {
15 | return mono {
16 | doFilter(exchange, chain)
17 | }.then()
18 | }
19 |
20 | suspend fun doFilter(exchange: ServerWebExchange, chain: WebFilterChain)
21 | }
22 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-logging/src/main/kotlin/com/tencent/devops/logging/props/DevopsLoggingProperties.kt:
--------------------------------------------------------------------------------
1 | package com.tencent.devops.logging.props
2 |
3 | import org.springframework.boot.context.properties.ConfigurationProperties
4 |
5 | @ConfigurationProperties("devops.logging")
6 | data class DevopsLoggingProperties(
7 | /**
8 | * 日志文件所在路径
9 | */
10 | var path: String? = null,
11 |
12 | /**
13 | * 正常应用日志文件名
14 | */
15 | var appFile: String? = null,
16 |
17 | /**
18 | * 错误应用日志文件名
19 | */
20 | var errorFile: String? = null,
21 |
22 | /**
23 | * access日志文件名
24 | */
25 | var accessFile: String? = null,
26 |
27 | /**
28 | * 日志格式
29 | */
30 | var filePattern: String? = null
31 | )
32 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-schedule/devops-schedule-common/src/main/kotlin/com/tencent/devops/schedule/enums/TriggerStatusEnum.kt:
--------------------------------------------------------------------------------
1 | package com.tencent.devops.schedule.enums
2 |
3 | /**
4 | * 任务状态
5 | */
6 | enum class TriggerStatusEnum(
7 | private val code: Int,
8 | private val label: String
9 | ): DictItem {
10 | /**
11 | * 停止
12 | */
13 | STOP(0, "停止"),
14 |
15 | /**
16 | * 运行
17 | */
18 | RUNNING(1, "运行");
19 |
20 | override fun code() = code
21 | override fun description() = label
22 |
23 | companion object {
24 | /**
25 | * 根据[code]查找对应的枚举类型
26 | */
27 | fun ofCode(code: Int): TriggerStatusEnum? {
28 | return values().find { it.code == code }
29 | }
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-schedule/devops-schedule-server/src/main/resources/frontend/public/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | <%= webpackConfig.name %>
9 |
10 |
11 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/devops-boot-sample/biz-kotlin-sample/src/main/kotlin/com/tencent/devops/sample/controller/SampleController.kt:
--------------------------------------------------------------------------------
1 | package com.tencent.devops.sample.controller
2 |
3 | import com.tencent.devops.api.pojo.Response
4 | import com.tencent.devops.sample.client.SampleClient
5 | import com.tencent.devops.sample.pojo.Sample
6 | import org.springframework.web.bind.annotation.RestController
7 | import java.util.UUID
8 |
9 | /**
10 | * Sample Controller
11 | */
12 | @RestController
13 | class SampleController : SampleClient {
14 |
15 | override fun getSample(): Response {
16 | val sample = Sample(
17 | id = System.currentTimeMillis(),
18 | name = UUID.randomUUID().toString().replace("-", "")
19 | )
20 | return Response.success(sample)
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-schedule/devops-schedule-common/src/main/kotlin/com/tencent/devops/schedule/enums/AlarmStatusEnum.kt:
--------------------------------------------------------------------------------
1 | package com.tencent.devops.schedule.enums
2 |
3 | /**
4 | * 过期处理策略
5 | */
6 | enum class AlarmStatusEnum(
7 | private val code: Int,
8 | private val label: String
9 | ): DictItem {
10 |
11 | LOCKED(-1, "锁定状态"),
12 | TODO(0, "待处理"),
13 | IGNORED(1, "无需告警"),
14 | SUCCESS(2, "告警成功"),
15 | FAILED(3, "告警失败");
16 |
17 | override fun code() = code
18 | override fun description() = label
19 |
20 | companion object {
21 | /**
22 | * 根据[code]查找对应的枚举类型
23 | */
24 | fun ofCode(code: Int): AlarmStatusEnum? {
25 | return values().find { it.code == code }
26 | }
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-schedule/devops-schedule-common/src/main/kotlin/com/tencent/devops/schedule/enums/DiscoveryTypeEnum.kt:
--------------------------------------------------------------------------------
1 | package com.tencent.devops.schedule.enums
2 |
3 | /**
4 | * 地址发现策略
5 | */
6 | enum class DiscoveryTypeEnum(
7 | private val code: Int,
8 | private val label: String
9 | ): DictItem {
10 |
11 | /**
12 | * 默认策略
13 | */
14 | CLOUD(1, "自动发现(SpringCloud)"),
15 | AUTO(2, "自动注册"),
16 | MANUAL(3, "手动注册");
17 |
18 | override fun code() = code
19 | override fun description() = label
20 |
21 | companion object {
22 | /**
23 | * 根据[code]查找对应的枚举类型
24 | */
25 | fun ofCode(code: Int): DiscoveryTypeEnum? {
26 | return values().find { it.code == code }
27 | }
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-schedule/devops-schedule-model/src/main/kotlin/com/tencent/devops/schedule/provider/LockProvider.kt:
--------------------------------------------------------------------------------
1 | package com.tencent.devops.schedule.provider
2 |
3 | /**
4 | * Worker Provider
5 | */
6 | interface LockProvider {
7 |
8 | /**
9 | * 尝试获取锁
10 | * @param key 锁名称
11 | * @param expiration 过期时间
12 | */
13 | fun acquire(key: String, expiration: Long): String?
14 |
15 | /**
16 | * 释放锁
17 | * @param key 锁名称
18 | * @param token 锁token
19 | */
20 | fun release(key: String, token: String): Boolean
21 |
22 | /**
23 | * 刷新锁时间
24 | * @param key 锁名称
25 | * @param token 锁token
26 | * @param expiration 过期时间
27 | */
28 | fun refresh(key: String, token: String, expiration: Long): Boolean
29 | }
30 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-schedule/devops-schedule-server/src/main/resources/frontend/src/api/group.js:
--------------------------------------------------------------------------------
1 | import request from '@/utils/request'
2 |
3 | export const listNames = () => request({
4 | url: '/worker/group/names',
5 | method: 'get'
6 | })
7 |
8 | export const list = (data) => request({
9 | url: '/worker/group/list',
10 | method: 'get',
11 | params: data
12 | })
13 |
14 | export const create = (data) => request({
15 | url: '/worker/group/create',
16 | method: 'post',
17 | data: data
18 | })
19 |
20 | export const update = (id, data) => request({
21 | url: '/worker/group/update',
22 | method: 'post',
23 | data: data
24 | })
25 |
26 | export const del = (id) => request({
27 | url: '/worker/group//delete',
28 | method: 'delete',
29 | params: { id }
30 | })
31 |
--------------------------------------------------------------------------------
/devops-boot-sample/webflux-sample/biz-webflux-sample/src/main/kotlin/com/tencent/devops/sample/controller/SampleController.kt:
--------------------------------------------------------------------------------
1 | package com.tencent.devops.sample.controller
2 |
3 | import com.tencent.devops.api.pojo.Response
4 | import com.tencent.devops.sample.client.SampleClient
5 | import com.tencent.devops.sample.pojo.Sample
6 | import org.springframework.web.bind.annotation.RestController
7 | import java.util.UUID
8 |
9 | /**
10 | * Sample Controller
11 | */
12 | @RestController
13 | class SampleController : SampleClient {
14 |
15 | override fun getSample(): Response {
16 | val sample = Sample(
17 | id = System.currentTimeMillis(),
18 | name = UUID.randomUUID().toString().replace("-", ""),
19 | )
20 | return Response.success(sample)
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-schedule/devops-schedule-common/src/main/kotlin/com/tencent/devops/schedule/enums/MisfireStrategyEnum.kt:
--------------------------------------------------------------------------------
1 | package com.tencent.devops.schedule.enums
2 |
3 | /**
4 | * 过期处理策略
5 | */
6 | enum class MisfireStrategyEnum(
7 | private val code: Int,
8 | private val label: String
9 | ): DictItem {
10 |
11 | /**
12 | * 忽略
13 | */
14 | IGNORE(1, "忽略"),
15 |
16 | /**
17 | * 立即补偿执行一次
18 | */
19 | RETRY(2, "补偿执行");
20 |
21 | override fun code() = code
22 | override fun description() = label
23 |
24 | companion object {
25 | /**
26 | * 根据[code]查找对应的枚举类型
27 | */
28 | fun ofCode(code: Int): MisfireStrategyEnum? {
29 | return values().find { it.code == code }
30 | }
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-schedule/devops-schedule-model-mongodb/src/main/kotlin/com/tencent/devops/schedule/mongo/model/TWorkerGroup.kt:
--------------------------------------------------------------------------------
1 | package com.tencent.devops.schedule.mongo.model
2 |
3 | import org.springframework.data.mongodb.core.mapping.Document
4 | import java.time.LocalDateTime
5 |
6 | /**
7 | * worker group
8 | * job工作组,对应一组执行器列表
9 | */
10 | @Document(collection = "worker_group")
11 | data class TWorkerGroup(
12 |
13 | var id: String? = null,
14 |
15 | /**
16 | * 工作组名称,全局唯一
17 | */
18 | var name: String,
19 |
20 | /**
21 | * 地址发现策略
22 | */
23 | var discoveryType: Int,
24 |
25 | /**
26 | * 状态更新时间
27 | */
28 | var updateTime: LocalDateTime,
29 |
30 | /**
31 | * 执行器地址列表
32 | */
33 | var addressList: String
34 | )
35 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-tools/devops-boot-gradle-plugin/src/main/kotlin/com/tencent/devops/conventions/JUnitConvention.kt:
--------------------------------------------------------------------------------
1 | package com.tencent.devops.conventions
2 |
3 | import org.gradle.api.Project
4 | import org.gradle.api.tasks.testing.Test
5 |
6 | /**
7 | * JUnit 相关配置
8 | */
9 | class JUnitConvention {
10 |
11 | /**
12 | * 配置test任务选项
13 | */
14 | fun apply(project: Project) {
15 | with(project) {
16 | tasks.withType(Test::class.java) { it.useJUnitPlatform() }
17 | dependencies.add(TEST_IMPLEMENTATION, TEST_DEPENDENCY)
18 | }
19 | }
20 |
21 | companion object {
22 | private const val TEST_IMPLEMENTATION = "testImplementation"
23 | private const val TEST_DEPENDENCY = "org.springframework.boot:spring-boot-starter-test"
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-tools/devops-publish-gradle-plugin/build.gradle.kts:
--------------------------------------------------------------------------------
1 | plugins {
2 | id("java-gradle-plugin")
3 | }
4 |
5 | description = "DevOps Publish Gradle Plugin"
6 |
7 | dependencies {
8 | implementation(project(":devops-boot-project:devops-boot-tools:devops-gradle-plugin-common"))
9 | implementation(Libs.KotlinGradlePlugin)
10 | implementation(Libs.DependencyManagement)
11 | implementation(Libs.GradleNexuxPublishPlugin)
12 | }
13 |
14 | gradlePlugin {
15 | plugins {
16 | create("DevOpsPublishPlugin") {
17 | id = "com.tencent.devops.publish"
18 | displayName = "DevOps Publish Gradle Plugin"
19 | description = "DevOps Publish Gradle Plugin"
20 | implementationClass = "com.tencent.devops.DevOpsPublishPlugin"
21 | }
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-schedule/devops-schedule-server/src/main/resources/frontend/src/store/modules/settings.js:
--------------------------------------------------------------------------------
1 | import defaultSettings from '@/settings'
2 |
3 | const { showSettings, fixedHeader, sidebarLogo } = defaultSettings
4 |
5 | const state = {
6 | showSettings: showSettings,
7 | fixedHeader: fixedHeader,
8 | sidebarLogo: sidebarLogo
9 | }
10 |
11 | const mutations = {
12 | CHANGE_SETTING: (state, { key, value }) => {
13 | // eslint-disable-next-line no-prototype-builtins
14 | if (state.hasOwnProperty(key)) {
15 | state[key] = value
16 | }
17 | }
18 | }
19 |
20 | const actions = {
21 | changeSetting({ commit }, data) {
22 | commit('CHANGE_SETTING', data)
23 | }
24 | }
25 |
26 | export default {
27 | namespaced: true,
28 | state,
29 | mutations,
30 | actions
31 | }
32 |
33 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-schedule/devops-schedule-server/src/main/resources/frontend/src/styles/variables.scss:
--------------------------------------------------------------------------------
1 | // sidebar
2 | $menuText:#bfcbd9;
3 | $menuActiveText:#409EFF;
4 | $subMenuActiveText:#f4f4f5; //https://github.com/ElemeFE/element/issues/12951
5 |
6 | $menuBg:#304156;
7 | $menuHover:#263445;
8 |
9 | $subMenuBg:#1f2d3d;
10 | $subMenuHover:#001528;
11 |
12 | $sideBarWidth: 210px;
13 |
14 | // the :export directive is the magic sauce for webpack
15 | // https://www.bluematador.com/blog/how-to-share-variables-between-js-and-sass
16 | :export {
17 | menuText: $menuText;
18 | menuActiveText: $menuActiveText;
19 | subMenuActiveText: $subMenuActiveText;
20 | menuBg: $menuBg;
21 | menuHover: $menuHover;
22 | subMenuBg: $subMenuBg;
23 | subMenuHover: $subMenuHover;
24 | sideBarWidth: $sideBarWidth;
25 | }
26 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-plugin/devops-plugin-core/src/main/kotlin/com/tencent/devops/plugin/core/PluginClassLoader.kt:
--------------------------------------------------------------------------------
1 | package com.tencent.devops.plugin.core
2 |
3 | import java.net.URLClassLoader
4 | import java.nio.file.Path
5 |
6 | /**
7 | * 插件classloader
8 | * 每个插件对应一个单独的classloader
9 | */
10 | class PluginClassLoader(
11 | pluginPath: Path,
12 | parentLoader: ClassLoader
13 | ) : URLClassLoader(arrayOf(pluginPath.toUri().toURL()), parentLoader) {
14 | override fun loadClass(name: String?): Class<*> {
15 | return super.loadClass(name)
16 | }
17 |
18 | override fun findClass(name: String?): Class<*> {
19 | return super.findClass(name)
20 | }
21 |
22 | override fun loadClass(name: String?, resolve: Boolean): Class<*> {
23 | return super.loadClass(name, resolve)
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-schedule/devops-schedule-common/src/main/kotlin/com/tencent/devops/schedule/enums/RouteStrategyEnum.kt:
--------------------------------------------------------------------------------
1 | package com.tencent.devops.schedule.enums
2 |
3 | /**
4 | * 路由策略
5 | */
6 | enum class RouteStrategyEnum(
7 | private val code: Int,
8 | private val label: String
9 | ): DictItem {
10 |
11 | /**
12 | * 默认策略
13 | */
14 | RANDOM(1, "随机"),
15 | ROUND(2, "轮训"),
16 | CONSISTENT(3, "一致性hash"),
17 | LEAST_JOB(4,"最少任务数"),
18 | SHARDING_BROADCAST(10, "分片广播");
19 |
20 | override fun code() = code
21 | override fun description() = label
22 |
23 | companion object {
24 | /**
25 | * 根据[code]查找对应的枚举类型
26 | */
27 | fun ofCode(code: Int): RouteStrategyEnum? {
28 | return values().find { it.code == code }
29 | }
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-schedule/devops-schedule-worker/src/main/kotlin/com/tencent/devops/schedule/k8s/K8sExtensions.kt:
--------------------------------------------------------------------------------
1 | package com.tencent.devops.schedule.k8s
2 |
3 | import io.kubernetes.client.openapi.ApiException
4 | import io.kubernetes.client.openapi.apis.CoreV1Api
5 | import org.springframework.http.HttpStatus
6 |
7 | fun ApiException.buildMessage(): String {
8 | val builder = StringBuilder().append(code)
9 | .appendLine("[$message]")
10 | .appendLine(responseHeaders)
11 | .appendLine(responseBody)
12 | return builder.toString()
13 | }
14 |
15 | fun CoreV1Api.exec(block: () -> T?): T? {
16 | try {
17 | return block()
18 | } catch (e: ApiException) {
19 | if (e.code == HttpStatus.NOT_FOUND.value()) {
20 | return null
21 | }
22 | throw e
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-tools/devops-release-gradle-plugin/build.gradle.kts:
--------------------------------------------------------------------------------
1 | plugins {
2 | id("java-gradle-plugin")
3 | }
4 |
5 | description = "DevOps Publish Gradle Plugin"
6 |
7 | dependencies {
8 | implementation(project(":devops-boot-project:devops-boot-tools:devops-gradle-plugin-common"))
9 | implementation("org.semver:api:0.9.33")
10 | implementation("org.apache.maven.scm:maven-scm-api:2.0.1")
11 | implementation("org.apache.maven.scm:maven-scm-provider-gitexe:2.0.1")
12 | }
13 |
14 | gradlePlugin {
15 | plugins {
16 | create("DevOpsReleasePlugin") {
17 | id = "com.tencent.devops.release"
18 | displayName = "DevOps Release Gradle Plugin"
19 | description = "DevOps Release Gradle Plugin"
20 | implementationClass = "com.tencent.devops.DevOpsReleasePlugin"
21 | }
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-schedule/devops-schedule-server/src/main/resources/frontend/src/layout/components/Sidebar/FixiOSBug.js:
--------------------------------------------------------------------------------
1 | export default {
2 | computed: {
3 | device() {
4 | return this.$store.state.app.device
5 | }
6 | },
7 | mounted() {
8 | // In order to fix the click on menu on the ios device will trigger the mouseleave bug
9 | // https://github.com/PanJiaChen/vue-element-admin/issues/1135
10 | this.fixBugIniOS()
11 | },
12 | methods: {
13 | fixBugIniOS() {
14 | const $subMenu = this.$refs.subMenu
15 | if ($subMenu) {
16 | const handleMouseleave = $subMenu.handleMouseleave
17 | $subMenu.handleMouseleave = (e) => {
18 | if (this.device === 'mobile') {
19 | return
20 | }
21 | handleMouseleave(e)
22 | }
23 | }
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/docs/quick-start.md:
--------------------------------------------------------------------------------
1 | # 快速开始
2 |
3 | - **gradle.build.kts**
4 | ```kotlin
5 | // 添加devops-boot gradle插件
6 | plugins {
7 | id("com.tencent.devops.boot") version ${version}
8 | }
9 |
10 | dependencies {
11 | // 添加需要的starter组件
12 | implementation("com.tencent.devops:devops-boot-starter-web")
13 | }
14 | ```
15 |
16 | - 编写启动类**TestApplication.kt**
17 | ```kotlin
18 | @RestController
19 | @SpringBootApplication
20 | class TestApplication {
21 |
22 | @GetMapping
23 | fun greeting(): String = "Hello, Devops-Boot!"
24 | }
25 |
26 | fun main(args: Array) {
27 | runApplication(args)
28 | }
29 | ```
30 |
31 | - 启动,Enjoy it!
32 |
33 |
34 | ?> 如上,我们只添加了`devops-boot-gradle`插件,就能进行SringBoot甚至SpringCloud应用的开发了,无需额外操作,自动为我们配置好`jdk`版本、编译选项、依赖管理、`kotlin`依赖及`kotlin-spring`插件等繁琐的配置项。
35 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-logging/src/main/kotlin/com/tencent/devops/logging/system/java/DevopsJavaSystemProperties.kt:
--------------------------------------------------------------------------------
1 | package com.tencent.devops.logging.system.java
2 |
3 | import com.tencent.devops.logging.system.common.ICommonLoggingProperties
4 | import org.springframework.boot.logging.LogFile
5 | import org.springframework.boot.logging.LoggingSystemProperties
6 | import org.springframework.core.env.Environment
7 | import org.springframework.core.env.PropertyResolver
8 |
9 | /**
10 | * devops-framework的java系统变量
11 | */
12 | class DevopsJavaSystemProperties(environment: Environment) :
13 | LoggingSystemProperties(environment), ICommonLoggingProperties {
14 |
15 | override fun apply(logFile: LogFile?, resolver: PropertyResolver) {
16 | super.apply(logFile, resolver)
17 | applyDevopsProperties(resolver) { name, value -> setSystemProperty(name, value) }
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-schedule/devops-schedule-server/src/main/kotlin/com/tencent/devops/schedule/scheduler/event/JobTriggerEvent.kt:
--------------------------------------------------------------------------------
1 | package com.tencent.devops.schedule.scheduler.event
2 |
3 | import java.time.Duration
4 |
5 | /**
6 | * 任务触发事件
7 | * */
8 | class JobTriggerEvent(
9 | /**
10 | * 触发耗时
11 | * */
12 | val duration: Duration,
13 | /**
14 | * 触发的任务延迟
15 | * */
16 | val latency: Duration,
17 | jobId: String,
18 | ) : JobEvent(jobId) {
19 | companion object {
20 | fun create(jobId: String, triggerStartTime: Long, triggerEndTime: Long, triggerTime: Long): JobTriggerEvent {
21 | return JobTriggerEvent(
22 | Duration.ofMillis(triggerEndTime - triggerStartTime),
23 | Duration.ofMillis(triggerEndTime - triggerTime),
24 | jobId,
25 | )
26 | }
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-schedule/devops-schedule-worker/src/main/kotlin/com/tencent/devops/schedule/config/ScheduleWorkerWebConfiguration.kt:
--------------------------------------------------------------------------------
1 | package com.tencent.devops.schedule.config
2 |
3 | import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication
4 | import org.springframework.context.annotation.Bean
5 | import org.springframework.context.annotation.ComponentScan
6 | import org.springframework.context.annotation.Configuration
7 |
8 | @Configuration(proxyBeanMethods = false)
9 | @ConditionalOnWebApplication
10 | @ComponentScan("com.tencent.devops.schedule.web")
11 | class ScheduleWorkerWebConfiguration {
12 |
13 | @Bean
14 | fun scheduleServerAuthConfigurer(
15 | scheduleWorkerProperties: ScheduleWorkerProperties
16 | ): ScheduleWorkerWebAuthConfigurer {
17 | return ScheduleWorkerWebAuthConfigurer(scheduleWorkerProperties)
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-logging/src/main/kotlin/com/tencent/devops/logging/system/log4j/DevopsLog4J2SystemProperties.kt:
--------------------------------------------------------------------------------
1 | package com.tencent.devops.logging.system.log4j
2 |
3 | import com.tencent.devops.logging.system.common.ICommonLoggingProperties
4 | import org.springframework.boot.logging.LogFile
5 | import org.springframework.boot.logging.LoggingSystemProperties
6 | import org.springframework.core.env.Environment
7 | import org.springframework.core.env.PropertyResolver
8 |
9 | /**
10 | * devops-framework的log4j2系统变量
11 | */
12 | class DevopsLog4J2SystemProperties(environment: Environment) :
13 | LoggingSystemProperties(environment), ICommonLoggingProperties {
14 |
15 | override fun apply(logFile: LogFile?, resolver: PropertyResolver) {
16 | super.apply(logFile, resolver)
17 | applyDevopsProperties(resolver) { name, value -> setSystemProperty(name, value) }
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-schedule/devops-schedule-server/src/main/resources/frontend/src/icons/svg/nested.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-web/src/main/kotlin/com/tencent/devops/web/WebAutoConfiguration.kt:
--------------------------------------------------------------------------------
1 | package com.tencent.devops.web
2 |
3 | import com.tencent.devops.web.banner.DevOpsBannerInitializer
4 | import com.tencent.devops.web.jackson.JacksonConfiguration
5 | import com.tencent.devops.web.swagger.SwaggerConfiguration
6 | import com.tencent.devops.web.util.SpringContextHolder
7 | import org.springframework.context.annotation.Configuration
8 | import org.springframework.context.annotation.Import
9 | import org.springframework.context.annotation.PropertySource
10 |
11 | /**
12 | * Service自动化配置类
13 | */
14 | @Configuration(proxyBeanMethods = false)
15 | @PropertySource("classpath:common-web.properties")
16 | @Import(
17 | SpringContextHolder::class,
18 | JacksonConfiguration::class,
19 | SwaggerConfiguration::class,
20 | DevOpsBannerInitializer::class
21 | )
22 | class WebAutoConfiguration
23 |
--------------------------------------------------------------------------------
/devops-boot-sample/webflux-sample/biz-webflux-sample/src/main/kotlin/com/tencent/devops/sample/filter/LogWebFilter.kt:
--------------------------------------------------------------------------------
1 | package com.tencent.devops.sample.filter
2 |
3 | import com.tencent.devops.webflux.filter.CoWebFilter
4 | import com.tencent.devops.webflux.filterAndAwait
5 | import org.slf4j.LoggerFactory
6 | import org.springframework.web.server.ServerWebExchange
7 | import org.springframework.web.server.WebFilterChain
8 |
9 | class LogWebFilter : CoWebFilter {
10 | override suspend fun doFilter(exchange: ServerWebExchange, chain: WebFilterChain) {
11 | val requestPath = exchange.request.uri.path
12 | logger.info("Request $requestPath in web filter.")
13 | chain.filterAndAwait(exchange)
14 | logger.info("Request $requestPath out web filter.")
15 | }
16 |
17 | companion object {
18 | private val logger = LoggerFactory.getLogger(LogWebFilter::class.java)
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/devops-boot-sample/webflux-sample/biz-webflux-sample/src/main/kotlin/com/tencent/devops/sample/handler/SampleHandler.kt:
--------------------------------------------------------------------------------
1 | package com.tencent.devops.sample.handler
2 |
3 | import com.tencent.devops.api.pojo.Response
4 | import com.tencent.devops.sample.pojo.Sample
5 | import org.springframework.web.reactive.function.server.ServerRequest
6 | import org.springframework.web.reactive.function.server.ServerResponse
7 | import org.springframework.web.reactive.function.server.ServerResponse.ok
8 | import org.springframework.web.reactive.function.server.bodyValueAndAwait
9 |
10 | class SampleHandler {
11 | suspend fun getSample(request: ServerRequest): ServerResponse {
12 | val name = request.pathVariable("name")
13 | val sample = Sample(
14 | id = System.currentTimeMillis(),
15 | name = name,
16 | )
17 | return ok().bodyValueAndAwait(Response.success(sample))
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/docs/dependency/devops-boot-dependencies.md:
--------------------------------------------------------------------------------
1 | # devops-boot-dependencies
2 |
3 | ## 功能介绍
4 |
5 | `devops-boot-dependencies`用于提供统一的版本依赖管理能力,在`Spring Boot`以及`Spring Cloud`的`bom`基础上,添加了`devops-boot`的版本管理。
6 |
7 |
8 | ## 使用方式
9 | ### 1. 配合devops-boot插件使用(推荐)
10 | 当项目引入了`devops-boot-gradle-plugin`插件,会自动配置`devops-boot-dependencies`,无需其它额外配置
11 |
12 | ### 2. 独立使用
13 |
14 | - **build.gradle.kts**
15 |
16 | ```kotlin
17 | dependencyManagement {
18 | imports {
19 | mavenBom("com.tencent.devops:devops-boot-dependencies:${version}")
20 | }
21 | }
22 | ```
23 |
24 | - **build.gradle**
25 |
26 | ```groovy
27 | dependencyManagement {
28 | imports {
29 | mavenBom 'com.tencent.devops:devops-boot-dependencies:${version}'
30 | }
31 | }
32 | ```
33 |
34 | ## 参考
35 | 关于依赖管理的使用详情,请参考官方文档[dependency-management](https://docs.spring.io/dependency-management-plugin/docs/current/reference/html/)
36 |
37 |
38 |
39 |
--------------------------------------------------------------------------------
/devops-boot-sample/api-kotlin-sample/src/main/kotlin/com/tencent/devops/sample/client/SampleClient.kt:
--------------------------------------------------------------------------------
1 | package com.tencent.devops.sample.client
2 |
3 | import com.tencent.devops.api.pojo.Response
4 | import com.tencent.devops.sample.pojo.Sample
5 | import io.swagger.v3.oas.annotations.Operation
6 | import io.swagger.v3.oas.annotations.tags.Tag
7 | import org.springframework.cloud.openfeign.FeignClient
8 | import org.springframework.context.annotation.Primary
9 | import org.springframework.web.bind.annotation.GetMapping
10 | import org.springframework.web.bind.annotation.RequestMapping
11 |
12 | /**
13 | * Sample FeignClient
14 | */
15 | @Tag(name = "Sample 服务接口")
16 | @Primary
17 | @FeignClient("devops-kotlin-sample", contextId = "SampleClient")
18 | @RequestMapping("/service/sample")
19 | interface SampleClient {
20 |
21 | @Operation(description = "获取Sample")
22 | @GetMapping
23 | fun getSample(): Response
24 | }
25 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-schedule/devops-schedule-server/src/main/resources/frontend/src/layout/components/AppMain.vue:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
9 |
19 |
20 |
32 |
33 |
41 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-logging/src/main/kotlin/com/tencent/devops/logging/system/logback/DevopsLogbackSystemProperties.kt:
--------------------------------------------------------------------------------
1 | package com.tencent.devops.logging.system.logback
2 |
3 | import com.tencent.devops.logging.system.common.ICommonLoggingProperties
4 | import org.springframework.boot.logging.LogFile
5 | import org.springframework.boot.logging.logback.LogbackLoggingSystemProperties
6 | import org.springframework.core.env.Environment
7 | import org.springframework.core.env.PropertyResolver
8 |
9 | /**
10 | * devops-framework的logback系统变量
11 | */
12 | class DevopsLogbackSystemProperties(environment: Environment) :
13 | LogbackLoggingSystemProperties(environment), ICommonLoggingProperties {
14 |
15 | override fun apply(logFile: LogFile?, resolver: PropertyResolver) {
16 | super.apply(logFile, resolver)
17 | applyDevopsProperties(resolver) { name, value -> setSystemProperty(name, value) }
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/devops-boot-sample/webflux-sample/api-webflux-sample/src/main/kotlin/com/tencent/devops/sample/client/SampleClient.kt:
--------------------------------------------------------------------------------
1 | package com.tencent.devops.sample.client
2 |
3 | import com.tencent.devops.api.pojo.Response
4 | import com.tencent.devops.sample.pojo.Sample
5 | import io.swagger.v3.oas.annotations.Operation
6 | import io.swagger.v3.oas.annotations.tags.Tag
7 | import org.springframework.cloud.openfeign.FeignClient
8 | import org.springframework.context.annotation.Primary
9 | import org.springframework.web.bind.annotation.GetMapping
10 | import org.springframework.web.bind.annotation.RequestMapping
11 |
12 | /**
13 | * Sample FeignClient
14 | */
15 | @Tag(name = "Sample 服务接口")
16 | @Primary
17 | @FeignClient("devops-kotlin-sample", contextId = "SampleClient")
18 | @RequestMapping("/service/sample")
19 | interface SampleClient {
20 |
21 | @Operation(description = "获取Sample")
22 | @GetMapping
23 | fun getSample(): Response
24 | }
25 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-loadbalancer/src/main/kotlin/com/tencent/devops/loadbalancer/LoadBalancerAutoConfiguration.kt:
--------------------------------------------------------------------------------
1 | package com.tencent.devops.loadbalancer
2 |
3 | import com.tencent.devops.loadbalancer.config.DevOpsLoadBalancerProperties
4 | import com.tencent.devops.loadbalancer.gray.GrayLoadBalancerConfiguration
5 | import org.springframework.boot.context.properties.EnableConfigurationProperties
6 | import org.springframework.cloud.client.ConditionalOnDiscoveryEnabled
7 | import org.springframework.cloud.loadbalancer.annotation.LoadBalancerClients
8 | import org.springframework.context.annotation.Configuration
9 |
10 | /**
11 | * 客户端负载均衡自动配置类
12 | */
13 | @Configuration(proxyBeanMethods = false)
14 | @ConditionalOnDiscoveryEnabled
15 | @EnableConfigurationProperties(DevOpsLoadBalancerProperties::class)
16 | @LoadBalancerClients(defaultConfiguration = [GrayLoadBalancerConfiguration::class])
17 | class LoadBalancerAutoConfiguration
18 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-schedule/devops-schedule-worker/src/main/kotlin/com/tencent/devops/schedule/k8s/K8sHelper.kt:
--------------------------------------------------------------------------------
1 | package com.tencent.devops.schedule.k8s
2 |
3 | import io.kubernetes.client.openapi.ApiClient
4 | import io.kubernetes.client.util.ClientBuilder
5 | import io.kubernetes.client.util.Config
6 | import io.kubernetes.client.util.credentials.AccessTokenAuthentication
7 |
8 | /**
9 | * k8s工具类
10 | * */
11 | object K8sHelper {
12 | /**
13 | * 根据k8s属性,创建client,如果没有配置,默认使用本地client
14 | * */
15 | fun createClient(k8sProps: K8sProperties): ApiClient {
16 | return if (k8sProps.token != null && k8sProps.apiServer != null) {
17 | ClientBuilder()
18 | .setBasePath(k8sProps.apiServer)
19 | .setAuthentication(AccessTokenAuthentication(k8sProps.token))
20 | .build()
21 | } else {
22 | Config.defaultClient()
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/devops-boot-sample/webflux-sample/biz-webflux-sample/src/main/kotlin/com/tencent/devops/sample/controller/TestController.kt:
--------------------------------------------------------------------------------
1 | package com.tencent.devops.sample.controller
2 |
3 | import com.tencent.devops.api.pojo.Response
4 | import com.tencent.devops.sample.client.SampleClient
5 | import com.tencent.devops.sample.config.GreetingProperties
6 | import com.tencent.devops.sample.pojo.Sample
7 | import org.springframework.web.bind.annotation.GetMapping
8 | import org.springframework.web.bind.annotation.RestController
9 |
10 | /**
11 | * Test Controller
12 | */
13 | @RestController
14 | class TestController(
15 | private val sampleClient: SampleClient,
16 | private val greetingProperties: GreetingProperties,
17 | ) {
18 |
19 | @GetMapping("/test")
20 | fun test(): Response {
21 | return sampleClient.getSample()
22 | }
23 |
24 | @GetMapping("/greeting")
25 | fun greeting() = "Hello, ${greetingProperties.message}"
26 | }
27 |
--------------------------------------------------------------------------------
/devops-boot-sample/webflux-sample/biz-webflux-sample/src/main/kotlin/com/tencent/devops/sample/filter/SampleHandlerFilterFunction.kt:
--------------------------------------------------------------------------------
1 | package com.tencent.devops.sample.filter
2 |
3 | import com.tencent.devops.webflux.filter.CoHandlerFilterFunction
4 | import org.springframework.http.HttpStatus
5 | import org.springframework.web.reactive.function.server.ServerRequest
6 | import org.springframework.web.reactive.function.server.ServerResponse
7 | import org.springframework.web.reactive.function.server.buildAndAwait
8 |
9 | class SampleHandlerFilterFunction : CoHandlerFilterFunction {
10 | override suspend fun filter(
11 | request: ServerRequest,
12 | next: suspend (ServerRequest) -> ServerResponse,
13 | ): ServerResponse {
14 | if (request.pathVariable("name").equals("devops", true)) {
15 | return ServerResponse.status(HttpStatus.FORBIDDEN).buildAndAwait()
16 | }
17 | return next(request)
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-web/src/main/kotlin/com/tencent/devops/web/jackson/JacksonConfiguration.kt:
--------------------------------------------------------------------------------
1 | package com.tencent.devops.web.jackson
2 |
3 | import com.tencent.devops.utils.jackson.JsonUtils
4 | import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean
5 | import org.springframework.context.annotation.Bean
6 | import org.springframework.context.annotation.Configuration
7 | import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter
8 |
9 | /**
10 | * Jackson 配置类
11 | */
12 | @Configuration(proxyBeanMethods = false)
13 | class JacksonConfiguration {
14 |
15 | @Bean
16 | @ConditionalOnMissingBean
17 | fun objectMapper() = JsonUtils.objectMapper
18 |
19 | @Bean
20 | @ConditionalOnMissingBean
21 | fun mappingJackson2HttpMessageConverter(): MappingJackson2HttpMessageConverter {
22 | return MappingJackson2HttpMessageConverter(JsonUtils.objectMapper)
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-schedule/devops-schedule-model/src/main/kotlin/com/tencent/devops/schedule/utils/Conventions.kt:
--------------------------------------------------------------------------------
1 | package com.tencent.devops.schedule.utils
2 |
3 | import com.tencent.devops.schedule.pojo.page.BasePageRequest
4 | import org.springframework.data.domain.Page
5 | import org.springframework.data.domain.PageRequest
6 | import org.springframework.data.domain.Pageable
7 |
8 | fun Page.toPage(): com.tencent.devops.schedule.pojo.page.Page {
9 | return com.tencent.devops.schedule.pojo.page.Page(
10 | pageNumber = number,
11 | pageSize = size,
12 | totalRecords = totalElements,
13 | totalPages = totalPages.toLong(),
14 | records = content
15 | )
16 | }
17 |
18 | fun BasePageRequest.ofPageable(): Pageable {
19 | val number = if (pageNumber <= 0) 1 else pageNumber
20 | val size = if (pageSize <= 0) 20 else pageSize
21 | return PageRequest.of(number - 1, size)
22 | }
23 |
24 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-schedule/devops-schedule-common/src/main/kotlin/com/tencent/devops/schedule/constants/JobConstants.kt:
--------------------------------------------------------------------------------
1 | package com.tencent.devops.schedule.constants
2 |
3 | import java.time.format.DateTimeFormatter
4 |
5 | /**
6 | * 时间格式
7 | */
8 | const val DATE_TIME_PATTERN = "yyyy-MM-dd HH:mm:ss"
9 |
10 | /**
11 | * 时间格式类
12 | */
13 | val DATE_TIME_FORMATTER: DateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")
14 |
15 | /**
16 | * 任务日志message最大长度
17 | */
18 | const val MAX_LOG_MESSAGE_SIZE = 8192
19 |
20 | /**
21 | * 加载job时锁名称
22 | */
23 | const val JOB_LOAD_LOCK_KEY = "JOB-LOAD-KEY"
24 |
25 | /**
26 | * 预加载时间,ms
27 | */
28 | const val PRE_LOAD_TIME = 5 * 1000L
29 |
30 | /**
31 | * worker状态刷新间隔
32 | */
33 | const val WORKER_BEAT_PERIOD = 30
34 |
35 | /**
36 | * auth header
37 | */
38 | const val SCHEDULE_RPC_AUTH_HEADER = "X-SCHEDULE-RPC-TOKEN"
39 | const val SCHEDULE_API_AUTH_HEADER = "X-SCHEDULE-API-TOKEN"
40 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-tools/devops-boot-gradle-plugin/src/main/kotlin/com/tencent/devops/conventions/JavaConvention.kt:
--------------------------------------------------------------------------------
1 | package com.tencent.devops.conventions
2 |
3 | import com.tencent.devops.utils.findJavaVersion
4 | import org.gradle.api.Project
5 | import org.gradle.api.plugins.JavaPlugin
6 | import org.gradle.api.tasks.compile.JavaCompile
7 | import java.nio.charset.StandardCharsets.UTF_8
8 |
9 | /**
10 | * java相关配置
11 | * - 添加Java插件
12 | * - 配置默认编译选项
13 | */
14 | class JavaConvention {
15 |
16 | fun apply(project: Project) {
17 | with(project) {
18 | pluginManager.apply(JavaPlugin::class.java)
19 | tasks.withType(JavaCompile::class.java) {
20 | val javaVersion = findJavaVersion(this)
21 | it.sourceCompatibility = javaVersion
22 | it.targetCompatibility = javaVersion
23 | it.options.encoding = UTF_8.name()
24 | }
25 | }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-schedule/devops-schedule-common/src/main/kotlin/com/tencent/devops/schedule/pojo/job/JobExecutionResult.kt:
--------------------------------------------------------------------------------
1 | package com.tencent.devops.schedule.pojo.job
2 |
3 | import com.tencent.devops.schedule.enums.ExecutionCodeEnum
4 |
5 | data class JobExecutionResult(
6 | /**
7 | * 状态码,参考[ExecutionCodeEnum]
8 | */
9 | val code: Int,
10 | /**
11 | * 备注信息(失败原因、任务说明等,用于查询和展示)
12 | */
13 | val message: String? = null
14 | ) {
15 | /**
16 | * 任务执行记录id,由系统自动填充
17 | */
18 | var logId: String? = null
19 |
20 | companion object {
21 |
22 | /**
23 | * 执行成功
24 | */
25 | fun success() = JobExecutionResult(ExecutionCodeEnum.SUCCESS.code())
26 |
27 | /**
28 | * 执行失败
29 | * @param message 备注信息(失败原因、任务说明等,用于查询和展示)
30 | */
31 | fun failed(message: String) = JobExecutionResult(ExecutionCodeEnum.FAILED.code(), message)
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-schedule/devops-schedule-server/src/main/resources/frontend/src/layout/components/Sidebar/Link.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
44 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-schedule/devops-schedule-server/src/main/kotlin/com/tencent/devops/schedule/router/WorkerRouteLeastJob.kt:
--------------------------------------------------------------------------------
1 | package com.tencent.devops.schedule.router
2 |
3 | import com.tencent.devops.schedule.enums.ExecutionCodeEnum
4 | import com.tencent.devops.schedule.manager.JobManager
5 | import com.tencent.devops.schedule.pojo.trigger.TriggerParam
6 |
7 | class WorkerRouteLeastJob(private val jobManager: JobManager) : WorkerRouter {
8 | override fun route(triggerParam: TriggerParam, addressList: List): String? {
9 | var selected: String? = null
10 | var minJobs = Int.MAX_VALUE
11 | addressList.forEach {
12 | val countByWorkerAddress = jobManager.countByWorkerAddress(ExecutionCodeEnum.RUNNING.code(), it)
13 | if (countByWorkerAddress < minJobs) {
14 | selected = it
15 | minJobs = countByWorkerAddress
16 | }
17 | }
18 | return selected
19 | }
20 | }
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-tools/devops-boot-gradle-plugin/build.gradle.kts:
--------------------------------------------------------------------------------
1 | plugins {
2 | id("java-gradle-plugin")
3 | }
4 |
5 | description = "DevOps Boot Gradle Plugin"
6 |
7 | dependencies {
8 | implementation(Libs.KotlinGradlePlugin)
9 | implementation(Libs.SpringBootGradlePlugin)
10 | implementation(Libs.DependencyManagement)
11 | implementation(Libs.KotlinSpringGradlePlugin)
12 | implementation(Libs.GoogleJibPlugin)
13 | implementation(Libs.KtLint) {
14 | // ktlint 引用了1.4.31版本,和项目引入的1.6.21有冲突
15 | exclude(group = "org.jetbrains.kotlin", module = "kotlin-stdlib-jdk8")
16 | }
17 | }
18 |
19 | gradlePlugin {
20 | plugins {
21 | create("DevOpsBootPlugin") {
22 | id = "com.tencent.devops.boot"
23 | displayName = "DevOps Boot Gradle Plugin"
24 | description = "DevOps Boot Gradle Plugin"
25 | implementationClass = "com.tencent.devops.DevOpsBootPlugin"
26 | }
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-schedule/devops-schedule-server/src/main/resources/frontend/src/layout/components/Sidebar/Item.vue:
--------------------------------------------------------------------------------
1 |
34 |
35 |
42 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-schedule/devops-schedule-common/src/main/kotlin/com/tencent/devops/schedule/enums/ScheduleTypeEnum.kt:
--------------------------------------------------------------------------------
1 | package com.tencent.devops.schedule.enums
2 |
3 | /**
4 | * 调度类型
5 | */
6 | enum class ScheduleTypeEnum(
7 | private val code: Int,
8 | private val label: String,
9 | ) : DictItem {
10 | /**
11 | * 立即执行,调度器不会进行调度,需要主动触发才会执行
12 | */
13 | IMMEDIATELY(1, "立即执行"),
14 |
15 | /**
16 | * 固定时间
17 | */
18 | FIX_TIME(2, "固定时间"),
19 |
20 | /**
21 | * 固定速率
22 | */
23 | FIX_RATE(3, "固定速率"),
24 |
25 | /**
26 | * cron表达式
27 | */
28 | CRON(4, "Cron表达式"),
29 | ;
30 |
31 | override fun code() = code
32 | override fun description() = label
33 |
34 | companion object {
35 | /**
36 | * 根据[code]查找对应的枚举类型
37 | */
38 | fun ofCode(code: Int): ScheduleTypeEnum? {
39 | return values().find { it.code == code }
40 | }
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/devops-boot-sample/webflux-sample/biz-webflux-sample/src/main/kotlin/com/tencent/devops/sample/config/BeanConfiguration.kt:
--------------------------------------------------------------------------------
1 | package com.tencent.devops.sample.config
2 |
3 | import com.tencent.devops.sample.filter.LogWebFilter
4 | import com.tencent.devops.sample.filter.SampleHandlerFilterFunction
5 | import com.tencent.devops.sample.handler.SampleHandler
6 | import org.springframework.context.ApplicationContextInitializer
7 | import org.springframework.context.support.GenericApplicationContext
8 | import org.springframework.context.support.beans
9 |
10 | val beans = beans {
11 | bean()
12 | bean()
13 | bean()
14 | bean {
15 | RouteConfiguration(ref(), ref()).router()
16 | }
17 | }
18 |
19 | class BeansInitializer : ApplicationContextInitializer {
20 | override fun initialize(applicationContext: GenericApplicationContext) {
21 | beans.initialize(applicationContext)
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-service-servlet/src/main/kotlin/com/tencent/devops/service/feign/FeignFilterRequestMappingHandlerMapping.kt:
--------------------------------------------------------------------------------
1 | package com.tencent.devops.service.feign
2 |
3 | import org.springframework.core.annotation.AnnotatedElementUtils
4 | import org.springframework.stereotype.Controller
5 | import org.springframework.web.bind.annotation.RestController
6 | import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping
7 |
8 | /**
9 | * 重写RequestMappingHandlerMapping的isHandler方法,避免声明Feign Client Api接口的RequestMapping注解
10 | * 与Feign Client Api实现类的Controller注解重复,造成HandlerMapping以及swagger重复扫描的问题
11 | */
12 | class FeignFilterRequestMappingHandlerMapping : RequestMappingHandlerMapping() {
13 |
14 | override fun isHandler(beanType: Class<*>): Boolean {
15 | return AnnotatedElementUtils.hasAnnotation(beanType, Controller::class.java) ||
16 | AnnotatedElementUtils.hasAnnotation(beanType, RestController::class.java)
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/devops-boot-sample/webflux-sample/boot-webflux-sample/src/main/kotlin/com/tencent/devops/sample/WebFluxApplication.kt:
--------------------------------------------------------------------------------
1 | package com.tencent.devops.sample
2 |
3 | import com.tencent.devops.boot.runApplication
4 | import org.slf4j.LoggerFactory
5 | import org.springframework.boot.autoconfigure.SpringBootApplication
6 | import org.springframework.scheduling.annotation.EnableScheduling
7 | import org.springframework.scheduling.annotation.Scheduled
8 |
9 | /**
10 | * 使用DevOpsBoot框架的Sample应用
11 | */
12 | @EnableScheduling
13 | @SpringBootApplication
14 | class WebFluxApplication {
15 |
16 | @Scheduled(fixedDelay = 60 * 1000L)
17 | fun schedule() {
18 | logger.debug("debug log")
19 | logger.info("info log")
20 | logger.error("error log")
21 | }
22 |
23 | companion object {
24 | private val logger = LoggerFactory.getLogger(WebFluxApplication::class.java)
25 | }
26 | }
27 |
28 | fun main(args: Array) {
29 | runApplication(args)
30 | }
31 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-schedule/devops-schedule-common/src/main/kotlin/com/tencent/devops/schedule/pojo/trigger/TriggerParam.kt:
--------------------------------------------------------------------------------
1 | package com.tencent.devops.schedule.pojo.trigger
2 |
3 | import com.fasterxml.jackson.annotation.JsonFormat
4 | import com.tencent.devops.schedule.constants.DATE_TIME_PATTERN
5 | import java.time.LocalDateTime
6 |
7 | data class TriggerParam(
8 | var jobId: String,
9 | var jobMode: Int,
10 | var source: String? = null,
11 | var image: String? = null,
12 | var jobHandler: String,
13 | var jobParam: String,
14 | var blockStrategy: Int,
15 | var jobTimeout: Int = -1,
16 | var logId: String,
17 | @JsonFormat(pattern = DATE_TIME_PATTERN)
18 | var triggerTime: LocalDateTime,
19 | @JsonFormat(pattern = DATE_TIME_PATTERN)
20 | var scheduledFireTime: LocalDateTime,
21 | var broadcastIndex: Int = 0,
22 | var broadcastTotal: Int = 0,
23 | var workerAddress: String? = null,
24 | var updateTime: LocalDateTime,
25 | )
26 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-service-reactive/src/main/kotlin/com/tencent/devops/service/feign/FeignFilterRequestMappingHandlerMapping.kt:
--------------------------------------------------------------------------------
1 | package com.tencent.devops.service.feign
2 |
3 | import org.springframework.core.annotation.AnnotatedElementUtils
4 | import org.springframework.stereotype.Controller
5 | import org.springframework.web.bind.annotation.RestController
6 | import org.springframework.web.reactive.result.method.annotation.RequestMappingHandlerMapping
7 |
8 | /**
9 | * 重写RequestMappingHandlerMapping的isHandler方法,避免声明Feign Client Api接口的RequestMapping注解
10 | * 与Feign Client Api实现类的Controller注解重复,造成HandlerMapping以及swagger重复扫描的问题
11 | */
12 | class FeignFilterRequestMappingHandlerMapping : RequestMappingHandlerMapping() {
13 |
14 | override fun isHandler(beanType: Class<*>): Boolean {
15 | return AnnotatedElementUtils.hasAnnotation(beanType, Controller::class.java) ||
16 | AnnotatedElementUtils.hasAnnotation(beanType, RestController::class.java)
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/devops-boot-sample/settings.gradle.kts:
--------------------------------------------------------------------------------
1 |
2 | rootProject.name = "devops-boot-sample"
3 |
4 |
5 | // for debug devops-boot locally
6 | @Suppress("UnstableApiUsage")
7 | pluginManagement {
8 | val projectVersion = File(rootDir.parent,"version.txt").readText().trim()
9 | plugins {
10 | id("com.tencent.devops.boot") version projectVersion
11 | }
12 | repositories {
13 | mavenLocal()
14 | mavenCentral()
15 | gradlePluginPortal()
16 | maven {
17 | setUrl("https://central.sonatype.com/repository/maven-snapshots/")
18 | }
19 | }
20 | }
21 |
22 | include("api-kotlin-sample")
23 | include("biz-kotlin-sample")
24 | include("boot-java-sample")
25 | include("boot-kotlin-sample")
26 | include("plugin-printer")
27 | include("boot-schedule-server-sample")
28 | include("boot-schedule-worker-cloud-sample")
29 | include("webflux-sample:api-webflux-sample")
30 | include("webflux-sample:biz-webflux-sample")
31 | include("webflux-sample:boot-webflux-sample")
32 |
--------------------------------------------------------------------------------
/docs/starter/devops-boot-starter-api.md:
--------------------------------------------------------------------------------
1 | # devops-boot-starter-api
2 |
3 | `starter-api`组件用于帮助开发者完成api接口的编写
4 |
5 | ## 功能介绍
6 | - 规范统一的接口协议并定义统一的`POJO`类
7 | - 自动引入`swagger`注解需要的相关jar包
8 | - 提供`HTTP`相关的常用常量和枚举类
9 |
10 | ## 使用方式
11 | - **build.gradle.kts**
12 |
13 | ```kotlin
14 | implementation("com.tencent.devops:devops-boot-starter-api")
15 | ```
16 |
17 | - **build.gradle**
18 |
19 | ```groovy
20 | implementation 'com.tencent.devops:devops-boot-starter-api'
21 | ```
22 |
23 | ## 最佳实践
24 |
25 | 项目的`api-xxx`模块包含了对外接口的声明以及数据格式的定义,最终作为二方包或者三方包提供给对外使用,因此需要开发者保持`api`模块的精简和规范,否则会引诸多问题,如:
26 | 1. 不规范的依赖声明方式导致版本依赖冲突
27 | 2. 引入过多&多余的依赖,导致模块臃肿
28 | 3. 在`api`模块中暴露敏感信息,如`DO`类
29 |
30 | `starter-api`组件秉承这一原则,帮助开发者最大化精简和规范`api`模块的开发,但开发者仍然需要注意以下事项:
31 | 1. `api`模块慎重引入依赖,如需引入请使用`implementation`或`comipleOnly`方式
32 | 2. 对于`@RequestMapping`、`@FeignClient`注解的依赖,使用`comipleOnly`的方式依赖
33 | ```kotlin
34 | compileOnly("org.springframework.cloud:spring-cloud-openfeign-core")
35 | ```
36 | 3. `api`模块保持简洁,只包含和接口声明和数据格式的定义
37 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-schedule/devops-schedule-worker/src/main/kotlin/com/tencent/devops/schedule/config/ScheduleWorkerWebAuthConfigurer.kt:
--------------------------------------------------------------------------------
1 | package com.tencent.devops.schedule.config
2 |
3 | import com.tencent.devops.schedule.api.RpcAuthWebInterceptor
4 | import com.tencent.devops.schedule.constants.WORKER_RPC_V1
5 | import org.springframework.web.servlet.config.annotation.InterceptorRegistry
6 | import org.springframework.web.servlet.config.annotation.WebMvcConfigurer
7 |
8 | /**
9 | * Schedule server api 配置
10 | */
11 | class ScheduleWorkerWebAuthConfigurer(
12 | scheduleWorkerProperties: ScheduleWorkerProperties
13 | ) : WebMvcConfigurer {
14 |
15 | private val serverProperties = scheduleWorkerProperties.server
16 |
17 | override fun addInterceptors(registry: InterceptorRegistry) {
18 | registry.addInterceptor(RpcAuthWebInterceptor(serverProperties.accessToken))
19 | .addPathPatterns("$WORKER_RPC_V1/**")
20 | super.addInterceptors(registry)
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-schedule/devops-schedule-server/src/main/resources/frontend/src/styles/element-ui.scss:
--------------------------------------------------------------------------------
1 | // cover some element-ui styles
2 |
3 | .el-breadcrumb__inner,
4 | .el-breadcrumb__inner a {
5 | font-weight: 400 !important;
6 | }
7 |
8 | .el-upload {
9 | input[type="file"] {
10 | display: none !important;
11 | }
12 | }
13 |
14 | .el-upload__input {
15 | display: none;
16 | }
17 |
18 |
19 | // to fixed https://github.com/ElemeFE/element/issues/2461
20 | .el-dialog {
21 | transform: none;
22 | left: 0;
23 | position: relative;
24 | margin: 0 auto;
25 | }
26 |
27 | // refine element ui upload
28 | .upload-container {
29 | .el-upload {
30 | width: 100%;
31 |
32 | .el-upload-dragger {
33 | width: 100%;
34 | height: 200px;
35 | }
36 | }
37 | }
38 |
39 | // dropdown
40 | .el-dropdown-menu {
41 | a {
42 | display: block
43 | }
44 | }
45 |
46 | // to fix el-date-picker css style
47 | .el-range-separator {
48 | box-sizing: content-box;
49 | }
50 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-schedule/devops-schedule-server/src/main/resources/frontend/src/icons/svg/eye.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-schedule/devops-schedule-server/src/main/resources/frontend/src/styles/transition.scss:
--------------------------------------------------------------------------------
1 | // global transition css
2 |
3 | /* fade */
4 | .fade-enter-active,
5 | .fade-leave-active {
6 | transition: opacity 0.28s;
7 | }
8 |
9 | .fade-enter,
10 | .fade-leave-active {
11 | opacity: 0;
12 | }
13 |
14 | /* fade-transform */
15 | .fade-transform-leave-active,
16 | .fade-transform-enter-active {
17 | transition: all .5s;
18 | }
19 |
20 | .fade-transform-enter {
21 | opacity: 0;
22 | transform: translateX(-30px);
23 | }
24 |
25 | .fade-transform-leave-to {
26 | opacity: 0;
27 | transform: translateX(30px);
28 | }
29 |
30 | /* breadcrumb transition */
31 | .breadcrumb-enter-active,
32 | .breadcrumb-leave-active {
33 | transition: all .5s;
34 | }
35 |
36 | .breadcrumb-enter,
37 | .breadcrumb-leave-active {
38 | opacity: 0;
39 | transform: translateX(20px);
40 | }
41 |
42 | .breadcrumb-move {
43 | transition: all .5s;
44 | }
45 |
46 | .breadcrumb-leave-active {
47 | position: absolute;
48 | }
49 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-schedule/devops-schedule-common/src/main/kotlin/com/tencent/devops/schedule/enums/JobModeEnum.kt:
--------------------------------------------------------------------------------
1 | package com.tencent.devops.schedule.enums
2 |
3 | /**
4 | * 运行模式
5 | */
6 | enum class JobModeEnum(
7 | private val code: Int,
8 | private val label: String,
9 | val isContainer: Boolean,
10 | val isScript: Boolean,
11 | ) : DictItem {
12 | /**
13 | * Java Bean
14 | */
15 | BEAN(1, "Java Bean", false, false),
16 |
17 | /**
18 | * Shell
19 | */
20 | SHELL(2, "Shell", false, true),
21 |
22 | /**
23 | * K8s shell
24 | * */
25 | K8S_SHELL(3, "K8s shell", true, true),
26 | ;
27 |
28 | override fun code() = code
29 | override fun description() = label
30 |
31 | companion object {
32 | const val DEFAULT_IMAGE = "bash"
33 |
34 | /**
35 | * 根据[code]查找对应的枚举类型
36 | */
37 | fun ofCode(code: Int): JobModeEnum? {
38 | return values().find { it.code == code }
39 | }
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-schedule/devops-schedule-server/src/main/kotlin/com/tencent/devops/schedule/remote/RemoteWorkerRpcClient.kt:
--------------------------------------------------------------------------------
1 | package com.tencent.devops.schedule.remote
2 |
3 | import com.tencent.devops.schedule.api.WorkerRpcClient
4 | import com.tencent.devops.schedule.constants.RPC_RUN_JOB
5 | import com.tencent.devops.schedule.constants.WORKER_RPC_V1
6 | import com.tencent.devops.schedule.pojo.ScheduleResponse
7 | import com.tencent.devops.schedule.pojo.trigger.TriggerParam
8 | import org.springframework.web.client.RestTemplate
9 | import org.springframework.web.client.postForObject
10 |
11 | class RemoteWorkerRpcClient(
12 | private val serverRestTemplate: RestTemplate
13 | ): WorkerRpcClient {
14 | override fun runJob(param: TriggerParam): ScheduleResponse {
15 | val workerAddress = param.workerAddress.orEmpty()
16 | require(workerAddress.isNotBlank())
17 | val runJobAddress = workerAddress + WORKER_RPC_V1 + RPC_RUN_JOB
18 | return serverRestTemplate.postForObject(runJobAddress, param)
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-schedule/devops-schedule-common/src/main/kotlin/com/tencent/devops/schedule/api/RpcAuthRequestInterceptor.kt:
--------------------------------------------------------------------------------
1 | package com.tencent.devops.schedule.api
2 |
3 | import com.tencent.devops.schedule.constants.SCHEDULE_RPC_AUTH_HEADER
4 | import org.springframework.http.HttpRequest
5 | import org.springframework.http.client.ClientHttpRequestExecution
6 | import org.springframework.http.client.ClientHttpRequestInterceptor
7 | import org.springframework.http.client.ClientHttpResponse
8 |
9 | class RpcAuthRequestInterceptor(
10 | private val accessToken: String
11 | ) : ClientHttpRequestInterceptor {
12 |
13 | override fun intercept(
14 | request: HttpRequest,
15 | body: ByteArray,
16 | execution: ClientHttpRequestExecution
17 | ): ClientHttpResponse {
18 | val headers = request.headers
19 | if (!headers.containsKey(SCHEDULE_RPC_AUTH_HEADER)) {
20 | headers[SCHEDULE_RPC_AUTH_HEADER] = accessToken
21 | }
22 | return execution.execute(request, body)
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/devops-boot-sample/boot-kotlin-sample/src/main/kotlin/com/tencent/devops/sample/KotlinApplication.kt:
--------------------------------------------------------------------------------
1 | package com.tencent.devops.sample
2 |
3 | import com.tencent.devops.boot.runApplication
4 | import org.slf4j.LoggerFactory
5 | import org.springframework.boot.autoconfigure.SpringBootApplication
6 | import org.springframework.cloud.openfeign.EnableFeignClients
7 | import org.springframework.scheduling.annotation.EnableScheduling
8 | import org.springframework.scheduling.annotation.Scheduled
9 |
10 | /**
11 | * 使用DevOpsBoot框架的Sample应用
12 | */
13 | @EnableFeignClients
14 | @EnableScheduling
15 | @SpringBootApplication
16 | class KotlinApplication {
17 |
18 | @Scheduled(fixedDelay = 60 * 1000L)
19 | fun schedule() {
20 | logger.debug("debug log")
21 | logger.info("info log")
22 | logger.error("error log")
23 | }
24 |
25 | companion object {
26 | private val logger = LoggerFactory.getLogger(KotlinApplication::class.java)
27 | }
28 | }
29 |
30 | fun main(args: Array) {
31 | runApplication(args)
32 | }
33 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-schedule/devops-schedule-worker/src/main/kotlin/com/tencent/devops/schedule/executor/JobContext.kt:
--------------------------------------------------------------------------------
1 | package com.tencent.devops.schedule.executor
2 |
3 | import java.time.LocalDateTime
4 |
5 | data class JobContext(
6 | /**
7 | * 任务id
8 | */
9 | var jobId: String,
10 | /**
11 | * 任务参数
12 | */
13 | var jobParamMap: Map,
14 | /**
15 | * 本次任务执行日志id
16 | */
17 | var logId: String,
18 | /**
19 | * 本次任务触发时间
20 | */
21 | var triggerTime: LocalDateTime,
22 |
23 | /**
24 | * 本次任务调度时间
25 | * */
26 | var scheduledFireTime: LocalDateTime,
27 | /**
28 | * 任务更新时间
29 | * */
30 | var updateTime: LocalDateTime,
31 | /**
32 | * 分片广播序号
33 | */
34 | var broadcastIndex: Int = 0,
35 | /**
36 | * 分片广播总数
37 | */
38 | var broadcastTotal: Int = 1,
39 | /**
40 | * 资源内容,可以是脚本,也可以是yaml
41 | * */
42 | var source: String?,
43 | /**
44 | * k8s任务使用的镜像
45 | * */
46 | var image: String?,
47 | )
48 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-plugin/devops-plugin-processor/src/main/kotlin/com/tencent/devops/plugin/processor/ExtensionFiles.kt:
--------------------------------------------------------------------------------
1 | package com.tencent.devops.plugin.processor
2 |
3 | import com.tencent.devops.plugin.api.ExtensionType
4 | import java.io.BufferedWriter
5 | import java.io.OutputStream
6 | import java.io.OutputStreamWriter
7 | import java.nio.charset.StandardCharsets.UTF_8
8 |
9 | /**
10 | * Extension配置文件工具类
11 | */
12 | object ExtensionFiles {
13 |
14 | /**
15 | * 将扩展类名写入文件
16 | */
17 | fun write(factories: MutableMap>, output: OutputStream) {
18 | BufferedWriter(OutputStreamWriter(output, UTF_8)).use { writer ->
19 | writer.write("# Generated by DevOps Boot\n")
20 | factories.forEach { (key, value) ->
21 | writer.write(key.identifier)
22 | writer.write("=\\\n ")
23 | val names = value.joinToString(",\\\n ")
24 | writer.write(names)
25 | writer.newLine()
26 | }
27 | }
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-schedule/devops-schedule-worker/src/main/kotlin/com/tencent/devops/schedule/thread/JobThreadGroup.kt:
--------------------------------------------------------------------------------
1 | package com.tencent.devops.schedule.thread
2 |
3 | import com.tencent.devops.schedule.api.ServerRpcClient
4 | import java.util.concurrent.atomic.AtomicLong
5 | import kotlin.math.abs
6 |
7 | /**
8 | * 任务线程组
9 | * */
10 | class JobThreadGroup(nThreads: Int, serverRpcClient: ServerRpcClient) : AutoCloseable {
11 | private val threads: MutableList = mutableListOf()
12 | private val idx = AtomicLong()
13 |
14 | init {
15 | for (i in 0 until nThreads) {
16 | val jobThread = JobThread(serverRpcClient)
17 | jobThread.start()
18 | threads.add(jobThread)
19 | }
20 | }
21 |
22 | fun next(): JobThread {
23 | return threads[abs((idx.getAndIncrement() % threads.size).toDouble()).toInt()]
24 | }
25 |
26 | override fun close() {
27 | threads.forEach {
28 | it.toStop()
29 | it.interrupt()
30 | it.join()
31 | }
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-tools/devops-boot-gradle-plugin/src/main/kotlin/com/tencent/devops/actions/KtLintCheckAction.kt:
--------------------------------------------------------------------------------
1 | package com.tencent.devops.actions
2 |
3 | import org.gradle.api.Action
4 | import org.gradle.api.file.FileCollection
5 | import org.gradle.api.tasks.JavaExec
6 |
7 | /**
8 | * ktlint check action
9 | */
10 | class KtLintCheckAction(
11 | private val ktLint: FileCollection
12 | ) : Action {
13 |
14 | override fun execute(javaExec: JavaExec) {
15 | with(javaExec) {
16 | val outputDir = "${project.layout.buildDirectory}/reports/ktlint/"
17 | val inputFiles = project.fileTree(mapOf("dir" to "src", "include" to "**/*.kt"))
18 | group = "verification"
19 | inputs.files(inputFiles)
20 | outputs.dir(outputDir)
21 | description = "Check Kotlin code style."
22 | classpath = ktLint
23 | mainClass.set("com.pinterest.ktlint.Main")
24 | args = listOf("src/**/*.kt")
25 | }
26 | }
27 |
28 | companion object {
29 | const val TASK_NAME = "ktlintCheck"
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2020 bkdevops-projects
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-schedule/devops-schedule-server/src/main/resources/frontend/build/index.js:
--------------------------------------------------------------------------------
1 | const { run } = require('runjs')
2 | const chalk = require('chalk')
3 | const config = require('../vue.config.js')
4 | const rawArgv = process.argv.slice(2)
5 | const args = rawArgv.join(' ')
6 |
7 | if (process.env.npm_config_preview || rawArgv.includes('--preview')) {
8 | const report = rawArgv.includes('--report')
9 |
10 | run(`vue-cli-service build ${args}`)
11 |
12 | const port = 9526
13 | const publicPath = config.publicPath
14 |
15 | var connect = require('connect')
16 | var serveStatic = require('serve-static')
17 | const app = connect()
18 |
19 | app.use(
20 | publicPath,
21 | serveStatic('./dist', {
22 | index: ['index.html', '/']
23 | })
24 | )
25 |
26 | app.listen(port, function () {
27 | console.log(chalk.green(`> Preview at http://localhost:${port}${publicPath}`))
28 | if (report) {
29 | console.log(chalk.green(`> Report at http://localhost:${port}${publicPath}report.html`))
30 | }
31 |
32 | })
33 | } else {
34 | run(`vue-cli-service build ${args}`)
35 | }
36 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-tools/devops-boot-gradle-plugin/src/main/kotlin/com/tencent/devops/actions/KtLintFormatAction.kt:
--------------------------------------------------------------------------------
1 | package com.tencent.devops.actions
2 |
3 | import org.gradle.api.Action
4 | import org.gradle.api.file.FileCollection
5 | import org.gradle.api.tasks.JavaExec
6 |
7 | /**
8 | * ktlint format action
9 | */
10 | class KtLintFormatAction(
11 | private val ktLint: FileCollection
12 | ) : Action {
13 |
14 | override fun execute(javaExec: JavaExec) {
15 | with(javaExec) {
16 | val outputDir = "${project.layout.buildDirectory}/reports/ktlint/"
17 | val inputFiles = project.fileTree(mapOf("dir" to "src", "include" to "**/*.kt"))
18 | group = "formatting"
19 | inputs.files(inputFiles)
20 | outputs.dir(outputDir)
21 | description = "Fix Kotlin code style deviations."
22 | classpath = ktLint
23 | mainClass.set("com.pinterest.ktlint.Main")
24 | args = listOf("-F", "src/**/*.kt")
25 | }
26 | }
27 |
28 | companion object {
29 | const val TASK_NAME = "ktlintFormat"
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-logging/src/main/resources/logback-spring.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-plugin/devops-plugin-core/src/main/kotlin/com/tencent/devops/plugin/spring/PluginEndpointAutoConfiguration.kt:
--------------------------------------------------------------------------------
1 | package com.tencent.devops.plugin.spring
2 |
3 | import com.tencent.devops.plugin.api.PluginManager
4 | import org.springframework.boot.actuate.autoconfigure.endpoint.EndpointAutoConfiguration
5 | import org.springframework.boot.autoconfigure.AutoConfigureAfter
6 | import org.springframework.boot.autoconfigure.condition.ConditionalOnClass
7 | import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty
8 | import org.springframework.context.annotation.Bean
9 | import org.springframework.context.annotation.Configuration
10 |
11 | @Configuration(proxyBeanMethods = false)
12 | @ConditionalOnClass(name = ["org.springframework.boot.actuate.endpoint.annotation.Endpoint"])
13 | @AutoConfigureAfter(EndpointAutoConfiguration::class)
14 | @ConditionalOnProperty(prefix = "management.endpoint.devopsPlugin", name = ["enabled"], havingValue = "true")
15 | class PluginEndpointAutoConfiguration {
16 |
17 | @Bean
18 | fun pluginEndpoint(pluginManager: PluginManager) = PluginEndpoint(pluginManager)
19 | }
20 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-loadbalancer/src/main/kotlin/com/tencent/devops/loadbalancer/config/DevOpsLoadBalancerProperties.kt:
--------------------------------------------------------------------------------
1 | package com.tencent.devops.loadbalancer.config
2 |
3 | import com.tencent.devops.loadbalancer.config.DevOpsLoadBalancerProperties.Companion.PREFIX
4 | import org.springframework.boot.context.properties.ConfigurationProperties
5 |
6 | /**
7 | * 客户端负载均衡配置
8 | */
9 | @ConfigurationProperties(PREFIX)
10 | data class DevOpsLoadBalancerProperties(
11 | /**
12 | * 优先访问本地服务
13 | */
14 | var localPrior: LocalPrior = LocalPrior(),
15 |
16 | /**
17 | * 灰度调用配置
18 | */
19 | var gray: Gray = Gray()
20 | ) {
21 | data class Gray(
22 | /**
23 | * 是否启用灰度调用
24 | */
25 | var enabled: Boolean = false,
26 | /**
27 | * 匹配metadata key值
28 | */
29 | var metaKey: String = "env"
30 | )
31 |
32 | data class LocalPrior(
33 | /**
34 | * 是否优先访问本地服务
35 | */
36 | var enabled: Boolean = false
37 | )
38 |
39 | companion object {
40 | const val PREFIX = "devops.loadbalancer"
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-schedule/devops-schedule-server/src/main/kotlin/com/tencent/devops/schedule/utils/ScheduleUtils.kt:
--------------------------------------------------------------------------------
1 | package com.tencent.devops.schedule.utils
2 |
3 | import com.tencent.devops.schedule.enums.ScheduleTypeEnum
4 | import com.tencent.devops.schedule.pojo.job.JobInfo
5 | import org.springframework.scheduling.support.CronExpression
6 | import java.time.LocalDateTime
7 | import java.time.ZoneId
8 |
9 | /**
10 | * 计算下次执行时间
11 | */
12 | fun computeNextTriggerTime(
13 | job: JobInfo,
14 | from: LocalDateTime = LocalDateTime.now()
15 | ): Long? {
16 | val scheduleType = ScheduleTypeEnum.ofCode(job.scheduleType)
17 | val scheduleConf = job.scheduleConf
18 | val nextTriggerTime = when (scheduleType) {
19 | ScheduleTypeEnum.IMMEDIATELY -> LocalDateTime.now()
20 | ScheduleTypeEnum.FIX_TIME -> LocalDateTime.parse(scheduleConf)
21 | ScheduleTypeEnum.FIX_RATE -> from.plusSeconds(scheduleConf.toLong())
22 | ScheduleTypeEnum.CRON -> CronExpression.parse(scheduleConf).next(from)
23 | else -> return null
24 | }
25 | return nextTriggerTime?.atZone(ZoneId.systemDefault())?.toInstant()?.toEpochMilli()
26 | }
27 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-service-reactive/src/main/kotlin/com/tencent/devops/service/ServiceReactiveAutoConfiguration.kt:
--------------------------------------------------------------------------------
1 | package com.tencent.devops.service
2 |
3 | import com.tencent.devops.service.feign.FeignFilterRequestMappingHandlerMapping
4 | import org.springframework.boot.autoconfigure.AutoConfigureBefore
5 | import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication
6 | import org.springframework.boot.autoconfigure.web.reactive.WebFluxAutoConfiguration
7 | import org.springframework.boot.autoconfigure.web.reactive.WebFluxRegistrations
8 | import org.springframework.context.annotation.Bean
9 | import org.springframework.context.annotation.Configuration
10 |
11 | /**
12 | * Service自动化配置类
13 | */
14 | @Configuration(proxyBeanMethods = false)
15 | @ConditionalOnWebApplication
16 | @AutoConfigureBefore(WebFluxAutoConfiguration::class)
17 | class ServiceReactiveAutoConfiguration {
18 |
19 | @Bean
20 | fun feignWebRegistrations(): WebFluxRegistrations {
21 | return object : WebFluxRegistrations {
22 | override fun getRequestMappingHandlerMapping() = FeignFilterRequestMappingHandlerMapping()
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/docs/_sidebar.md:
--------------------------------------------------------------------------------
1 | - **入门**
2 | - [介绍](/index.md)
3 | - [快速开始](/quick-start.md)
4 | - **gradle插件**
5 | - [devops-boot-gradle-plugin](/plugin/devops-boot-gradle-plugin.md)
6 | - [devops-publish-gradle-plugin](/plugin/devops-publish-gradle-plugin.md)
7 | - **starter组件**
8 | - [starter-api](/starter/devops-boot-starter-api.md)
9 | - [starter-logging](/starter/devops-boot-starter-logging.md)
10 | - [starter-web](/starter/devops-boot-starter-web.md)
11 | - [starter-service](/starter/devops-boot-starter-service.md)
12 | - [starter-circuitbreaker](/starter/devops-boot-starter-circuitbreaker.md)
13 | - [starter-loadbalancer](/starter/devops-boot-starter-loadbalancer.md)
14 | - [starter-plugin](/starter/devops-boot-starter-plugin.md)
15 | - [starter-schedule](/starter/devops-boot-starter-schedule.md)
16 | - **k8s云原生编译打包**
17 | - [云原生编译](/k8s/compile.md)
18 | - [云原生部署](/k8s/deploy.md)
19 | - **依赖管理**
20 | - [devops-boot-dependencies](/dependency/devops-boot-dependencies.md)
21 | - [依赖版本列表](/dependency/versions.md)
22 | - [Maven仓库](/dependency/repository.md)
23 | - [常见问题](/faq.md)
24 | - [参与开发](/contribute.md)
25 | - [更新日志](https://github.com/bkdevops-projects/devops-framework/releases)
26 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-schedule/devops-schedule-server/src/main/resources/frontend/src/api/job.js:
--------------------------------------------------------------------------------
1 | import request from '@/utils/request'
2 |
3 | function encodeBase64(data) {
4 | data.source = btoa(data.source)
5 | return data
6 | }
7 |
8 | function decodeBase64(res) {
9 | for (const item of res.data.records) {
10 | item.source = atob(item.source)
11 | }
12 | return res
13 | }
14 |
15 | export const list = (data) => request({
16 | url: '/job/list',
17 | method: 'get',
18 | params: data
19 | }).then(res => decodeBase64(res))
20 |
21 | export const create = (data) => request({
22 | url: '/job/create',
23 | method: 'post',
24 | data: encodeBase64(data)
25 | })
26 |
27 | export const update = (id, data) => request({
28 | url: '/job/update',
29 | method: 'post',
30 | data: data
31 | })
32 |
33 | export const del = (id) => request({
34 | url: '/job/delete',
35 | method: 'delete',
36 | params: { id }
37 | })
38 |
39 | export const stop = (id) => request({
40 | url: '/job/stop',
41 | method: 'post',
42 | params: { id }
43 | })
44 |
45 | export const start = (id) => request({
46 | url: '/job/start',
47 | method: 'post',
48 | params: { id }
49 | })
50 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-schedule/devops-schedule-worker/src/main/kotlin/com/tencent/devops/schedule/hearbeat/AbstractHeartbeat.kt:
--------------------------------------------------------------------------------
1 | package com.tencent.devops.schedule.hearbeat
2 |
3 | import com.tencent.devops.schedule.constants.WORKER_BEAT_PERIOD
4 | import com.tencent.devops.schedule.enums.WorkerStatusEnum
5 | import com.tencent.devops.schedule.utils.sleep
6 | import org.springframework.beans.factory.DisposableBean
7 | import org.springframework.beans.factory.InitializingBean
8 | import kotlin.concurrent.thread
9 |
10 | abstract class AbstractHeartbeat: Heartbeat, InitializingBean, DisposableBean {
11 |
12 | private var running = false
13 |
14 | private lateinit var thread: Thread
15 |
16 | override fun afterPropertiesSet() {
17 | running = true
18 | thread = thread(
19 | isDaemon = true,
20 | name = "heart-beat-thread"
21 | ) {
22 | while (running) {
23 | beat(WorkerStatusEnum.RUNNING)
24 | sleep(WORKER_BEAT_PERIOD)
25 | }
26 | beat(WorkerStatusEnum.STOP)
27 | }
28 | }
29 |
30 | override fun destroy() {
31 | running = false
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-schedule/devops-schedule-server/src/main/resources/frontend/src/main.js:
--------------------------------------------------------------------------------
1 | import Vue from 'vue'
2 |
3 | import 'normalize.css/normalize.css' // A modern alternative to CSS resets
4 |
5 | import ElementUI from 'element-ui'
6 | import 'element-ui/lib/theme-chalk/index.css'
7 |
8 | import Avue from '@smallwei/avue'
9 | import '@smallwei/avue/lib/index.css'
10 |
11 | import '@/styles/index.scss' // global css
12 |
13 | import App from './App'
14 | import store from './store'
15 | import router from './router'
16 |
17 | import '@/icons' // icon
18 | import '@/permission' // permission control
19 | import axios from '@/utils/request'
20 | import crudCommon from '@/layout/mixin/crud'
21 | import basicBlock from '@/components/basic-block/main'
22 | import basicContainer from '@/components/basic-container/main'
23 |
24 | window.$crudCommon = crudCommon
25 | window.axios = axios
26 |
27 | Vue.config.productionTip = false
28 |
29 | Vue.use(ElementUI)
30 | Vue.use(Avue)
31 |
32 | // 注册全局容器
33 | Vue.component('basicContainer', basicContainer)
34 | Vue.component('basicBlock', basicBlock)
35 |
36 | new Vue({
37 | el: '#app',
38 | router,
39 | store,
40 | render: h => h(App)
41 | })
42 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-tools/devops-boot-gradle-plugin/src/main/kotlin/com/tencent/devops/actions/CopyToReleaseAction.kt:
--------------------------------------------------------------------------------
1 | package com.tencent.devops.actions
2 |
3 | import com.tencent.devops.utils.findPropertyOrEmpty
4 | import org.gradle.api.Action
5 | import org.gradle.api.tasks.Copy
6 | import org.springframework.boot.gradle.tasks.bundling.BootJar
7 |
8 | /**
9 | * copy to release action
10 | */
11 | class CopyToReleaseAction : Action {
12 |
13 | override fun execute(copy: Copy) {
14 | with(copy) {
15 | copy.dependsOn(project.tasks.named("bootJar"))
16 | val withVersion = project.findPropertyOrEmpty(COPY_WITH_VERSION).toBoolean()
17 | val bootJar = project.tasks.withType(BootJar::class.java).first()
18 | from(bootJar.archiveFile)
19 | into("${project.rootDir}/release")
20 | if (!withVersion) {
21 | rename { it.replace("-${project.version}", "") }
22 | }
23 | outputs.upToDateWhen { false }
24 | }
25 | }
26 |
27 | companion object {
28 | const val TASK_NAME = "copyToRelease"
29 | private const val COPY_WITH_VERSION = "devops.copyWithVersion"
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/docs/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | devops-boot
6 |
7 |
8 |
9 |
10 |
11 |
12 | 加载中
13 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-logging/src/main/kotlin/com/tencent/devops/logging/system/DevopsLoggingApplicationListener.kt:
--------------------------------------------------------------------------------
1 | package com.tencent.devops.logging.system
2 |
3 | import com.tencent.devops.logging.enums.LogType
4 | import com.tencent.devops.logging.system.logback.DevopsLogbackLoggingSystem
5 | import org.springframework.boot.context.event.ApplicationStartingEvent
6 | import org.springframework.boot.logging.LoggingSystem
7 | import org.springframework.context.ApplicationListener
8 | import org.springframework.core.Ordered
9 | import org.springframework.core.annotation.Order
10 |
11 | @Order(Ordered.HIGHEST_PRECEDENCE + 10)
12 | class DevopsLoggingApplicationListener : ApplicationListener {
13 | /**
14 | * logging system由系统变量确定
15 | * 判断,如果没有配置系统变量,则设置默认值
16 | */
17 | override fun onApplicationEvent(event: ApplicationStartingEvent) {
18 | val loggingSystem = System.getProperty(LoggingSystem.SYSTEM_PROPERTY)
19 | if (loggingSystem.isNullOrBlank() || loggingSystem !in LogType.values().map { it.className }) {
20 | System.setProperty(LoggingSystem.SYSTEM_PROPERTY, DevopsLogbackLoggingSystem::class.java.name)
21 | }
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-schedule/devops-schedule-common/src/main/kotlin/com/tencent/devops/schedule/utils/ThreadUtils.kt:
--------------------------------------------------------------------------------
1 | package com.tencent.devops.schedule.utils
2 |
3 | import org.slf4j.Logger
4 | import org.slf4j.LoggerFactory
5 | import java.util.concurrent.TimeUnit
6 |
7 | private val logger: Logger = LoggerFactory.getLogger("ThreadUtils")
8 |
9 | fun alignTime(period: Long) {
10 | if (period < 1000) {
11 | return
12 | }
13 | try {
14 | TimeUnit.MILLISECONDS.sleep(period - System.currentTimeMillis() % 1000)
15 | } catch (e: InterruptedException) {
16 | logger.warn("align time is interrupted: ${e.message}")
17 | }
18 | }
19 |
20 | fun sleep(seconds: Int) {
21 | try {
22 | TimeUnit.SECONDS.sleep(seconds.toLong())
23 | } catch (e: InterruptedException) {
24 | logger.warn("sleep is interrupted: ${e.message}")
25 | }
26 | }
27 |
28 | fun terminate(thread: Thread) {
29 | if (thread.state != Thread.State.TERMINATED) {
30 | thread.interrupt()
31 | try {
32 | thread.join()
33 | } catch (e: InterruptedException) {
34 | logger.error("join is interrupted: ${e.message}", e)
35 | }
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-schedule/devops-schedule-common/src/main/kotlin/com/tencent/devops/schedule/api/RpcAuthWebInterceptor.kt:
--------------------------------------------------------------------------------
1 | package com.tencent.devops.schedule.api
2 |
3 | import com.tencent.devops.schedule.constants.SCHEDULE_RPC_AUTH_HEADER
4 | import jakarta.servlet.http.HttpServletRequest
5 | import jakarta.servlet.http.HttpServletResponse
6 | import org.slf4j.LoggerFactory
7 | import org.springframework.http.HttpStatus
8 | import org.springframework.web.servlet.HandlerInterceptor
9 |
10 | class RpcAuthWebInterceptor(
11 | private val accessToken: String
12 | ) : HandlerInterceptor {
13 |
14 | override fun preHandle(request: HttpServletRequest, response: HttpServletResponse, handler: Any): Boolean {
15 | val requestToken = request.getHeader(SCHEDULE_RPC_AUTH_HEADER)
16 | if (accessToken != requestToken) {
17 | logger.warn("Authenticate failed, $SCHEDULE_RPC_AUTH_HEADER[$requestToken] is invalid.")
18 | response.status = HttpStatus.UNAUTHORIZED.value()
19 | return false
20 | }
21 | return true
22 | }
23 |
24 | companion object {
25 | private val logger = LoggerFactory.getLogger(RpcAuthWebInterceptor::class.java)
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/docs/starter/devops-boot-starter-web.md:
--------------------------------------------------------------------------------
1 | # devops-boot-starter-web
2 |
3 | `starter-web`组件帮助开发者完成与web相关的快速配置
4 |
5 | ## 功能介绍
6 | - 引入`undertow`
7 | - 引入`spring-boot`的`actuator`组件
8 | - 引入`springfox-starter`并完成`swagger-ui`的自动化配置 **(OpenApi3.0规范)**
9 | - 引入`jackson`并完成序列化和反序列化的配置
10 | - 自定义`devops-boot`的启动banner
11 | - 提供常用的工具类和方法
12 |
13 |
14 | ## 使用方式
15 | - **build.gradle.kts**
16 |
17 | ```kotlin
18 | implementation("com.tencent.devops:devops-boot-starter-web")
19 | ```
20 |
21 | - **build.gradle**
22 |
23 | ```groovy
24 | implementation 'com.tencent.devops:devops-boot-starter-web'
25 | ```
26 |
27 | ## 模块依赖
28 | `starter-web`添加了如下依赖,对于这些模块的依赖不需要重复声明:
29 | - `com.tencent.devops:devops-boot-starter-api`
30 | - `com.tencent.devops:devops-boot-starter-logging`
31 |
32 | ## 配置属性
33 |
34 | swagger配置过程中会读取以下配置
35 |
36 | | 属性 | 类型 | 默认值 | 说明 |
37 | | ------------------ | ------- | ------ | ------------------ |
38 | | spring.application.name | string | null | 应用名称,swagger会页面展示该值 |
39 | | spring.application.desc | string | null | 应用描述,swagger会页面展示该值 |
40 | | spring.application.version | string | null | 应用版本,swagger会页面展示该值 |
41 |
42 | ## 参考
43 |
44 | - `springfox starter`[文档地址](http://springfox.github.io/springfox/docs/current/)
45 |
--------------------------------------------------------------------------------
/devops-boot-sample/biz-kotlin-sample/src/main/kotlin/com/tencent/devops/sample/controller/TestController.kt:
--------------------------------------------------------------------------------
1 | package com.tencent.devops.sample.controller
2 |
3 | //import com.tencent.devops.plugin.api.PluginManager
4 | import com.tencent.devops.api.pojo.Response
5 | import com.tencent.devops.sample.client.SampleClient
6 | import com.tencent.devops.sample.config.GreetingProperties
7 | import com.tencent.devops.sample.pojo.Sample
8 | import org.springframework.web.bind.annotation.GetMapping
9 | import org.springframework.web.bind.annotation.RestController
10 |
11 | /**
12 | * Test Controller
13 | */
14 | @RestController
15 | class TestController(
16 | // private val pluginManager: PluginManager,
17 | private val sampleClient: SampleClient,
18 | private val greetingProperties: GreetingProperties
19 | ) {
20 |
21 | @GetMapping("/test")
22 | fun test(): Response {
23 | return sampleClient.getSample()
24 | }
25 |
26 | @GetMapping("/greeting")
27 | fun greeting() = "Hello, ${greetingProperties.message}"
28 |
29 | /**
30 | * test plugin
31 | */
32 | // @GetMapping("/print/{content}")
33 | // fun print(@PathVariable content: String) {
34 | // pluginManager.applyExtension { print(content) }
35 | // }
36 | }
37 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-schedule/devops-schedule-server/src/main/resources/frontend/src/components/basic-container/main.vue:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
40 |
41 |
59 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-schedule/devops-schedule-server/build.gradle.kts:
--------------------------------------------------------------------------------
1 | import com.github.gradle.node.npm.task.NpmTask
2 |
3 | description = "DevOps Boot Schedule Server"
4 |
5 | plugins {
6 | id("com.github.node-gradle.node") version "3.0.1"
7 | }
8 |
9 | dependencies {
10 | api(project(":devops-boot-project:devops-boot-core:devops-schedule:devops-schedule-common"))
11 | api(project(":devops-boot-project:devops-boot-core:devops-schedule:devops-schedule-model"))
12 | api("io.jsonwebtoken:jjwt-api")
13 | api("com.google.guava:guava")
14 | runtimeOnly("io.jsonwebtoken:jjwt-impl")
15 | runtimeOnly("io.jsonwebtoken:jjwt-jackson")
16 | compileOnly("org.springframework.cloud:spring-cloud-starter")
17 | }
18 |
19 | sourceSets {
20 | main {
21 | resources {
22 | // 只打包dist目录,加快build,减小打包体积
23 | include("frontend/dist/**")
24 | include("META-INF/**")
25 | }
26 | }
27 | }
28 |
29 | node {
30 | download.set(false)
31 | nodeProjectDir.set(project.projectDir.resolve("src/main/resources/frontend"))
32 | }
33 |
34 | tasks.register("buildFrontend") {
35 | dependsOn("npm_install")
36 | args.set(listOf("run", "build"))
37 | }
38 |
39 | tasks.getByName("build").dependsOn("buildFrontend")
40 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-schedule/devops-schedule-server/src/main/kotlin/com/tencent/devops/schedule/config/ScheduleServerWebUiConfigurer.kt:
--------------------------------------------------------------------------------
1 | package com.tencent.devops.schedule.config
2 |
3 | import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry
4 | import org.springframework.web.servlet.config.annotation.ViewControllerRegistry
5 | import org.springframework.web.servlet.config.annotation.WebMvcConfigurer
6 |
7 | /**
8 | * Schedule server ui访问配置
9 | */
10 | class ScheduleServerWebUiConfigurer(
11 | scheduleServerProperties: ScheduleServerProperties
12 | ) : WebMvcConfigurer {
13 |
14 | private val contextPath = scheduleServerProperties.contextPath.trimEnd('/')
15 |
16 | override fun addResourceHandlers(registry: ResourceHandlerRegistry) {
17 | registry.addResourceHandler("$contextPath/ui/**")
18 | .addResourceLocations("classpath:/frontend/dist/")
19 | .resourceChain(false)
20 | }
21 |
22 | override fun addViewControllers(registry: ViewControllerRegistry) {
23 | registry.addViewController("$contextPath/")
24 | .setViewName("redirect:$contextPath/ui/")
25 | registry.addViewController("$contextPath/ui/")
26 | .setViewName("forward:$contextPath/ui/index.html")
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-schedule/devops-schedule-server/src/main/resources/frontend/src/styles/index.scss:
--------------------------------------------------------------------------------
1 | @import './variables.scss';
2 | @import './mixin.scss';
3 | @import './transition.scss';
4 | @import './element-ui.scss';
5 | @import './sidebar.scss';
6 |
7 | body {
8 | height: 100%;
9 | -moz-osx-font-smoothing: grayscale;
10 | -webkit-font-smoothing: antialiased;
11 | text-rendering: optimizeLegibility;
12 | font-family: Helvetica Neue, Helvetica, PingFang SC, Hiragino Sans GB, Microsoft YaHei, Arial, sans-serif;
13 | }
14 |
15 | label {
16 | font-weight: 700;
17 | }
18 |
19 | html {
20 | height: 100%;
21 | box-sizing: border-box;
22 | }
23 |
24 | #app {
25 | height: 100%;
26 | }
27 |
28 | *,
29 | *:before,
30 | *:after {
31 | box-sizing: inherit;
32 | }
33 |
34 | a:focus,
35 | a:active {
36 | outline: none;
37 | }
38 |
39 | a,
40 | a:focus,
41 | a:hover {
42 | cursor: pointer;
43 | color: inherit;
44 | text-decoration: none;
45 | }
46 |
47 | div:focus {
48 | outline: none;
49 | }
50 |
51 | .clearfix {
52 | &:after {
53 | visibility: hidden;
54 | display: block;
55 | font-size: 0;
56 | content: " ";
57 | clear: both;
58 | height: 0;
59 | }
60 | }
61 |
62 | // main-container global css
63 | .app-container {
64 | padding: 20px;
65 | }
66 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-tools/devops-boot-gradle-plugin/src/main/kotlin/com/tencent/devops/conventions/SpringBootConvention.kt:
--------------------------------------------------------------------------------
1 | package com.tencent.devops.conventions
2 |
3 | import com.tencent.devops.actions.CopyToReleaseAction
4 | import com.tencent.devops.utils.isBootProject
5 | import org.gradle.api.Project
6 | import org.gradle.api.tasks.Copy
7 | import org.springframework.boot.gradle.plugin.SpringBootPlugin
8 |
9 | /**
10 | * 配置Spring Boot Gradle插件以及相关配置
11 | * reference: https://docs.spring.io/spring-boot/docs/current/gradle-plugin/reference/html/
12 | */
13 | class SpringBootConvention {
14 |
15 | fun apply(project: Project) {
16 | with(project) {
17 | if (isBootProject(this)) {
18 | project.pluginManager.apply(SpringBootPlugin::class.java)
19 | configureCopyToRelease(this)
20 | SpringCloudConvention().apply(this)
21 | }
22 | }
23 | }
24 |
25 | /**
26 | * 配置copyToRelease task
27 | */
28 | private fun configureCopyToRelease(project: Project) {
29 | with(project.tasks) {
30 | val copyToRelease = register(CopyToReleaseAction.TASK_NAME, Copy::class.java, CopyToReleaseAction())
31 | named("build").configure { it.dependsOn(copyToRelease) }
32 | }
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/devops-boot-sample/plugin-printer/build.gradle.kts:
--------------------------------------------------------------------------------
1 | plugins {
2 | kotlin("kapt")
3 | }
4 |
5 | dependencies {
6 | // 引入插件扩展点定义,实际开发中通过jar包引入
7 | implementation(project(":api-kotlin-sample"))
8 | implementation("org.bytedeco:ffmpeg:6.0-1.5.9")
9 | kapt("com.tencent.devops:devops-plugin-processor")
10 | }
11 |
12 | val pluginId: String? by project
13 | val pluginVersion: String? by project
14 | val pluginScope: String? by project
15 | val pluginAuthor: String? by project
16 | val pluginDescription: String? by project
17 |
18 | fun pluginId() = pluginId ?: name.removePrefix("plugin-")
19 | fun pluginVersion() = pluginVersion ?: version
20 | fun archiveFileName() = "plugin-${pluginId()}-${pluginVersion()}.jar"
21 |
22 | tasks.withType {
23 | archiveFileName.set(archiveFileName())
24 | manifest {
25 | attributes(
26 | "Plugin-Id" to pluginId(),
27 | "Plugin-Version" to pluginVersion(),
28 | "Plugin-Scope" to pluginScope,
29 | "Plugin-Author" to pluginAuthor,
30 | "Plugin-Description" to pluginDescription
31 | )
32 | }
33 | // 添加lib
34 | from(configurations.runtimeClasspath.get().filter { it.name.endsWith(".jar") }) {
35 | into("lib")
36 | }
37 | entryCompression = ZipEntryCompression.STORED
38 | }
39 |
--------------------------------------------------------------------------------
/.github/workflows/create-release.yml:
--------------------------------------------------------------------------------
1 | # Create release branch from master or hotfix
2 | name: Create release branch
3 | on:
4 | workflow_dispatch:
5 |
6 | jobs:
7 | create-release:
8 | runs-on: ubuntu-latest
9 | env:
10 | RELEASE_VERSION: ${{ github.event.inputs.release_version }}
11 | NEXT_VERSION: ${{ github.event.inputs.next_version }}
12 | steps:
13 | - name: Check branch
14 | if: github.ref_name != 'master' && startsWith(github.ref_name,'hotfix-') != true
15 | run: |
16 | echo "Create release branch can only from master or hotfix-** branch"
17 | exit 1
18 | - uses: actions/checkout@v2
19 | - name: Setup git configuration
20 | run: |
21 | git config user.name "bkci-bot"
22 | git config user.email "64278246+bkci-bot@users.noreply.github.com"
23 | - name: Release
24 | run: |
25 | ./gradlew generateReleaseProperties
26 | ./gradlew release
27 | - name: Push new release branch
28 | run: |
29 | version=$(grep "release.version=" release.properties | awk -F "=" '{print $2}')
30 | release_branch=release-$version
31 | echo "version=$version"
32 | echo "branch_name=$release_branch"
33 | git checkout -b $release_branch v$version
34 | git push origin $release_branch
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-schedule/devops-schedule-server/src/main/resources/frontend/src/icons/svg/eye-open.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/devops-boot-project/devops-boot-core/devops-schedule/devops-schedule-server/src/main/resources/frontend/src/store/modules/app.js:
--------------------------------------------------------------------------------
1 | import Cookies from 'js-cookie'
2 |
3 | const state = {
4 | sidebar: {
5 | opened: Cookies.get('sidebarStatus') ? !!+Cookies.get('sidebarStatus') : true,
6 | withoutAnimation: false
7 | },
8 | device: 'desktop'
9 | }
10 |
11 | const mutations = {
12 | TOGGLE_SIDEBAR: state => {
13 | state.sidebar.opened = !state.sidebar.opened
14 | state.sidebar.withoutAnimation = false
15 | if (state.sidebar.opened) {
16 | Cookies.set('sidebarStatus', 1)
17 | } else {
18 | Cookies.set('sidebarStatus', 0)
19 | }
20 | },
21 | CLOSE_SIDEBAR: (state, withoutAnimation) => {
22 | Cookies.set('sidebarStatus', 0)
23 | state.sidebar.opened = false
24 | state.sidebar.withoutAnimation = withoutAnimation
25 | },
26 | TOGGLE_DEVICE: (state, device) => {
27 | state.device = device
28 | }
29 | }
30 |
31 | const actions = {
32 | toggleSideBar({ commit }) {
33 | commit('TOGGLE_SIDEBAR')
34 | },
35 | closeSideBar({ commit }, { withoutAnimation }) {
36 | commit('CLOSE_SIDEBAR', withoutAnimation)
37 | },
38 | toggleDevice({ commit }, device) {
39 | commit('TOGGLE_DEVICE', device)
40 | }
41 | }
42 |
43 | export default {
44 | namespaced: true,
45 | state,
46 | mutations,
47 | actions
48 | }
49 |
--------------------------------------------------------------------------------
/.github/workflows/publish-snapshot.yml:
--------------------------------------------------------------------------------
1 | # Trigger building on push event, and publishing snapshot package if in base repository
2 | name: Build and Publish snapshot package
3 | on:
4 | workflow_dispatch:
5 | push:
6 | branches:
7 | - master
8 | paths-ignore:
9 | - '.github/**'
10 | - 'docs/**'
11 |
12 | jobs:
13 | build:
14 | runs-on: ubuntu-latest
15 | steps:
16 | - uses: actions/checkout@v2
17 | - name: Set up JDK 17
18 | uses: actions/setup-java@v1
19 | with:
20 | java-version: 17
21 | - name: Set up Node JS
22 | uses: actions/setup-node@v2
23 | with:
24 | node-version: 14
25 | - name: Build with Gradle
26 | run: ./gradlew build
27 | - name: Publish snapshot package
28 | if: github.repository == 'bkdevops-projects/devops-framework'
29 | env:
30 | ORG_GRADLE_PROJECT_repoUsername: ${{ secrets.SONATYPE_USERNAME }}
31 | ORG_GRADLE_PROJECT_repoPassword: ${{ secrets.SONATYPE_PASSWORD }}
32 | ORG_GRADLE_PROJECT_snapshotRepoUrl: "https://central.sonatype.com/repository/maven-snapshots/"
33 | ORG_GRADLE_PROJECT_signingKey: ${{ secrets.SIGNING_KEY }}
34 | ORG_GRADLE_PROJECT_signingKeyId: ${{ secrets.SIGNING_KEY_ID }}
35 | ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.SIGNING_PASSWORD }}
36 | run: ./gradlew publish
37 |
--------------------------------------------------------------------------------