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

Multiple registryCredentials can't be configured in the DockerExtension - must be configured in ~/.docker/config.json or at each task as a workaround #1180

Open
tkrah opened this issue Apr 24, 2023 · 1 comment

Comments

@tkrah
Copy link
Contributor

tkrah commented Apr 24, 2023

This is an enhancement request. At the moment you can configure in the DockerExtension only one credential set:


pluginManager.withPlugin("com.bmuschko.docker-remote-api") {
		docker {
			registryCredentials {
				url = "https://${dockerRegistry}/v2/"
				username = project.property("repository_username")
				password = project.property("repository_password")
			}
		}
	}

My build has some subprojects, those are using different registries to pull from and to push images to. It would be nice if you could configure the credentials for registry URL A and B in the extension and both are used where applicable.

Something like:


pluginManager.withPlugin("com.bmuschko.docker-remote-api") {
		docker {
			registryCredentials {
				url = "https://${dockerRegistry}/v2/"
				username = project.property("repository_username")
				password = project.property("repository_password")
			}
                       registryCredentials {
				url = "https://${AnotherDockerRegistry}/v2/"
				username = project.property("repository_username2")
				password = project.property("repository_password2")
			}
		}
	}

At the moment the only workaround is to either specify on each task who needs another registry the credentials block which is cumbersome to manage because I can't configure it on a central place or to use ´docker login ....´ on the command line because the plugin will fallback to use those credentials - but I would like to remove that workaround and be able to configure both registries (or even more) in the extension block.

@bmuschko
Copy link
Owner

I would recommend configuring the registry on a per-task level which will override the centrally-configured credentials. Configuration of the credentials through the extension is probably going to be a good chunk of work. I won't have time to work on that now, but feel free to propose a pull request on this.

@tkrah tkrah changed the title Multiple registryCredentials can't be configured in the DockerExtension - must be configured in ~/.docker/config.json as a workaround Multiple registryCredentials can't be configured in the DockerExtension - must be configured in ~/.docker/config.json or at each task as a workaround Apr 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants