diff --git a/devops-boot-project/devops-boot-core/devops-plugin/devops-plugin-core/src/main/kotlin/com/tencent/devops/plugin/core/PluginLoader.kt b/devops-boot-project/devops-boot-core/devops-plugin/devops-plugin-core/src/main/kotlin/com/tencent/devops/plugin/core/PluginLoader.kt index 6b47b95..011ad74 100644 --- a/devops-boot-project/devops-boot-core/devops-plugin/devops-plugin-core/src/main/kotlin/com/tencent/devops/plugin/core/PluginLoader.kt +++ b/devops-boot-project/devops-boot-core/devops-plugin/devops-plugin-core/src/main/kotlin/com/tencent/devops/plugin/core/PluginLoader.kt @@ -4,9 +4,8 @@ import com.tencent.devops.plugin.api.EXTENSION_LOCATION import com.tencent.devops.plugin.api.ExtensionType import com.tencent.devops.plugin.api.PluginInfo import com.tencent.devops.plugin.api.PluginMetadata -import org.springframework.boot.loader.LaunchedURLClassLoader -import org.springframework.boot.loader.archive.Archive -import org.springframework.boot.loader.archive.JarFileArchive +import org.springframework.boot.loader.launch.LaunchedClassLoader +import org.springframework.boot.loader.launch.Archive import java.io.IOException import java.net.URL import java.nio.file.Files @@ -14,6 +13,7 @@ import java.nio.file.Path import java.security.MessageDigest import java.util.LinkedList import java.util.Properties +import java.util.function.Predicate import java.util.jar.JarFile /** @@ -115,13 +115,13 @@ class PluginLoader( } private fun createClassloader(pluginPath: Path): ClassLoader { - val jarArchive = JarFileArchive(pluginPath.toFile()) - val archives = jarArchive.getNestedArchives(searchFilter, nestedFilter) - val urls = mutableListOf(jarArchive.url) + val jarArchive = Archive.create(pluginPath.toFile()) + val archives = jarArchive.getClassPathUrls(includeFilter, directorySearchFilter) + val urls = mutableListOf() archives.forEach { - urls.add(it.url) + urls.add(it) } - return LaunchedURLClassLoader(false, jarArchive, urls.toTypedArray(), javaClass.classLoader) + return LaunchedClassLoader(false, jarArchive, urls.toTypedArray(), javaClass.classLoader) } companion object { @@ -131,9 +131,11 @@ class PluginLoader( private const val PLUGIN_SCOPE = "Plugin-Scope" private const val PLUGIN_AUTHOR = "Plugin-Author" private const val PLUGIN_DESCRIPTION = "Plugin-Description" - val searchFilter = Archive.EntryFilter { entry -> entry.name.startsWith("lib/") } - val nestedFilter = Archive.EntryFilter { entry -> - !entry.isDirectory && entry.name.startsWith("lib/") + val directorySearchFilter = Predicate() { entry -> + entry.name().startsWith("lib/") + } + val includeFilter = Predicate() { entry -> + !entry.isDirectory && entry.name().startsWith("lib/") } } } diff --git a/devops-boot-project/devops-boot-core/devops-schedule/devops-schedule-server/src/main/kotlin/com/tencent/devops/schedule/utils/JwtUtils.kt b/devops-boot-project/devops-boot-core/devops-schedule/devops-schedule-server/src/main/kotlin/com/tencent/devops/schedule/utils/JwtUtils.kt index a147f8b..d56efc6 100644 --- a/devops-boot-project/devops-boot-core/devops-schedule/devops-schedule-server/src/main/kotlin/com/tencent/devops/schedule/utils/JwtUtils.kt +++ b/devops-boot-project/devops-boot-core/devops-schedule/devops-schedule-server/src/main/kotlin/com/tencent/devops/schedule/utils/JwtUtils.kt @@ -47,7 +47,7 @@ object JwtUtils { IllegalArgumentException::class ) fun validateToken(signingKey: Key, token: String): Jws { - return Jwts.parserBuilder().setSigningKey(signingKey).build().parseClaimsJws(token) + return Jwts.parser().setSigningKey(signingKey).build().parseClaimsJws(token) } fun createSigningKey(secretKey: String): Key { diff --git a/devops-boot-project/devops-boot-core/devops-schedule/devops-schedule-worker/src/main/kotlin/com/tencent/devops/schedule/handler/K8sShellHandler.kt b/devops-boot-project/devops-boot-core/devops-schedule/devops-schedule-worker/src/main/kotlin/com/tencent/devops/schedule/handler/K8sShellHandler.kt index 60da9b5..b185d38 100644 --- a/devops-boot-project/devops-boot-core/devops-schedule/devops-schedule-worker/src/main/kotlin/com/tencent/devops/schedule/handler/K8sShellHandler.kt +++ b/devops-boot-project/devops-boot-core/devops-schedule/devops-schedule-worker/src/main/kotlin/com/tencent/devops/schedule/handler/K8sShellHandler.kt @@ -50,14 +50,14 @@ class K8sShellHandler( val api = CoreV1Api(client) try { val configMapName = "schedule-shell-$jobId-${updateTime.toEpochMilli()}" - if (api.exec { api.readNamespacedConfigMap(configMapName, namespace, null, null, null) } == null) { + if (api.exec { api.readNamespacedConfigMap(configMapName, namespace, null) } == null) { val configMapBody = V1ConfigMap { metadata { name = configMapName } data = mapOf(CMD to source) } - api.createNamespacedConfigMap(namespace, configMapBody, null, null, null) + api.createNamespacedConfigMap(namespace, configMapBody, null, null, null, null) logger.info("Created configmap $configMapName") } val podBody = V1Pod { @@ -105,15 +105,15 @@ class K8sShellHandler( restartPolicy = "Never" } } - api.createNamespacedPod(namespace, podBody, null, null, null) + api.createNamespacedPod(namespace, podBody, null, null, null, null) logger.info("Created pod $podName") createdPod = true - var pod = api.exec { api.readNamespacedPod(podName, namespace, null, null, null) } + var pod = api.exec { api.readNamespacedPod(podName, namespace, null) } var status = pod?.status?.phase.orEmpty() logger.info("Pod status: $status") while (pod != null && (status == "Running" || status == "Pending")) { Thread.sleep(1000) - pod = api.exec { api.readNamespacedPod(podName, namespace, null, null, null) } + pod = api.exec { api.readNamespacedPod(podName, namespace, null) } status = pod?.status?.phase.orEmpty() } logger.info("Pod status: $status") diff --git a/devops-boot-project/devops-boot-core/devops-utils/src/main/kotlin/com/tencent/devops/utils/jackson/JsonUtils.kt b/devops-boot-project/devops-boot-core/devops-utils/src/main/kotlin/com/tencent/devops/utils/jackson/JsonUtils.kt index 52acba7..2376ced 100644 --- a/devops-boot-project/devops-boot-core/devops-utils/src/main/kotlin/com/tencent/devops/utils/jackson/JsonUtils.kt +++ b/devops-boot-project/devops-boot-core/devops-utils/src/main/kotlin/com/tencent/devops/utils/jackson/JsonUtils.kt @@ -15,7 +15,7 @@ import java.io.InputStream */ object JsonUtils { val objectMapper = ObjectMapper().apply { - registerModule(KotlinModule()) + registerModule(KotlinModule.Builder().build()) registerModule(JavaTimeModule()) registerModule(ParameterNamesModule()) registerModule(Jdk8Module()) diff --git a/devops-boot-sample/api-kotlin-sample/src/main/kotlin/com/tencent/devops/sample/client/SampleClient.kt b/devops-boot-sample/api-kotlin-sample/src/main/kotlin/com/tencent/devops/sample/client/SampleClient.kt index 3c3a5ce..a111787 100644 --- a/devops-boot-sample/api-kotlin-sample/src/main/kotlin/com/tencent/devops/sample/client/SampleClient.kt +++ b/devops-boot-sample/api-kotlin-sample/src/main/kotlin/com/tencent/devops/sample/client/SampleClient.kt @@ -7,6 +7,7 @@ import io.swagger.v3.oas.annotations.tags.Tag import org.springframework.cloud.openfeign.FeignClient import org.springframework.context.annotation.Primary import org.springframework.web.bind.annotation.GetMapping +import org.springframework.web.bind.annotation.RequestMapping /** * Sample FeignClient diff --git a/devops-boot-sample/gradle.properties b/devops-boot-sample/gradle.properties index e69de29..777bcc3 100644 --- a/devops-boot-sample/gradle.properties +++ b/devops-boot-sample/gradle.properties @@ -0,0 +1 @@ +kotlin.internal.mpp12x.deprecation.suppress=true \ No newline at end of file