Harbor uses the $ sign in the username for robot accounts. When using this account in Bamboo to access a private registry the login fails:
08-Apr-2020 15:14:44 at com.atlassian.bamboo.task.TaskExecutorImpl.execute(TaskExecutorImpl.java:116)
08-Apr-2020 15:14:44 at com.atlassian.bamboo.build.pipeline.tasks.ExecuteBuildTask.call(ExecuteBuildTask.java:73)
08-Apr-2020 15:14:44 at com.atlassian.bamboo.v2.build.agent.DefaultBuildAgent.executeBuildPhase(DefaultBuildAgent.java:184)
08-Apr-2020 15:14:44 at com.atlassian.bamboo.v2.build.agent.DefaultBuildAgent.build(DefaultBuildAgent.java:156)
08-Apr-2020 15:14:44 at com.atlassian.bamboo.v2.build.agent.BuildAgentControllerImpl.lambda$waitAndPerformBuild$0(BuildAgentControllerImpl.java:130)
08-Apr-2020 15:14:44 at com.atlassian.bamboo.variable.CustomVariableContextImpl.withVariableSubstitutor(CustomVariableContextImpl.java:118)
08-Apr-2020 15:14:44 at com.atlassian.bamboo.v2.build.agent.BuildAgentControllerImpl.waitAndPerformBuild(BuildAgentControllerImpl.java:124)
08-Apr-2020 15:14:44 at com.atlassian.bamboo.v2.build.agent.DefaultBuildAgent.lambda$start$0(DefaultBuildAgent.java:108)
08-Apr-2020 15:14:44 at com.atlassian.bamboo.utils.BambooRunnables$1.run(BambooRunnables.java:48)
08-Apr-2020 15:14:44 at com.atlassian.bamboo.security.ImpersonationHelper.runWith(ImpersonationHelper.java:26)
08-Apr-2020 15:14:44 at com.atlassian.bamboo.security.ImpersonationHelper.runWithSystemAuthority(ImpersonationHelper.java:17)
08-Apr-2020 15:14:44 at com.atlassian.bamboo.security.ImpersonationHelper$1.run(ImpersonationHelper.java:41)
08-Apr-2020 15:14:44 at java.lang.Thread.run(Thread.java:745)
08-Apr-2020 15:14:44 Caused by: com.atlassian.bamboo.docker.DockerException: Error running Docker push command. See messages above for details.
08-Apr-2020 15:14:44 at com.atlassian.bamboo.plugins.docker.client.DockerCmd.push(DockerCmd.java:164)
08-Apr-2020 15:14:44 at com.atlassian.bamboo.plugins.docker.service.PushService.execute(PushService.java:37)
08-Apr-2020 15:14:44 ... 17 more
08-Apr-2020 15:14:44 Caused by: com.atlassian.utils.process.ProcessException: Error executing '/usr/local/bin/docker login -u robot$bamboo --password-stdin registry.example.com', exit code: 125
08-Apr-2020 15:14:44 at com.atlassian.bamboo.plugins.docker.process.DefaultDockerProcessService.execute(DefaultDockerProcessService.java:66)
08-Apr-2020 15:14:44 at com.atlassian.bamboo.plugins.docker.process.DefaultDockerProcessService.executeSilently(DefaultDockerProcessService.java:76)
08-Apr-2020 15:14:44 at com.atlassian.bamboo.plugins.docker.process.DockerTaskProcessService.executeSilently(DockerTaskProcessService.java:79)
08-Apr-2020 15:14:44 at com.atlassian.bamboo.plugins.docker.client.DockerCmd$AuthorisedCommand.login(DockerCmd.java:239)
08-Apr-2020 15:14:44 at com.atlassian.bamboo.plugins.docker.client.DockerCmd$AuthorisedCommand.execute(DockerCmd.java:210)
08-Apr-2020 15:14:44 at com.atlassian.bamboo.plugins.docker.client.DockerCmd.push(DockerCmd.java:152)
08-Apr-2020 15:14:44 ... 18 more
Running the login command from the error message directly on the command line fails as well:
/usr/local/bin/docker login -u robot$bamboo registry.example.com
Password:
Error response from daemon: Get https://registry.example.com/v2/: unauthorized: authentication required
Surrounding the username with quotes solves this on the command line:
docker login -u 'robot$bamboo' registry.example.com
Password:
WARNING! Your password will be stored unencrypted in /home/bamboo/.docker/config.json.
Configure a credential helper to remove this warning. See
https://docs.docker.com/engine/reference/commandline/login/#credentials-store
Login Succeeded
But I can't use that in the task configuration. I tried to enter the username in the following ways into the textbox:
But it doesn't matter, it's always the same result. When I log in to the registry on the agent host and select Use the agent's native credentials it works as well, but I'd rather not have to manually log in to every agent host individually.
How can I use such a username in a Docker task?