Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OP-21802 Upgrade springfox to springdoc & upgrade mysql connector #94

Merged
merged 2 commits into from
Jun 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cats/cats-sql/cats-sql.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
2 changes: 1 addition & 1 deletion clouddriver-artifacts/clouddriver-artifacts.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion clouddriver-ecs/clouddriver-ecs.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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") {
Expand Down
4 changes: 3 additions & 1 deletion clouddriver-kubernetes/clouddriver-kubernetes.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down Expand Up @@ -116,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"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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<String, Object> 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<String, Object> results =
kubernetesJobProvider.getFileContentsFromPod(account, namespace, podName, fileName);

Expand Down
2 changes: 1 addition & 1 deletion clouddriver-sql-mysql/clouddriver-sql-mysql.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
2 changes: 1 addition & 1 deletion clouddriver-sql/clouddriver-sql.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
1 change: 1 addition & 0 deletions clouddriver-web/clouddriver-web.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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<JobStatus> jobMatches = jobProviders.findResults {
return it.collectJob(account, location, id)
Expand All @@ -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<String, Object> 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<Map<String, Object>> results = jobProviders.findResults {
it.getFileContents(account, location, id, fileName)
Expand Down
Loading