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

fix(dependency): Forcing google-api-services-storage and google-auth-library-oauth2-http version for desired conflict resolution #1103

Merged
merged 1 commit into from
Mar 9, 2022

Conversation

j-sandy
Copy link
Contributor

@j-sandy j-sandy commented Mar 9, 2022

While enforcing the direct and transitive dependencies strictly from kork-bom using "enforcedPlatform" in build.gradle as:

implementation(enforcedPlatform("io.spinnaker.kork:kork-bom:$korkVersion"))

google-api-services-storage:v1-rev141-1.25.0 and google-auth-library-oauth2-http:0.18.0 is overriding the google-api-services-storage:v1-rev20200326-1.30.9 and google-auth-library-oauth2-http:0.20.0 version, which is an older version coming from kork-bom mentioned in spinnaker-dependencies.gradle.
It is causing following errors in front50-gcs module as given below:

> Task :front50-gcs:compileTestKotlin FAILED
e: /home/ubuntu/spinnaker-comp/sb-upgrade-2-3-12/front50/front50-gcs/src/test/kotlin/com/netflix/spinnaker/front50/model/FakeStorageRpc.kt: (23, 46): Unresolved reference: HmacKey
e: /home/ubuntu/spinnaker-comp/sb-upgrade-2-3-12/front50/front50-gcs/src/test/kotlin/com/netflix/spinnaker/front50/model/FakeStorageRpc.kt: (24, 46): Unresolved reference: HmacKeyMetadata
e: /home/ubuntu/spinnaker-comp/sb-upgrade-2-3-12/front50/front50-gcs/src/test/kotlin/com/netflix/spinnaker/front50/model/FakeStorageRpc.kt: (187, 80): Unresolved reference: HmacKeyMetadata
e: /home/ubuntu/spinnaker-comp/sb-upgrade-2-3-12/front50/front50-gcs/src/test/kotlin/com/netflix/spinnaker/front50/model/FakeStorageRpc.kt: (206, 47): Unresolved reference: HmacKeyMetadata
e: /home/ubuntu/spinnaker-comp/sb-upgrade-2-3-12/front50/front50-gcs/src/test/kotlin/com/netflix/spinnaker/front50/model/FakeStorageRpc.kt: (206, 99): Unresolved reference: HmacKeyMetadata
e: /home/ubuntu/spinnaker-comp/sb-upgrade-2-3-12/front50/front50-gcs/src/test/kotlin/com/netflix/spinnaker/front50/model/FakeStorageRpc.kt: (222, 47): Unresolved reference: HmacKeyMetadata
e: /home/ubuntu/spinnaker-comp/sb-upgrade-2-3-12/front50/front50-gcs/src/test/kotlin/com/netflix/spinnaker/front50/model/FakeStorageRpc.kt: (279, 93): Unresolved reference: HmacKeyMetadata
e: /home/ubuntu/spinnaker-comp/sb-upgrade-2-3-12/front50/front50-gcs/src/test/kotlin/com/netflix/spinnaker/front50/model/FakeStorageRpc.kt: (323, 94): Unresolved reference: HmacKey

> Task :front50-gcs:test

GcsIntegrationTest > startupTest(GcsStorageService) FAILED
    java.lang.IllegalStateException: Failed to load ApplicationContext
        at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:132)
        at org.springframework.test.context.support.DefaultTestContext.getApplicationContext(DefaultTestContext.java:123)
        Caused by:
        org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'googleCloudStorage' defined in com.netflix.spinnaker.front50.config.GcsConfig: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.google.cloud.storage.Storage]: Factory method 'googleCloudStorage' threw exception; nested exception is java.lang.NoClassDefFoundError: com/google/auth/oauth2/QuotaProjectIdProvider
            Caused by:
            org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.google.cloud.storage.Storage]: Factory method 'googleCloudStorage' threw exception; nested exception is java.lang.NoClassDefFoundError: com/google/auth/oauth2/QuotaProjectIdProvider
                at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:185)
                Caused by:
                java.lang.NoClassDefFoundError: com/google/auth/oauth2/QuotaProjectIdProvider
                    at com.google.cloud.ServiceOptions$Builder.setCredentials(ServiceOptions.java:220)
                    at com.netflix.spinnaker.front50.config.GcsConfig.googleCloudStorage(GcsConfig.java:130)
                    at com.netflix.spinnaker.front50.config.GcsConfig$$EnhancerBySpringCGLIB$$ea6e0ac7.CGLIB$googleCloudStorage$1(<generated>)

