GoogleCloudPlatform / artifact-registry-maven-tools

Apache License 2.0
22 stars 23 forks source link

Gradle: credentials are not updated between invocations since daemon stays alive #91

Open panthony opened 11 months ago

panthony commented 11 months ago

Reopening #39 because I ran into the same issue.

I'm using gradlew to build a project which rely on a repository hosted on Artifact Registry.

I authenticate using:

gcloud auth login --update-adc

My authentication expires after a while so I have to re-authenticate at least once a day, when it occurs the project won't build and fail with a 401 unauthorized.

Even if I re-authenticate using gcloud.

I noticed that changing the version of the plugin com.google.cloud.artifactregistry.gradle-plugin or re-starting the daemon would fix the issue.

 ./gradlew --version

------------------------------------------------------------
Gradle 7.6
------------------------------------------------------------

Build time:   2022-11-25 13:35:10 UTC
Revision:     daece9dbc5b79370cc8e4fd6fe4b2cd400e150a8

Kotlin:       1.7.10
Groovy:       3.0.13
Ant:          Apache Ant(TM) version 1.10.11 compiled on July 10 2021
JVM:          11.0.19 (Eclipse Adoptium 11.0.19+7)
OS:           Mac OS X 13.3.1 aarch64
plugins {
    id 'java'
    id "com.google.cloud.artifactregistry.gradle-plugin" version "2.2.0"
}
n8ebel commented 10 months ago

Our team has been struggling with this as well. The accepted work around that seems to work pretty consistently is killing the gradle daemon, re-auth with gcloud, and then rebuild. This is obviously not ideal.

In digging through the source code, it seemed this might have been introduced when credential caching was added to the plugin: https://github.com/GoogleCloudPlatform/artifact-registry-maven-tools/pull/75

mservidio commented 9 months ago

Running into this issue too. This has become a big nuisance.

mservidio commented 8 months ago

Any update on this?

GerardPaligot commented 6 months ago

Same error here and like @n8ebel said, the credentials cache is the root cause of this issue. Unfortunately, I didn't see any contributor anymore on this project. These plugins are maybe abandoned? 🤔