Skip to content

Commit

Permalink
Merge branch 'issue-jdk17-197' into develop-0.0.10
Browse files Browse the repository at this point in the history
  • Loading branch information
stubenhuang committed Oct 12, 2023
2 parents f4336a3 + c677771 commit e5e26e8
Show file tree
Hide file tree
Showing 35 changed files with 142 additions and 183 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build-on-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up JDK 1.8
- name: Set up JDK 17
uses: actions/setup-java@v1
with:
java-version: 1.8
java-version: 17
- name: Set up Node JS
uses: actions/setup-node@v2
with:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/publish-snapshot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up JDK 8
- name: Set up JDK 17
uses: actions/setup-java@v1
with:
java-version: 8
java-version: 17
- name: Set up Node JS
uses: actions/setup-node@v2
with:
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,10 @@ jobs:
- uses: actions/checkout@v2
with:
ref: v${{ needs.release.outputs.RELEASE_VERSION }}
- name: Set up JDK 8
- name: Set up JDK 17
uses: actions/setup-java@v1
with:
java-version: 8
java-version: 17
- name: Set up Node JS
uses: actions/setup-node@v2
with:
Expand All @@ -76,4 +76,4 @@ jobs:
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.SIGNING_KEY }}
ORG_GRADLE_PROJECT_signingKeyId: ${{ secrets.SIGNING_KEY_ID }}
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.SIGNING_PASSWORD }}
run: ./gradlew publish
run: ./gradlew publish
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,13 @@

## 核心依赖

| 依赖 | 版本 |
| ------------ | ------------- |
| JDK | 1.8+ |
| Kotlin | 1.6.21 |
| Gradle | 6.8.3 |
| Spring Boot | 2.4.5 |
| Spring Cloud | 2020.0.2 |
| 依赖 | 版本 |
| ------------ |----------|
| JDK | 17 |
| Kotlin | 1.8.22 |
| Gradle | 7.6.3 |
| Spring Boot | 3.0.11 |
| Spring Cloud | 2022.0.4 |

## 示例

