From 4ea6ebb3497ea62979dfd972c6a50fe9ff26b2f5 Mon Sep 17 00:00:00 2001 From: spinnakerbot Date: Tue, 11 Jun 2024 23:57:15 -0400 Subject: [PATCH] chore(dependencies): Autobump korkVersion (#1165) * chore(dependencies): Autobump korkVersion * refactor(mysql): update mysql connector coordinate during upgrade to spring boot 2.7.x In spring boot 2.7.8 onwards mysql connector coordinate `mysql:mysql-connector-java` has been removed and only `com.mysql:mysql-connector-j` coordinate exist. https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-2.7-Release-Notes#mysql-jdbc-driver So, updating the mysql connector coordinate as `com.mysql:mysql-connector-j` with spring boot upgrade to 2.7.18. https://repo1.maven.org/maven2/org/springframework/boot/spring-boot-dependencies/2.7.18/spring-boot-dependencies-2.7.18.pom * refactor(dependency): add explicit dependency of slf4j-api in fiat-ldap module during upgrade to spring boot 2.7.x While upgrading spring boot 2.7.18, encounter below error during compilation of fiat-ldap module: ``` > Task :fiat-ldap:compileJava FAILED /fiat/fiat-ldap/src/main/java/com/netflix/spinnaker/fiat/roles/ldap/LdapUserRolesProvider.java:54: error: package org.slf4j does not exist @Slf4j ^ 1 error ``` The root cause is the removal of `slf4j-api` transitive dependency from org.springframework.ldap:spring-ldap-core:2.4.1 (via. org.springframework.security:spring-security-ldap:5.7.11, which is part of spring boot 2.7.18). So, adding the dependency explicitly. Before: ``` $ ./gradlew fiat-ldap:dI --dependency slf4j-api > Task :fiat-ldap:dependencyInsight org.slf4j:slf4j-api:1.7.36 Variant compile: | Attribute Name | Provided | Requested | |--------------------------------|----------|-------------------| | org.gradle.status | release | | | org.gradle.category | library | library | | org.gradle.libraryelements | jar | classes+resources | | org.gradle.usage | java-api | java-api | | org.gradle.dependency.bundling | | external | | org.gradle.jvm.environment | | standard-jvm | | org.gradle.jvm.version | | 11 | Selection reasons: - By constraint - Forced org.slf4j:slf4j-api:1.7.36 \--- io.spinnaker.kork:kork-bom:7.227.0 \--- compileClasspath org.slf4j:slf4j-api:1.7.32 -> 1.7.36 \--- org.springframework.ldap:spring-ldap-core:2.3.8.RELEASE +--- io.spinnaker.kork:kork-bom:7.227.0 | \--- compileClasspath \--- org.springframework.security:spring-security-ldap:5.6.10 +--- compileClasspath (requested org.springframework.security:spring-security-ldap) \--- io.spinnaker.kork:kork-bom:7.227.0 (*) ``` After: ``` $ ./gradlew fiat-ldap:dI --dependency slf4j-api > Task :fiat-ldap:dependencyInsight org.slf4j:slf4j-api:1.7.36 Variant compile: | Attribute Name | Provided | Requested | |--------------------------------|----------|-------------------| | org.gradle.status | release | | | org.gradle.category | library | library | | org.gradle.libraryelements | jar | classes+resources | | org.gradle.usage | java-api | java-api | | org.gradle.dependency.bundling | | external | | org.gradle.jvm.environment | | standard-jvm | | org.gradle.jvm.version | | 11 | Selection reasons: - By constraint - Forced org.slf4j:slf4j-api:1.7.36 \--- io.spinnaker.kork:kork-bom:sb2718-SNAPSHOT \--- compileClasspath org.slf4j:slf4j-api -> 1.7.36 \--- compileClasspath ``` * refactor(tests): replace HashSet.Of() and HashMap.Of() with inherited static methods from its interfaces during upgrade to spring boot 2.7.x While upgrading spring boot 2.7.18, encounter below errors during test compilation of fiat-roles module: ``` No signature of method: static java.util.HashSet.of() is applicable for argument types: (com.netflix.spinnaker.fiat.model.resources.Role) values: [Role(resourceType=role, name=role1, source=null)] Possible solutions: is(java.lang.Object), max(), any(), sort(), sum(), min() groovy.lang.MissingMethodException: No signature of method: static java.util.HashSet.of() is applicable for argument types: (com.netflix.spinnaker.fiat.model.resources.Role) values: [Role(resourceType=role, name=role1, source=null)] Possible solutions: is(java.lang.Object), max(), any(), sort(), sum(), min() at com.netflix.spinnaker.fiat.permissions.DefaultPermissionsResolverSpec.should resolve resources for users and service accounts(DefaultPermissionsResolverSpec.groovy:343) ``` ``` No signature of method: static java.util.HashMap.of() is applicable for argument types: (String, String, String, String) values: [foo, bar, xyz, pqr] Possible solutions: any(), sort(), notify(), wait(), size(), clone() groovy.lang.MissingMethodException: No signature of method: static java.util.HashMap.of() is applicable for argument types: (String, String, String, String) values: [foo, bar, xyz, pqr] Possible solutions: any(), sort(), notify(), wait(), size(), clone() at com.netflix.spinnaker.fiat.providers.DefaultApplicationProviderSpec.enable calling Clouddriver during application load based on config(DefaultApplicationProviderSpec.groovy:170) ``` ``` No signature of method: static java.util.HashMap.of() is applicable for argument types: (String, String, String, String) values: [foo, bar, xyz, pqr] Possible solutions: any(), sort(), notify(), wait(), size(), clone() groovy.lang.MissingMethodException: No signature of method: static java.util.HashMap.of() is applicable for argument types: (String, String, String, String) values: [foo, bar, xyz, pqr] Possible solutions: any(), sort(), notify(), wait(), size(), clone() at com.netflix.spinnaker.fiat.providers.DefaultApplicationProviderSpec.should suppress details when loading all applications(DefaultApplicationProviderSpec.groovy:227) ``` Spring boot 2.7.18 brings groovy 3.0.19 as transitive dependency. The root cause of the issue is a breaking change introduced from groovy 3.0.18 onwards, that allows a Java class to inherit static methods from its interface. To fix these issues replacing the HashSet.Of() and HashMap.Of() with Set.Of() and Map.Of(). http://groovy-lang.org/changelogs/changelog-3.0.18.html https://issues.apache.org/jira/browse/GROOVY-8164 Before: ``` $ ./gradlew fiat-roles:dI --dependency org.codehaus.groovy --configuration testCompileClasspath > Task :fiat-roles:dependencyInsight org.codehaus.groovy:groovy:3.0.17 Variant compile: | Attribute Name | Provided | Requested | |--------------------------------|----------|-------------------| | org.gradle.status | release | | | org.gradle.category | library | library | | org.gradle.libraryelements | jar | classes+resources | | org.gradle.usage | java-api | java-api | | org.gradle.dependency.bundling | | external | | org.gradle.jvm.environment | | standard-jvm | | org.gradle.jvm.version | | 11 | Selection reasons: - By constraint - Forced org.codehaus.groovy:groovy:3.0.17 \--- io.spinnaker.kork:kork-bom:7.227.0 \--- testCompileClasspath org.codehaus.groovy:groovy:3.0.8 -> 3.0.17 +--- org.spockframework:spock-core:2.0-groovy-3.0 | +--- testCompileClasspath (requested org.spockframework:spock-core) | +--- io.spinnaker.kork:kork-bom:7.227.0 | | \--- testCompileClasspath | \--- org.spockframework:spock-spring:2.0-groovy-3.0 | +--- testCompileClasspath (requested org.spockframework:spock-spring) | \--- io.spinnaker.kork:kork-bom:7.227.0 (*) \--- org.spockframework:spock-spring:2.0-groovy-3.0 (*) ``` After: ``` $ ./gradlew fiat-roles:dI --dependency org.codehaus.groovy --configuration testCompileClasspath > Task :fiat-roles:dependencyInsight org.codehaus.groovy:groovy:3.0.19 Variant compile: | Attribute Name | Provided | Requested | |--------------------------------|----------|-------------------| | org.gradle.status | release | | | org.gradle.category | library | library | | org.gradle.libraryelements | jar | classes+resources | | org.gradle.usage | java-api | java-api | | org.gradle.dependency.bundling | | external | | org.gradle.jvm.environment | | standard-jvm | | org.gradle.jvm.version | | 11 | Selection reasons: - By constraint - Forced org.codehaus.groovy:groovy:3.0.19 \--- io.spinnaker.kork:kork-bom:sb2718-SNAPSHOT \--- testCompileClasspath org.codehaus.groovy:groovy:3.0.8 -> 3.0.19 +--- org.spockframework:spock-core:2.0-groovy-3.0 | +--- testCompileClasspath (requested org.spockframework:spock-core) | +--- io.spinnaker.kork:kork-bom:sb2718-SNAPSHOT | | \--- testCompileClasspath | \--- org.spockframework:spock-spring:2.0-groovy-3.0 | +--- testCompileClasspath (requested org.spockframework:spock-spring) | \--- io.spinnaker.kork:kork-bom:sb2718-SNAPSHOT (*) \--- org.spockframework:spock-spring:2.0-groovy-3.0 (*) ``` --------- Co-authored-by: root Co-authored-by: j-sandy <30489233+j-sandy@users.noreply.github.com> --- fiat-ldap/fiat-ldap.gradle | 1 + .../DefaultPermissionsResolverSpec.groovy | 8 ++++---- .../DefaultApplicationProviderSpec.groovy | 16 ++++++++-------- fiat-sql-mysql/fiat-sql-mysql.gradle | 2 +- fiat-sql/fiat-sql.gradle | 2 +- gradle.properties | 2 +- 6 files changed, 16 insertions(+), 15 deletions(-) diff --git a/fiat-ldap/fiat-ldap.gradle b/fiat-ldap/fiat-ldap.gradle index ddda357f6..db69da7de 100644 --- a/fiat-ldap/fiat-ldap.gradle +++ b/fiat-ldap/fiat-ldap.gradle @@ -22,4 +22,5 @@ dependencies { implementation "org.springframework.boot:spring-boot-autoconfigure" implementation "org.springframework.security:spring-security-ldap" implementation "com.google.guava:guava" + implementation "org.slf4j:slf4j-api" } diff --git a/fiat-roles/src/test/groovy/com/netflix/spinnaker/fiat/permissions/DefaultPermissionsResolverSpec.groovy b/fiat-roles/src/test/groovy/com/netflix/spinnaker/fiat/permissions/DefaultPermissionsResolverSpec.groovy index 33d376130..3e96302ac 100644 --- a/fiat-roles/src/test/groovy/com/netflix/spinnaker/fiat/permissions/DefaultPermissionsResolverSpec.groovy +++ b/fiat-roles/src/test/groovy/com/netflix/spinnaker/fiat/permissions/DefaultPermissionsResolverSpec.groovy @@ -340,10 +340,10 @@ class DefaultPermissionsResolverSpec extends Specification { ] when: - applicationProvider.getAllRestricted("user1", HashSet.of(role1), false) >> [testApp1].toSet() - applicationProvider.getAllRestricted("user2", HashSet.of(role1, role2), false) >> [testApp2].toSet() - applicationProvider.getAllRestricted("user3", HashSet.of(role1, roleAdmin), true) >> [testAppAdmin].toSet() - applicationProvider.getAllRestricted("abc@managed-service-accounts", HashSet.of(role1), false) >> [testApp1].toSet() + applicationProvider.getAllRestricted("user1", Set.of(role1), false) >> [testApp1].toSet() + applicationProvider.getAllRestricted("user2", Set.of(role1, role2), false) >> [testApp2].toSet() + applicationProvider.getAllRestricted("user3", Set.of(role1, roleAdmin), true) >> [testAppAdmin].toSet() + applicationProvider.getAllRestricted("abc@managed-service-accounts", Set.of(role1), false) >> [testApp1].toSet() def result = resolver.resolveResources(userToRoles) then: diff --git a/fiat-roles/src/test/groovy/com/netflix/spinnaker/fiat/providers/DefaultApplicationProviderSpec.groovy b/fiat-roles/src/test/groovy/com/netflix/spinnaker/fiat/providers/DefaultApplicationProviderSpec.groovy index be7e0bfdd..f394603dc 100644 --- a/fiat-roles/src/test/groovy/com/netflix/spinnaker/fiat/providers/DefaultApplicationProviderSpec.groovy +++ b/fiat-roles/src/test/groovy/com/netflix/spinnaker/fiat/providers/DefaultApplicationProviderSpec.groovy @@ -167,19 +167,19 @@ class DefaultApplicationProviderSpec extends Specification { setup: def front50Apps = [ new Application().setName("front50App1") - .setDetails(HashMap.of("foo", "bar", "xyz", "pqr")) + .setDetails(Map.of("foo", "bar", "xyz", "pqr")) .setPermissions(new Permissions.Builder().add(Authorization.READ, "role").build()), new Application().setName("front50App2") - .setDetails(HashMap.of("foo", "bar", "xyz", "pqr")) + .setDetails(Map.of("foo", "bar", "xyz", "pqr")) .setPermissions(new Permissions.Builder().add(Authorization.READ, "role").build()) ] def clouddriverApps = [ new Application().setName("clouddriverApp1") - .setDetails(HashMap.of("foo", "bar", "xyz", "pqr")) + .setDetails(Map.of("foo", "bar", "xyz", "pqr")) .setPermissions(new Permissions.Builder().add(Authorization.READ, "role").build()), new Application().setName("clouddriverApp2") - .setDetails(HashMap.of("foo", "bar", "xyz", "pqr")) + .setDetails(Map.of("foo", "bar", "xyz", "pqr")) .setPermissions(new Permissions.Builder().add(Authorization.READ, "role").build()) ] @@ -224,22 +224,22 @@ class DefaultApplicationProviderSpec extends Specification { setup: def testApps = [ new Application().setName("front50App1") - .setDetails(HashMap.of("foo", "bar", "xyz", "pqr")) + .setDetails(Map.of("foo", "bar", "xyz", "pqr")) .setPermissions(new Permissions.Builder().add(Authorization.READ, "role").build()), new Application().setName("front50App2") - .setDetails(HashMap.of("foo", "bar", "xyz", "pqr")) + .setDetails(Map.of("foo", "bar", "xyz", "pqr")) .setPermissions(new Permissions.Builder().add(Authorization.READ, "role").build()) ] Set expectedApps = [ new Application().setName("front50App1") - .setDetails(HashMap.of("foo", "bar", "xyz", "pqr")) + .setDetails(Map.of("foo", "bar", "xyz", "pqr")) .setPermissions(new Permissions.Builder() .add(Authorization.READ, "role") .add(Authorization.EXECUTE, "role") .build()), new Application().setName("front50App2") - .setDetails(HashMap.of("foo", "bar", "xyz", "pqr")) + .setDetails(Map.of("foo", "bar", "xyz", "pqr")) .setPermissions(new Permissions.Builder() .add(Authorization.READ, "role") .add(Authorization.EXECUTE, "role") diff --git a/fiat-sql-mysql/fiat-sql-mysql.gradle b/fiat-sql-mysql/fiat-sql-mysql.gradle index 32aaca5e7..c7b3a4bac 100644 --- a/fiat-sql-mysql/fiat-sql-mysql.gradle +++ b/fiat-sql-mysql/fiat-sql-mysql.gradle @@ -1,3 +1,3 @@ dependencies { - runtimeOnly("mysql:mysql-connector-java") + runtimeOnly("com.mysql:mysql-connector-j") } diff --git a/fiat-sql/fiat-sql.gradle b/fiat-sql/fiat-sql.gradle index 377caba75..5e7fe80d1 100644 --- a/fiat-sql/fiat-sql.gradle +++ b/fiat-sql/fiat-sql.gradle @@ -42,7 +42,7 @@ dependencies { testImplementation "dev.minutest:minutest" testImplementation "org.junit.jupiter:junit-jupiter-api" - testImplementation "mysql:mysql-connector-java" + testImplementation "com.mysql:mysql-connector-j" testImplementation "org.testcontainers:mysql" testImplementation "org.testcontainers:postgresql" diff --git a/gradle.properties b/gradle.properties index 3b98426ae..bac0e0d38 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,5 +1,5 @@ includeProviders=file,github,google-groups,ldap -korkVersion=7.229.0 +korkVersion=7.230.0 org.gradle.parallel=true spinnakerGradleVersion=8.32.1 targetJava11=true