GoogleCloudPlatform / artifact-registry-maven-tools

Apache License 2.0
22 stars 23 forks source link

Not a supported repository protocol 'artifactregistry': valid protocols are [http, https, file, gcs, s3, sftp] #58

Closed absolut-swedish closed 2 years ago

absolut-swedish commented 2 years ago

Hi,

I'm running into a "Not a supported repository protocol 'artifactregistry': valid protocols are [http, https, file, gcs, s3, sftp]" issue. I've logged in to gcloud auth application-default login, then execute gradlew build and see the above error.

My gradle.build file contains: plugins { ... id("maven-publish") id("com.google.cloud.artifactregistry.gradle-plugin") version "2.1.2" ... }

repositories { mavenCentral() maven { url "artifactregistry://us-maven.pkg.dev/lpgprj-sbo-n-lpvser-gl-01/lp-voice-libraries" } }

My environment: ./gradlew --version


Gradle 7.2

Build time: 2021-08-17 09:59:03 UTC Revision: a773786b58bb28710e3dc96c4d1a7063628952ad

Kotlin: 1.5.21 Groovy: 3.0.8 Ant: Apache Ant(TM) version 1.10.9 compiled on September 27 2020 JVM: 11.0.12 (GraalVM Community 11.0.12+6-jvmci-21.2-b08) OS: Mac OS X 11.4 x86_64

The error: ./gradlew build

Configure project : Your application has authenticated using end user credentials from Google Cloud SDK. We recommend that most server applications use service accounts instead. If your application continues to use end user credentials from Cloud SDK, you might receive a "quota exceeded" or "API not enabled" error. For more information about service accounts, see https://cloud.google.com/docs/authentication/.

FAILURE: Build failed with an exception.

Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.

You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.

See https://docs.gradle.org/7.2/userguide/command_line_interface.html#sec:command_line_warnings

There seem to be others running into a similar issue: https://stackoverflow.com/questions/65261439/google-cloud-artifact-registry-for-gradle-plugins https://githubmemory.com/repo/GoogleCloudPlatform/artifact-registry-maven-tools/issues/40

Perhaps I'm just missing something here. Any help would be greatly appreciated!

Thanks, Thor

clatko commented 2 years ago

put the google artifactregistry plugin at the top of the list and you should be good.

denis111 commented 2 years ago

It will not help. It just happened to me yesterday without any changes to code. I tried to reconfigure gcloud but it didn't help. Sometime deleting the whole ~/.gradle folder helps but in less then 1 hour it breaks again. And not only me it happend for all my teammates also without any changes to code/gradle/config. So I think there's a bug or google did something yesterday to all our accounts or everybody. There's no way to make it work at least with Application Default Credentials. If I launch it with --info I can see the error:

Failed to get access token from gcloud or Application Default Credentials com.google.api.client.http.HttpResponseException: 400 Bad Request POST https://oauth2.googleapis.com/token { "error": "invalid_grant", "error_description": "reauth related error (invalid_rapt)", "error_subtype": "invalid_rapt" } at com.google.api.client.http.HttpRequest.execute(HttpRequest.java:1116) at com.google.auth.oauth2.UserCredentials.doRefreshAccessToken(UserCredentials.java:273) at com.google.auth.oauth2.UserCredentials.refreshAccessToken(UserCredentials.java:190) at com.google.auth.oauth2.OAuth2Credentials$1.call(OAuth2Credentials.java:243) at com.google.auth.oauth2.OAuth2Credentials$1.call(OAuth2Credentials.java:240) at java.base@17/java.util.concurrent.FutureTask.run(FutureTask.java:264) at com.google.common.util.concurrent.DirectExecutor.execute(DirectExecutor.java:31) at com.google.auth.oauth2.OAuth2Credentials$AsyncRefreshResult.executeIfNew(OAuth2Credentials.java:567) at com.google.auth.oauth2.OAuth2Credentials.asyncFetch(OAuth2Credentials.java:206) at com.google.auth.oauth2.OAuth2Credentials.refreshIfExpired(OAuth2Credentials.java:177) at com.google.cloud.artifactregistry.gradle.plugin.ArtifactRegistryGradlePlugin.apply(ArtifactRegistryGradlePlugin.java:89)

clatko commented 2 years ago

we are no longer using this plugin and write out the credentials to a gradle.properties file. basically something like this: echo "artifactRegistryMavenSecret=$$GRADLE_ACCESS_TOKEN" >> gradle.properties

yihanzhen commented 2 years ago

Hi all sorry for the delay in response.

If y'all are still interested can you try this https://github.com/GoogleCloudPlatform/artifact-registry-maven-tools/issues/40#issuecomment-885927526 (make sure to change the plugin version to 2.1.4)

yihanzhen commented 2 years ago

@denis111 I think your problem should have been fixed in https://github.com/GoogleCloudPlatform/artifact-registry-maven-tools/pull/67 and released in 2.1.5. This was a bug that when the plugin did not detect credentials from the environment it failed to tell gradle what protocol artifactregistry is.

I'm going to close it here but it still doesn't work feel free to let me know.

Elyytscha commented 1 year ago

we have this issue,

echo $GOOGLE_APPLICATION_CREDENTIALS is set to a working ../.config/gcloud/application_default_credentials.json for the correct project where the artifact registry resides

version is 2.2.1

and my user definitly is in a group which has role roles/artifactregistry.writer