Expand Down
12 changes: 6 additions & 6 deletions buildSrc/src/main/kotlin/Versions.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ object Release {

object Versions {
const val Jib: String = "3.2.0"
const val Java = "1.8"
const val Kotlin = "1.6.21"
const val SpringBoot = "2.6.13"
const val SpringCloud = "2021.0.5"
const val DependencyManagement = "1.0.15.RELEASE"
const val Java = "17"
const val Kotlin = "1.8.22"
const val SpringBoot = "3.0.11"
const val SpringCloud = "2022.0.4"
const val DependencyManagement = "1.1.3"
const val GradleNexusPublish = "1.3.0"
const val KtLint = "0.41.0"
const val KtLint = "0.50.0"
}
7 changes: 7 additions & 0 deletions devops-boot-project/devops-boot-core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ subprojects {
}

tasks {
compileJava {
sourceCompatibility = Versions.Java
targetCompatibility = Versions.Java
}
compileKotlin {
kotlinOptions.freeCompilerArgs = listOf("-Xjsr305=strict")
kotlinOptions.jvmTarget = Versions.Java
Expand All @@ -42,5 +46,8 @@ subprojects {
test {
useJUnitPlatform()
}
withType(org.jetbrains.kotlin.gradle.internal.KaptGenerateStubsTask::class.java).configureEach {
kotlinOptions.jvmTarget = Versions.Java
}
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
description = "DevOps Boot Api"

dependencies {
api("io.swagger:swagger-annotations")
api("io.swagger:swagger-models")
api("io.swagger.core.v3:swagger-annotations")
api("io.swagger.core.v3:swagger-models")
}
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
package com.tencent.devops.api.pojo

import com.fasterxml.jackson.annotation.JsonIgnore
import io.swagger.annotations.ApiModel
import io.swagger.annotations.ApiModelProperty
import io.swagger.v3.oas.annotations.media.Schema

@ApiModel("数据返回包装模型")
@Schema(description = "数据返回包装模型")
data class Response<out T>(
@ApiModelProperty("返回码")
@Schema(description = "返回码")
val code: Int,
@ApiModelProperty("提示信息")
@Schema(description = "提示信息")
val message: String? = null,
@ApiModelProperty("数据")
@Schema(description = "数据")
val data: T? = null
) {
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import org.slf4j.LoggerFactory
import java.nio.file.Files
import java.nio.file.Path
import java.nio.file.Paths
import kotlin.streams.toList
import java.util.stream.Collectors

/**
* 插件扫描器默认实现
Expand All @@ -22,7 +22,7 @@ class DefaultPluginScanner(
logger.error("Failed to load plugin, Path[$pluginDir] is not a directory.")
return emptyList()
}
return Files.walk(pluginDir).filter { it.toString().endsWith(".jar") }.toList()
return Files.walk(pluginDir).filter { it.toString().endsWith(".jar") }.collect(Collectors.toList())
}

override fun scan(id: String): Path? {
Expand All @@ -35,7 +35,7 @@ class DefaultPluginScanner(
val filename = it.toString()
val name = filename.substringAfter("-").substringBeforeLast("-")
name == id
}.toList().firstOrNull()
}.collect(Collectors.toList()).firstOrNull()
}

companion object {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ package com.tencent.devops.stream.binder.pulsar.util
import com.tencent.devops.stream.binder.pulsar.constant.DLQ
import com.tencent.devops.stream.binder.pulsar.constant.PATH_SPLIT
import com.tencent.devops.stream.binder.pulsar.constant.RETRY
import jakarta.validation.constraints.NotBlank
import org.apache.pulsar.client.api.DeadLetterPolicy
import java.io.UnsupportedEncodingException
import java.util.StringJoiner
import javax.validation.constraints.NotBlank

object PulsarUtils {

Expand All @@ -58,12 +58,12 @@ object PulsarUtils {

private fun validateByte(b: Byte): Boolean {
return (
b >= 'a'.toByte() && b <= 'z'.toByte() ||
b >= 'A'.toByte() && b <= 'Z'.toByte() ||
b >= '0'.toByte() && b <= '9'.toByte() ||
b == '.'.toByte() || b == '-'.toByte() ||
b == '_'.toByte()
)
b >= 'a'.code.toByte() && b <= 'z'.code.toByte() ||
b >= 'A'.code.toByte() && b <= 'Z'.code.toByte() ||
b >= '0'.code.toByte() && b <= '9'.code.toByte() ||
b == '.'.code.toByte() || b == '-'.code.toByte() ||
b == '_'.code.toByte()
)
}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package com.tencent.devops.schedule.api

import com.tencent.devops.schedule.constants.SCHEDULE_RPC_AUTH_HEADER
import jakarta.servlet.http.HttpServletRequest
import jakarta.servlet.http.HttpServletResponse
import org.slf4j.LoggerFactory
import org.springframework.http.HttpStatus
import org.springframework.web.servlet.HandlerInterceptor
import javax.servlet.http.HttpServletRequest
import javax.servlet.http.HttpServletResponse

class RpcAuthWebInterceptor(
private val accessToken: String
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ package com.tencent.devops.schedule.config
import com.tencent.devops.api.pojo.Response
import com.tencent.devops.schedule.constants.SCHEDULE_API_AUTH_HEADER
import com.tencent.devops.schedule.utils.JwtUtils
import jakarta.servlet.http.HttpServletRequest
import jakarta.servlet.http.HttpServletResponse
import org.slf4j.LoggerFactory
import org.springframework.http.HttpMethod
import org.springframework.http.HttpStatus
import org.springframework.http.MediaType.APPLICATION_JSON_VALUE
import org.springframework.web.servlet.HandlerInterceptor
import javax.servlet.http.HttpServletRequest
import javax.servlet.http.HttpServletResponse

/**
* 调度中心认证拦截器
Expand All @@ -21,7 +21,7 @@ class ScheduleServerAuthInterceptor(
private val signingKey = JwtUtils.createSigningKey(authProperties.secretKey)

override fun preHandle(request: HttpServletRequest, response: HttpServletResponse, handler: Any): Boolean {
if (request.method == HttpMethod.OPTIONS.name) {
if (request.method == HttpMethod.OPTIONS.name()) {
return true
}
val jwtToken = request.getHeader(SCHEDULE_API_AUTH_HEADER)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,18 @@ open class DefaultWorkerManager(
require(address.isNotBlank())
require(group.isNotBlank())
val status = WorkerStatusEnum.ofCode(param.status)
when(status) {
when (status) {
WorkerStatusEnum.RUNNING -> {
workerProvider.upsertWorker(group, address)
}

WorkerStatusEnum.STOP -> {
workerProvider.deleteWorker(group, address)
}

else -> {
throw RuntimeException("worker status is illegal")
}
}
logger.debug("worker[$group-$address] heartbeat, status[$status]")
}
Expand All @@ -93,7 +98,6 @@ open class DefaultWorkerManager(
}



companion object {
private val logger = LoggerFactory.getLogger(DefaultWorkerManager::class.java)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ open class JobTodoMonitor(
var hasRingData = false
if (timeRingMap.isNotEmpty()) {
for (second in timeRingMap.keys) {
if(timeRingMap[second]?.isNotEmpty() == true) {
if (timeRingMap[second]?.isNotEmpty() == true) {
hasRingData = true
break
}
Expand Down Expand Up @@ -146,10 +146,15 @@ open class JobTodoMonitor(
logger.warn("job[${job.id}] is misfire, retry")
jobScheduler.trigger(job.id.orEmpty(), TriggerTypeEnum.MISFIRE)
}

MisfireStrategyEnum.IGNORE -> {
logger.warn("job[${job.id}] is misfire, ignore")
// do nothing
}

else -> {
throw RuntimeException("misfire strategy is illegal")
}
}
// fresh next
generateNextTriggerTime(job)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ dependencies {
api(project(":devops-boot-project:devops-boot-core:devops-utils"))
api("org.springframework:spring-web")
api("org.springframework.boot:spring-boot-starter-actuator")
api("io.springfox:springfox-boot-starter")
api("org.springdoc:springdoc-openapi-starter-webmvc-ui")
}
Loading

0 comments on commit e5e26e8

Please sign in to comment.