From 292550027fe43bd361eaa4a94a55ec6a96dcb037 Mon Sep 17 00:00:00 2001 From: aman-agrawal <9412470@gmail.com> Date: Thu, 13 Jun 2024 13:06:12 +0530 Subject: [PATCH 1/2] OP-21802 Upgrade springfox to springdoc --- .../clouddriver-kubernetes.gradle | 2 ++ .../kubernetes/controllers/PodController.java | 23 +++++++----- clouddriver-web/clouddriver-web.gradle | 1 + .../controllers/JobController.groovy | 36 +++++++++---------- 4 files changed, 36 insertions(+), 26 deletions(-) diff --git a/clouddriver-kubernetes/clouddriver-kubernetes.gradle b/clouddriver-kubernetes/clouddriver-kubernetes.gradle index fa1990fd7fb..d488c5f3305 100644 --- a/clouddriver-kubernetes/clouddriver-kubernetes.gradle +++ b/clouddriver-kubernetes/clouddriver-kubernetes.gradle @@ -81,6 +81,8 @@ dependencies { implementation "io.spinnaker.kork:kork-moniker" implementation "io.spinnaker.kork:kork-secrets" implementation "io.spinnaker.kork:kork-security" + implementation "io.spinnaker.kork:kork-swagger" + implementation ("io.kubernetes:client-java:17.0.2") { force = true } diff --git a/clouddriver-kubernetes/src/main/java/com/netflix/spinnaker/clouddriver/kubernetes/controllers/PodController.java b/clouddriver-kubernetes/src/main/java/com/netflix/spinnaker/clouddriver/kubernetes/controllers/PodController.java index a302065911e..0d487a1c39a 100644 --- a/clouddriver-kubernetes/src/main/java/com/netflix/spinnaker/clouddriver/kubernetes/controllers/PodController.java +++ b/clouddriver-kubernetes/src/main/java/com/netflix/spinnaker/clouddriver/kubernetes/controllers/PodController.java @@ -17,8 +17,8 @@ package com.netflix.spinnaker.clouddriver.kubernetes.controllers; import com.netflix.spinnaker.clouddriver.kubernetes.provider.view.KubernetesJobProvider; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; import java.util.Collections; import java.util.Map; import org.springframework.security.access.prepost.PreAuthorize; @@ -38,18 +38,25 @@ public PodController(KubernetesJobProvider jobProvider) { @PreAuthorize( "hasPermission(#application, 'APPLICATION', 'READ') and hasPermission(#account, 'ACCOUNT', 'READ')") - @ApiOperation(value = "Collect a file from a pod", notes = "Collects the file result of a pod.") + @Operation( + summary = "Collect a file from a pod", + description = "Collects the file result of a pod.") @RequestMapping( value = "/{account}/{namespace}/{podName}/{fileName:.+}", method = RequestMethod.GET) Map getFileContents( - @ApiParam(value = "Application name", required = true) @PathVariable String application, - @ApiParam(value = "Account job was created by", required = true) @PathVariable String account, - @ApiParam(value = "Namespace in which the pod is running in", required = true) @PathVariable + @Parameter(description = "Application name", required = true) @PathVariable + String application, + @Parameter(description = "Account job was created by", required = true) @PathVariable + String account, + @Parameter(description = "Namespace in which the pod is running in", required = true) + @PathVariable String namespace, - @ApiParam(value = "Unique identifier of pod being looked up", required = true) @PathVariable + @Parameter(description = "Unique identifier of pod being looked up", required = true) + @PathVariable String podName, - @ApiParam(value = "File name to look up", required = true) @PathVariable String fileName) { + @Parameter(description = "File name to look up", required = true) @PathVariable + String fileName) { Map results = kubernetesJobProvider.getFileContentsFromPod(account, namespace, podName, fileName); diff --git a/clouddriver-web/clouddriver-web.gradle b/clouddriver-web/clouddriver-web.gradle index cdaabfb41d1..91c0e4a3765 100644 --- a/clouddriver-web/clouddriver-web.gradle +++ b/clouddriver-web/clouddriver-web.gradle @@ -34,6 +34,7 @@ dependencies { implementation "io.spinnaker.kork:kork-web" implementation("io.spinnaker.kork:kork-plugins") implementation "io.spinnaker.kork:kork-moniker" + implementation "io.spinnaker.kork:kork-swagger" implementation "commons-io:commons-io" implementation "io.reactivex.rxjava3:rxjava:3.1.6" implementation "io.swagger:swagger-annotations:1.5.20" diff --git a/clouddriver-web/src/main/groovy/com/netflix/spinnaker/clouddriver/controllers/JobController.groovy b/clouddriver-web/src/main/groovy/com/netflix/spinnaker/clouddriver/controllers/JobController.groovy index 9b898d175c4..986929b4d27 100644 --- a/clouddriver-web/src/main/groovy/com/netflix/spinnaker/clouddriver/controllers/JobController.groovy +++ b/clouddriver-web/src/main/groovy/com/netflix/spinnaker/clouddriver/controllers/JobController.groovy @@ -19,8 +19,8 @@ package com.netflix.spinnaker.clouddriver.controllers import com.netflix.spinnaker.clouddriver.model.JobProvider import com.netflix.spinnaker.clouddriver.model.JobStatus import com.netflix.spinnaker.kork.web.exceptions.NotFoundException -import io.swagger.annotations.ApiOperation -import io.swagger.annotations.ApiParam +import io.swagger.v3.oas.annotations.Operation +import io.swagger.v3.oas.annotations.Parameter import org.springframework.beans.factory.annotation.Autowired import org.springframework.context.MessageSource import org.springframework.security.access.prepost.PreAuthorize @@ -42,12 +42,12 @@ class JobController { MessageSource messageSource @PreAuthorize("hasPermission(#application, 'APPLICATION', 'READ') and hasPermission(#account, 'ACCOUNT', 'READ')") - @ApiOperation(value = "Collect a JobStatus", notes = "Collects the output of the job.") + @Operation(summary = "Collect a JobStatus", description = "Collects the output of the job.") @RequestMapping(value = "/{account}/{location}/{id:.+}", method = RequestMethod.GET) - JobStatus collectJob(@ApiParam(value = "Application name", required = true) @PathVariable String application, - @ApiParam(value = "Account job was created by", required = true) @PathVariable String account, - @ApiParam(value = "Namespace, region, or zone job is running in", required = true) @PathVariable String location, - @ApiParam(value = "Unique identifier of job being looked up", required = true) @PathVariable String id) { + JobStatus collectJob(@Parameter(description = "Application name", required = true) @PathVariable String application, + @Parameter(description = "Account job was created by", required = true) @PathVariable String account, + @Parameter(description = "Namespace, region, or zone job is running in", required = true) @PathVariable String location, + @Parameter(description = "Unique identifier of job being looked up", required = true) @PathVariable String id) { Authentication auth = SecurityContextHolder.getContext().getAuthentication(); Collection jobMatches = jobProviders.findResults { return it.collectJob(account, location, id) @@ -59,26 +59,26 @@ class JobController { } @PreAuthorize("hasPermission(#application, 'APPLICATION', 'EXECUTE') and hasPermission(#account, 'ACCOUNT', 'WRITE')") - @ApiOperation(value = "Cancel a Job", notes = "Cancels the job.") + @Operation(summary = "Cancel a Job", description = "Cancels the job.") @RequestMapping(value = "/{account}/{location}/{id:.+}", method = RequestMethod.DELETE) - void cancelJob(@ApiParam(value = "Application name", required = true) @PathVariable String application, - @ApiParam(value = "Account job is running in", required = true) @PathVariable String account, - @ApiParam(value = "Namespace, region, or zone job is running in", required = true) @PathVariable String location, - @ApiParam(value = "Unique identifier of job to be canceled", required = true) @PathVariable String id) { + void cancelJob(@Parameter(description = "Application name", required = true) @PathVariable String application, + @Parameter(description = "Account job is running in", required = true) @PathVariable String account, + @Parameter(description = "Namespace, region, or zone job is running in", required = true) @PathVariable String location, + @Parameter(description = "Unique identifier of job to be canceled", required = true) @PathVariable String id) { jobProviders.forEach { it.cancelJob(account, location, id) } } @PreAuthorize("hasPermission(#application, 'APPLICATION', 'READ') and hasPermission(#account, 'ACCOUNT', 'READ')") - @ApiOperation(value = "Collect a file from a job", notes = "Collects the file result of a job.") + @Operation(summary = "Collect a file from a job", description = "Collects the file result of a job.") @RequestMapping(value = "/{account}/{location}/{id}/{fileName:.+}", method = RequestMethod.GET) Map getFileContents( - @ApiParam(value = "Application name", required = true) @PathVariable String application, - @ApiParam(value = "Account job was created by", required = true) @PathVariable String account, - @ApiParam(value = "Namespace, region, or zone job is running in", required = true) @PathVariable String location, - @ApiParam(value = "Unique identifier of job being looked up", required = true) @PathVariable String id, - @ApiParam(value = "File name to look up", required = true) @PathVariable String fileName + @Parameter(description = "Application name", required = true) @PathVariable String application, + @Parameter(description = "Account job was created by", required = true) @PathVariable String account, + @Parameter(description = "Namespace, region, or zone job is running in", required = true) @PathVariable String location, + @Parameter(description = "Unique identifier of job being looked up", required = true) @PathVariable String id, + @Parameter(description = "File name to look up", required = true) @PathVariable String fileName ) { Collection> results = jobProviders.findResults { it.getFileContents(account, location, id, fileName) From 838f2444a6773a45b718e2cae1443ce59d496d82 Mon Sep 17 00:00:00 2001 From: aman-agrawal <9412470@gmail.com> Date: Mon, 3 Jun 2024 13:35:10 +0530 Subject: [PATCH 2/2] refactor(mysql): update mysql connector coordinate --- cats/cats-sql/cats-sql.gradle | 2 +- clouddriver-artifacts/clouddriver-artifacts.gradle | 2 +- clouddriver-ecs/clouddriver-ecs.gradle | 2 +- clouddriver-kubernetes/clouddriver-kubernetes.gradle | 2 +- clouddriver-sql-mysql/clouddriver-sql-mysql.gradle | 2 +- clouddriver-sql/clouddriver-sql.gradle | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/cats/cats-sql/cats-sql.gradle b/cats/cats-sql/cats-sql.gradle index 489fa39f8a4..4966140211e 100644 --- a/cats/cats-sql/cats-sql.gradle +++ b/cats/cats-sql/cats-sql.gradle @@ -59,6 +59,6 @@ dependencies { testImplementation "org.springframework:spring-test" testImplementation "org.testcontainers:mysql" testImplementation "org.testcontainers:postgresql" - testImplementation "mysql:mysql-connector-java" + testImplementation "com.mysql:mysql-connector-j" testImplementation "org.postgresql:postgresql" } diff --git a/clouddriver-artifacts/clouddriver-artifacts.gradle b/clouddriver-artifacts/clouddriver-artifacts.gradle index f145b3961bf..7d61105983d 100644 --- a/clouddriver-artifacts/clouddriver-artifacts.gradle +++ b/clouddriver-artifacts/clouddriver-artifacts.gradle @@ -73,7 +73,7 @@ dependencies { integrationImplementation "org.testcontainers:testcontainers" integrationImplementation "org.testcontainers:mysql" integrationImplementation "org.testcontainers:junit-jupiter" - integrationImplementation "mysql:mysql-connector-java" + integrationImplementation "com.mysql:mysql-connector-j" integrationImplementation ("io.rest-assured:rest-assured:4.0.0") { // Exclude groovy pulled in by rest-assured, so we use kork's version exclude group: "org.apache.groovy", module: "groovy" diff --git a/clouddriver-ecs/clouddriver-ecs.gradle b/clouddriver-ecs/clouddriver-ecs.gradle index 71af0f61903..913155dd155 100644 --- a/clouddriver-ecs/clouddriver-ecs.gradle +++ b/clouddriver-ecs/clouddriver-ecs.gradle @@ -57,7 +57,7 @@ dependencies { integrationImplementation project(":clouddriver-web") integrationImplementation "org.springframework:spring-test" integrationImplementation "org.testcontainers:mysql" - integrationImplementation "mysql:mysql-connector-java" + integrationImplementation "com.mysql:mysql-connector-j" integrationImplementation sourceSets.test.output integrationImplementation sourceSets.main.output integrationImplementation ("io.rest-assured:rest-assured:4.0.0") { diff --git a/clouddriver-kubernetes/clouddriver-kubernetes.gradle b/clouddriver-kubernetes/clouddriver-kubernetes.gradle index d488c5f3305..18f17848dd4 100644 --- a/clouddriver-kubernetes/clouddriver-kubernetes.gradle +++ b/clouddriver-kubernetes/clouddriver-kubernetes.gradle @@ -118,7 +118,7 @@ dependencies { integrationImplementation "org.testcontainers:testcontainers" integrationImplementation "org.testcontainers:mysql" integrationImplementation "org.testcontainers:junit-jupiter" - integrationImplementation "mysql:mysql-connector-java" + integrationImplementation "com.mysql:mysql-connector-j" integrationImplementation ("io.rest-assured:rest-assured:4.0.0") integrationImplementation "org.yaml:snakeyaml" } diff --git a/clouddriver-sql-mysql/clouddriver-sql-mysql.gradle b/clouddriver-sql-mysql/clouddriver-sql-mysql.gradle index 791ecc36413..a324aa2923a 100644 --- a/clouddriver-sql-mysql/clouddriver-sql-mysql.gradle +++ b/clouddriver-sql-mysql/clouddriver-sql-mysql.gradle @@ -2,5 +2,5 @@ dependencies { implementation project(":cats:cats-sql") implementation project(":clouddriver-sql") - runtimeOnly "mysql:mysql-connector-java" + runtimeOnly "com.mysql:mysql-connector-j" } diff --git a/clouddriver-sql/clouddriver-sql.gradle b/clouddriver-sql/clouddriver-sql.gradle index 9bb01ae5146..523ff685d47 100644 --- a/clouddriver-sql/clouddriver-sql.gradle +++ b/clouddriver-sql/clouddriver-sql.gradle @@ -38,7 +38,7 @@ dependencies { testImplementation "io.spinnaker.kork:kork-sql-test" testImplementation "org.testcontainers:mysql" - testImplementation "mysql:mysql-connector-java" + testImplementation "com.mysql:mysql-connector-j" testImplementation "cglib:cglib-nodep" testImplementation "org.objenesis:objenesis"