In order to fix, we require google-api-services-storage:v1-rev20200326-1.30.9 and google-auth-library-oauth2-http:0.20.0 to force restore.
Forcing the specified version will take precedence during conflict resolution and provide desired version.

…library-oauth2-http version for desired conflict resolution

While enforcing the direct and transitive dependencies strictly from kork-bom using "enforcedPlatform" in build.gradle as:

implementation(enforcedPlatform("io.spinnaker.kork:kork-bom:$korkVersion"))

google-api-services-storage:v1-rev141-1.25.0 and google-auth-library-oauth2-http:0.18.0 is overriding the google-api-services-storage:v1-rev20200326-1.30.9 and google-auth-library-oauth2-http:0.20.0 version, which is an older version coming from kork-bom mentioned in spinnaker-dependencies.gradle.
It is causing following errors in front50-gcs module as given below:

> Task :front50-gcs:compileTestKotlin FAILED
e: /home/ubuntu/spinnaker-comp/sb-upgrade-2-3-12/front50/front50-gcs/src/test/kotlin/com/netflix/spinnaker/front50/model/FakeStorageRpc.kt: (23, 46): Unresolved reference: HmacKey
e: /home/ubuntu/spinnaker-comp/sb-upgrade-2-3-12/front50/front50-gcs/src/test/kotlin/com/netflix/spinnaker/front50/model/FakeStorageRpc.kt: (24, 46): Unresolved reference: HmacKeyMetadata
e: /home/ubuntu/spinnaker-comp/sb-upgrade-2-3-12/front50/front50-gcs/src/test/kotlin/com/netflix/spinnaker/front50/model/FakeStorageRpc.kt: (187, 80): Unresolved reference: HmacKeyMetadata
e: /home/ubuntu/spinnaker-comp/sb-upgrade-2-3-12/front50/front50-gcs/src/test/kotlin/com/netflix/spinnaker/front50/model/FakeStorageRpc.kt: (206, 47): Unresolved reference: HmacKeyMetadata
e: /home/ubuntu/spinnaker-comp/sb-upgrade-2-3-12/front50/front50-gcs/src/test/kotlin/com/netflix/spinnaker/front50/model/FakeStorageRpc.kt: (206, 99): Unresolved reference: HmacKeyMetadata
e: /home/ubuntu/spinnaker-comp/sb-upgrade-2-3-12/front50/front50-gcs/src/test/kotlin/com/netflix/spinnaker/front50/model/FakeStorageRpc.kt: (222, 47): Unresolved reference: HmacKeyMetadata
e: /home/ubuntu/spinnaker-comp/sb-upgrade-2-3-12/front50/front50-gcs/src/test/kotlin/com/netflix/spinnaker/front50/model/FakeStorageRpc.kt: (279, 93): Unresolved reference: HmacKeyMetadata
e: /home/ubuntu/spinnaker-comp/sb-upgrade-2-3-12/front50/front50-gcs/src/test/kotlin/com/netflix/spinnaker/front50/model/FakeStorageRpc.kt: (323, 94): Unresolved reference: HmacKey
---------------------
> Task :front50-gcs:test

