-
Notifications
You must be signed in to change notification settings - Fork 362
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
Do not parse config file if it doesn't exist #887
Comments
Thanks for reporting.
Look like we are logging an error message in that situation. That's unnecessary. It should be a log message on a debug level. The second issue seems to be something else. Looks like something's wrong with parsing your |
Ah okay, yeah that sounds fair enough to me. Regarding the second message that seems specific to my mac, I think I did see something about support for mac in the docs when I was reading earlier but I can't find it again now. I do have a file, but the contents looks a little odd:
To be honest, my main concern was around the Travis CI build, changing the log level would solve that so I would be happy enough with that being included in the next release, although if you do have any ideas about my local mac issue I would be happy to hear them. |
I tried to reproduce your issue with and without a Can you try to delete it and recreate it? What's your Docker distribution? |
It is version 2.1.0.4 (39773) I have the following component versions: Engine: 19.03.4 I just tried the last suggestion here on this thread: fsouza/go-dockerclient#677 i.e. delete the file, and untick the option for storing logins in osx keychain. After restarting and doing a docker login my file now contains:
but the error still persists, before I attempted a docker login the file did not exist, and then I just had the error being logged rather than a debug log. I am wondering if it is related to the use of keychain to store the passwords maybe? |
No idea. My |
I will have a go and see if I can set something up tomorrow. Thanks for taking the time to look into it! |
Just thought, as well as looking into creating a project to reproduce the issue, would you mind sharing what your config.json file looks like? Then I will have an idea of a what the file should look like which might help identify the differences? |
I have added a repo here: https://github.com/michaelruocco/docker-gradle-plugin-bug. Let me know if any useful information is missing or needs to be added. |
Thanks for providing the same project. I can reproduce the error. Looks like the issue only occurs when running the push command. Before I only tried out the build command. Looks like a bug to me. Do you have any bandwidth to look into a fix for this? I may not be able to get to it anytime soon. |
@michaelruocco How does your config.json file looks like in case of the Travis CI build? |
I am getting the same exception!! |
@kgrech sorry for the delayed response, I have had a busy week this week. I don't believe I have access to the file on the travis CI build. I guess I could try and add a cat command to print the file out when the build runs. I will try to do so shortly. |
@kgrech it turns out there is no config.json file present by the looks of things, the error being returned:
I should have checked more thoroughly before, the root exception when the travis build fails is:
However when it fails locally a file is present. I will try and clone / pull the repo shortly and investigate in more detail. |
in my opinion it would be the best to have an option to disable the .docker/config.json handling. |
@sebastianreloaded yeah I would be happy with a flag or some config option to turn this handling off too. It would solve the issue well enough for me too. |
@sebastianreloaded I have a similar problem. I have to delete docker.config to force the plugin to use the given credentials in build.gradle. Probably, in my situation problem is in url which is missing /v2 suffix. |
@kgrech Did you have a chance to look into this issue more deeply? |
@bmuschko sorry for the delay, had some personal things to handle. I will definitely have a look this week |
@kgrech Cool, thanks for getting back in it. Happy to help in any form. I might add some more test cases in the meantime that will help us identify the underlying issue. |
FYI, same problem here in a gitlab-ci job:
Images (2 tags) are correctly pushed to the registry. |
Same problem here. Test on Linux, On windows docker desktop 'auth' chapter always empty, no error. |
Same CI "problem": Missing "~/.docker/config.json" leads to irritating exception while DockerBuildImage still works fine. Local DockerPushImage produces the exact same exception as for @michaelruocco (image is still pushed successfully).
Content of local (never manually edited, did a "docker login" on CL) "~/.docker/config.json":
|
I get a similar a different problem when trying to push an image, and the RegistryAuthLocator throws an error As @bmuschko says, at this should not be logged as an error, and I think it should be warn or below. Having no config.json file is not an error condition, and the best thing would be to return the defaultAuthConfig without an error if the configFile does not exist. Having a config.json that cannot be parsed, however, should be logged as a warn.
|
Anyone care to send in a PR? Seems like an easy enough fix and believe we all agree upon the solution. |
I am working on a PR for at least part of this issue. |
@sebastianreloaded Can you provide a sample project of some sort or explain the behavior in more detail? |
@lgniewkowski Do you have a sample of the config file that was failing for you? |
i will try to put something together over the weekend. |
@bmuschko I see you have already fixed missing config case, thanks. Is there anything required to be done on the missing file case? @michaelruocco Thanks for providing a sample project. I have checked, the issue is not in the format of config.json. However, it looks like Could you please run @bmuschko if you are a mac user as well, can you paste the output of |
@danielefranceschi Could you paste the content of your /root/.docker/config.json file please? |
@kgrech Please find my answers below.
I think that use case is covered now. I will likely release a new version of the plugin soon to unblocks users that ran into that specific use case.
The usage of the |
@kgrech I am not 100% sure which parts of the command you want me to run but:
Looks like valid JSON to me, not sure if that helps much. I am not sure if I can do the same on travis CI, but I could give it a try if needed. Let me know if thats the type of thing you were after or you need me to run something else? |
@bmuschko @michaelruocco |
So after doing that and using the standard docker hub registry which is the one I am using where I am getting this error I see the following:
Again it looks to be valid json and the type of thing I would probably expect. It works in exactly the same fashion for each of the different registries I have got in terms of the json format always being the same. Hope this helps! |
@michaelruocco Thanks, this is helpful, I will check it in the evening! |
@kgrech That file does not exist, as I am in a CI pipeline and no |
I released a new version that addressed the issue of a non-existent config file. Most users in this issue reported that very use case. Please open other, more specific issues for other use cases. Thanks! |
what about the |
@danielefranceschi Can you be more specific? The convention plugins use the same underlying mechanism for resolving the Docker config file. |
plugins {
id 'com.bmuschko.docker-spring-boot-application' version '6.1.0'
} does not find the |
Now it works perfectly in CI, thanks! (and thanks for the great work too) (don't know if it was a local issue, a nexus proxy issue, a repo issue, whatever) |
@michaelruocco I've tested you json and the plugin indeed can parse it with no issue. Maybe in your case, it returns something else. @bmuschko I have raised a PR: #898 |
Hi,
First off, thanks for producing such a useful plugin, I use it a lot and think it is great!
I have recently updated one of my projects to use version 6.0.0 and I have everything working fine, but I am finding that an exception is thrown and logged which is creating a bit of noise in my logs, so I was wondering if there might be a way around it?
It seems to be coming from the way the plugin is trying to lookup auth config, I wondered if it might just be the setup on my local mac, but it is happening on my travis CI builds too (the project is private at the moment but I was planning on making it public soon, I can do that earlier if seeing the whole logs would help?)
The exception that is being thrown is:
When I run on my local mac it is similar but not exactly the same, although it does look to be the same sort of problem:
In either case the plugin says that it will fall back to the default behaviour and then my image is still pushed as required so there is no functional problem. I tried to look at the docs and config to see if there was a way to turn off the auth config lookup (with the idea it would make the plugin just use the default behaviour and bypass the auth config lookup, but I wasn't able to find anything. Feel free to point me in the right direction if I have missed it!
For reference the relevant config that I have in my build.gradle file is:
As I said feel free to point me in the right direction if I am just doing something stupid and missing some config, but any input you can offer would be much appreciated!
Thanks.
The text was updated successfully, but these errors were encountered: