Gradle 0.9.7 auth issue
See original GitHub issueDescription of the issue: When pushing the image to docker hub, a 401 unauthorized error occurs.
Expected behavior: When provided with valid authentication, the application should log in and push the image successfully.
Steps to reproduce:
auth
does not seem to be valid in build.gradle
Environment:
Running within a Docker container created by Jenkins. Build takes place in Docker container gradle:4.9-jdk10
jib-gradle-plugin
Configuration:
jib {
from {
image = 'openjdk:10-jre'
}
to {
image = "techtony96/boltbot:$boltBotVersion-" + getCommitHash()
auth {
username = System.getenv("DOCKER_USR")
password = System.getenv("DOCKER_PSW")
}
}
container {
jvmFlags = ['-Xms512m', '-Xmx512m']
mainClass = 'com.discordbolt.boltbot.BoltBot'
}
}
Log output:
+ gradle jib
> Task :compileJava UP-TO-DATE
> Task :processResources
> Task :defineProperties
> Task :classes
Containerizing application to techtony96/boltbot:3.0-SNAPSHOT-0816d3f...
Retrieving registry credentials for registry.hub.docker.com...
Getting base image openjdk:10-jre...
Building dependencies layer...
Building resources layer...
Building classes layer...
Building snapshot-dependencies layer...
Retrieving registry credentials for registry.hub.docker.com...
Finalizing...
Got more than one input Future failure. Logging failures after the first
com.google.cloud.tools.jib.registry.RegistryUnauthorizedException: Unauthorized for registry.hub.docker.com/techtony96/boltbot
at com.google.cloud.tools.jib.registry.RegistryEndpointCaller.call(RegistryEndpointCaller.java:218)
at com.google.cloud.tools.jib.registry.RegistryEndpointCaller.call(RegistryEndpointCaller.java:141)
at com.google.cloud.tools.jib.registry.RegistryClient.callRegistryEndpoint(RegistryClient.java:338)
at com.google.cloud.tools.jib.registry.RegistryClient.checkBlob(RegistryClient.java:249)
at com.google.cloud.tools.jib.builder.steps.PushBlobStep.call(PushBlobStep.java:80)
at com.google.cloud.tools.jib.builder.steps.PushBlobStep.call(PushBlobStep.java:35)
at com.google.common.util.concurrent.CombinedFuture$CallableInterruptibleTask.runInterruptibly(CombinedFuture.java:181)
at com.google.common.util.concurrent.InterruptibleTask.run(InterruptibleTask.java:57)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1135)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
at java.base/java.lang.Thread.run(Thread.java:844)
Caused by: com.google.api.client.http.HttpResponseException: 401 Unauthorized
at com.google.api.client.http.HttpRequest.execute(HttpRequest.java:1070)
at com.google.cloud.tools.jib.http.Connection.send(Connection.java:130)
at com.google.cloud.tools.jib.registry.RegistryEndpointCaller.call(RegistryEndpointCaller.java:173)
... 10 more
Got more than one input Future failure. Logging failures after the first
Additional Information:
I get a warning from Intellij saying auth
can not be resolved, which seems to me that my login info is not being used.
Issue Analytics
- State:
- Created 5 years ago
- Comments:22 (12 by maintainers)
Top Results From Across the Web
Gradle build not working for React Native project after ...
After doing this, I somehow managed to update the Android Gradle Plugin Version to 4.1.3 and Gradle Version to 6.9 under File >...
Read more >[GRADLE-1222] Cannot authenticate on maven repository on ...
Two Ubuntu, two Windows XP/7 and one MAC. We save our credentials for authenticating on our nexus server(maven repository) in the gradle.properties in...
Read more >Publish Artifacts from a Gradle Project - JetBrains
To publish artifacts of a Gradle project, you should configure artifact properties, reference a repository, and specify authentication ...
Read more >Change Log - gradle refreshVersions - GitHub Pages
had an issue: its removal would not be taken into account until the Gradle daemon would be killed. This now behaves correctly. We...
Read more >google/jib - Gitter
@briandealwis You commented on my issue about enabling Google HTTP logging. ... with -Djava.util.logging.config.file=log.properties when I call gradle jib?
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Glad you figured it out. We also discovered a few issues around logs, so your detailed feedback was very helpful.
Seems like we are printing a wrong error message. Filed a bug: #758
Also filed another bug to print a warning if either the username or the password is null: #759
@Techtony96 @coollog I think there is actually something more to it. From the log, Jib says that it did not get the auth info from
build.gradle
, for both the from-image and the to-image.Whether or not providing correct passwords or having the auth section for the from-image or the to-image, if the auth sections have any values, Jib should log that the values are being picked up:
The
build.gradle
that I’m testing looks like this:Now, I am suspecting that
System.getEnv('DOCKER_PASSWORD')
is returning null. If I use the followingbuild.gradle
on my machine whereUNDEFINED_VAR
is not defined,Jib ignores the auth section as the values are null and outputs the same error log as yours:
So I’m guessing the environment variable
DOCKER_PASSWORD
is not available insidebuild.gradle
inside the Jenkins image.