GcsIntegrationTest > startupTest(GcsStorageService) FAILED
    java.lang.IllegalStateException: Failed to load ApplicationContext
        at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:132)
        at org.springframework.test.context.support.DefaultTestContext.getApplicationContext(DefaultTestContext.java:123)
        Caused by:
        org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'googleCloudStorage' defined in com.netflix.spinnaker.front50.config.GcsConfig: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.google.cloud.storage.Storage]: Factory method 'googleCloudStorage' threw exception; nested exception is java.lang.NoClassDefFoundError: com/google/auth/oauth2/QuotaProjectIdProvider
            Caused by:
            org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.google.cloud.storage.Storage]: Factory method 'googleCloudStorage' threw exception; nested exception is java.lang.NoClassDefFoundError: com/google/auth/oauth2/QuotaProjectIdProvider
                at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:185)
                Caused by:
                java.lang.NoClassDefFoundError: com/google/auth/oauth2/QuotaProjectIdProvider
                    at com.google.cloud.ServiceOptions$Builder.setCredentials(ServiceOptions.java:220)
                    at com.netflix.spinnaker.front50.config.GcsConfig.googleCloudStorage(GcsConfig.java:130)
                    at com.netflix.spinnaker.front50.config.GcsConfig$$EnhancerBySpringCGLIB$$ea6e0ac7.CGLIB$googleCloudStorage$1(<generated>)

In order to fix, we require google-api-services-storage:v1-rev20200326-1.30.9 and google-auth-library-oauth2-http:0.20.0 to force restore.
Forcing the specified version will take precedence during conflict resolution and provide desired version.
@j-sandy
Copy link
Contributor Author

j-sandy commented Mar 9, 2022

Before applying enforcedPlatform closure:

$ ./gradlew front50-gcs:dI --dependency google-auth-library-oauth2-http --configuration testRuntimeClasspath

> Task :front50-gcs:dependencyInsight
com.google.auth:google-auth-library-oauth2-http:0.20.0
   variant "runtime" [
      org.gradle.status                  = release (not requested)
      org.gradle.usage                   = java-runtime
      org.gradle.libraryelements         = jar
      org.gradle.category                = library

      Requested attributes not found in the selected variant:
         org.gradle.dependency.bundling     = external
         org.jetbrains.kotlin.platform.type = jvm
         org.gradle.jvm.version             = 11
   ]
   Selection reasons:
      - By constraint
      - By conflict resolution : between versions 0.20.0 and 0.18.0

com.google.auth:google-auth-library-oauth2-http:0.20.0
+--- com.google.api:gax:1.56.0
|    +--- io.spinnaker.kork:kork-bom:7.132.0 (requested com.google.api:gax:1.54.0)
|    |    +--- testRuntimeClasspath
|    |    +--- project :front50-core
|    |    |    \--- testRuntimeClasspath
|    |    \--- project :front50-api
|    |         +--- testRuntimeClasspath
|    |         \--- project :front50-core (*)
|    +--- com.google.cloud:google-cloud-storage:1.108.0
|    |    +--- testRuntimeClasspath
|    |    \--- io.spinnaker.kork:kork-bom:7.132.0 (requested com.google.cloud:google-cloud-storage:1.104.0) (*)
|    +--- com.google.cloud:google-cloud-core-http:1.93.4
|    |    +--- io.spinnaker.kork:kork-bom:7.132.0 (requested com.google.cloud:google-cloud-core-http:1.93.0) (*)
|    |    \--- com.google.cloud:google-cloud-storage:1.108.0 (*)
|    +--- com.google.cloud:google-cloud-core:1.93.4
|    |    +--- testRuntimeClasspath (requested com.google.cloud:google-cloud-core)
|    |    +--- io.spinnaker.kork:kork-bom:7.132.0 (requested com.google.cloud:google-cloud-core:1.93.0) (*)
|    |    +--- com.google.cloud:google-cloud-storage:1.108.0 (*)
|    |    \--- com.google.cloud:google-cloud-core-http:1.93.4 (*)
|    \--- com.google.api:gax-httpjson:0.73.0
|         +--- io.spinnaker.kork:kork-bom:7.132.0 (requested com.google.api:gax-httpjson:0.71.0) (*)
|         \--- com.google.cloud:google-cloud-core-http:1.93.4 (*)
+--- com.google.api:gax-httpjson:0.73.0 (*)
+--- com.google.cloud:google-cloud-core:1.93.4 (*)
+--- com.google.cloud:google-cloud-core-http:1.93.4 (*)
\--- com.google.cloud:google-cloud-storage:1.108.0 (*)

com.google.auth:google-auth-library-oauth2-http -> 0.20.0
\--- testRuntimeClasspath

com.google.auth:google-auth-library-oauth2-http:0.18.0 -> 0.20.0
\--- io.spinnaker.kork:kork-bom:7.132.0
     +--- testRuntimeClasspath
     +--- project :front50-core
     |    \--- testRuntimeClasspath
     \--- project :front50-api
          +--- testRuntimeClasspath
          \--- project :front50-core (*)

$ ./gradlew front50-gcs:dI --dependency google-api-services-storage --configuration testRuntimeClasspath
Starting a Gradle Daemon, 1 busy Daemon could not be reused, use --status for details

> Task :front50-gcs:dependencyInsight
com.google.apis:google-api-services-storage:v1-rev20200326-1.30.9
   variant "runtime" [
      org.gradle.status                  = release (not requested)
      org.gradle.usage                   = java-runtime
      org.gradle.libraryelements         = jar
      org.gradle.category                = library

      Requested attributes not found in the selected variant:
         org.gradle.dependency.bundling     = external
         org.jetbrains.kotlin.platform.type = jvm
         org.gradle.jvm.version             = 11
   ]
   Selection reasons:
      - By constraint
      - By conflict resolution : between versions v1-rev141-1.25.0 and v1-rev20200326-1.30.9

com.google.apis:google-api-services-storage:v1-rev20200326-1.30.9
\--- com.google.cloud:google-cloud-storage:1.108.0
     +--- testRuntimeClasspath
     \--- io.spinnaker.kork:kork-bom:7.132.0 (requested com.google.cloud:google-cloud-storage:1.104.0)
          +--- testRuntimeClasspath
          +--- project :front50-core
          |    \--- testRuntimeClasspath
          \--- project :front50-api
               +--- testRuntimeClasspath
               \--- project :front50-core (*)

com.google.apis:google-api-services-storage:v1-rev141-1.25.0 -> v1-rev20200326-1.30.9
\--- io.spinnaker.kork:kork-bom:7.132.0
     +--- testRuntimeClasspath
     +--- project :front50-core
     |    \--- testRuntimeClasspath
     \--- project :front50-api
          +--- testRuntimeClasspath
          \--- project :front50-core (*)

com.google.apis:google-api-services-storage -> v1-rev20200326-1.30.9
\--- testRuntimeClasspath

@j-sandy
Copy link
Contributor Author

j-sandy commented Mar 9, 2022

After applying enforcedPlatform closure:

$ ./gradlew front50-gcs:dI --dependency google-auth-library-oauth2-http --configuration testRuntimeClasspath

> Task :front50-gcs:dependencyInsight
com.google.auth:google-auth-library-oauth2-http:0.18.0
   variant "runtime" [
      org.gradle.status                  = release (not requested)
      org.gradle.usage                   = java-runtime
      org.gradle.libraryelements         = jar
      org.gradle.category                = library

      Requested attributes not found in the selected variant:
         org.gradle.dependency.bundling     = external
         org.jetbrains.kotlin.platform.type = jvm
         org.gradle.jvm.version             = 11
   ]
   Selection reasons:
      - By constraint
      - Forced

com.google.auth:google-auth-library-oauth2-http:0.18.0
\--- io.spinnaker.kork:kork-bom:7.132.0
     +--- testRuntimeClasspath
     +--- project :front50-core
     |    \--- testRuntimeClasspath
     \--- project :front50-api
          +--- testRuntimeClasspath
          \--- project :front50-core (*)

com.google.auth:google-auth-library-oauth2-http -> 0.18.0
\--- testRuntimeClasspath

com.google.auth:google-auth-library-oauth2-http:0.20.0 -> 0.18.0
+--- com.google.api:gax:1.54.0
|    +--- io.spinnaker.kork:kork-bom:7.132.0
|    |    +--- testRuntimeClasspath
|    |    +--- project :front50-core
|    |    |    \--- testRuntimeClasspath
|    |    \--- project :front50-api
|    |         +--- testRuntimeClasspath
|    |         \--- project :front50-core (*)
|    +--- com.google.cloud:google-cloud-storage:1.104.0 (requested com.google.api:gax:1.53.1)
|    |    +--- testRuntimeClasspath (requested com.google.cloud:google-cloud-storage:1.108.0)
|    |    \--- io.spinnaker.kork:kork-bom:7.132.0 (*)
|    +--- com.google.cloud:google-cloud-core-http:1.93.0
|    |    +--- io.spinnaker.kork:kork-bom:7.132.0 (*)
|    |    \--- com.google.cloud:google-cloud-storage:1.104.0 (requested com.google.cloud:google-cloud-core-http:1.92.5) (*)
|    +--- com.google.cloud:google-cloud-core:1.93.0
|    |    +--- testRuntimeClasspath (requested com.google.cloud:google-cloud-core)
|    |    +--- io.spinnaker.kork:kork-bom:7.132.0 (*)
|    |    +--- com.google.cloud:google-cloud-storage:1.104.0 (requested com.google.cloud:google-cloud-core:1.92.5) (*)
|    |    \--- com.google.cloud:google-cloud-core-http:1.93.0 (*)
|    \--- com.google.api:gax-httpjson:0.71.0
|         +--- io.spinnaker.kork:kork-bom:7.132.0 (*)
|         \--- com.google.cloud:google-cloud-core-http:1.93.0 (*)
+--- com.google.api:gax-httpjson:0.71.0 (*)
+--- com.google.cloud:google-cloud-core:1.93.0 (*)
+--- com.google.cloud:google-cloud-core-http:1.93.0 (*)
\--- com.google.cloud:google-cloud-storage:1.104.0 (*)

$ ./gradlew front50-gcs:dI --dependency google-api-services-storage --configuration testRuntimeClasspath

> Task :front50-gcs:dependencyInsight
com.google.apis:google-api-services-storage:v1-rev141-1.25.0
   variant "runtime" [
      org.gradle.status                  = release (not requested)
      org.gradle.usage                   = java-runtime
      org.gradle.libraryelements         = jar
      org.gradle.category                = library

      Requested attributes not found in the selected variant:
         org.gradle.dependency.bundling     = external
         org.jetbrains.kotlin.platform.type = jvm
         org.gradle.jvm.version             = 11
   ]
   Selection reasons:
      - By constraint
      - Forced

com.google.apis:google-api-services-storage:v1-rev141-1.25.0
\--- io.spinnaker.kork:kork-bom:7.132.0
     +--- testRuntimeClasspath
     +--- project :front50-core
     |    \--- testRuntimeClasspath
     \--- project :front50-api
          +--- testRuntimeClasspath
          \--- project :front50-core (*)

com.google.apis:google-api-services-storage:v1-rev20191011-1.30.3 -> v1-rev141-1.25.0
\--- com.google.cloud:google-cloud-storage:1.104.0
     +--- testRuntimeClasspath (requested com.google.cloud:google-cloud-storage:1.108.0)
     \--- io.spinnaker.kork:kork-bom:7.132.0
          +--- testRuntimeClasspath
          +--- project :front50-core
          |    \--- testRuntimeClasspath
          \--- project :front50-api
               +--- testRuntimeClasspath
               \--- project :front50-core (*)

com.google.apis:google-api-services-storage -> v1-rev141-1.25.0
\--- testRuntimeClasspath

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
3 participants