{"action":"created","issue":{"url":"https://api.github.com/repos/fabric8io/docker-maven-plugin/issues/1033","repository_url":"https://api.github.com/repos/fabric8io/docker-maven-plugin","labels_url":"https://api.github.com/repos/fabric8io/docker-maven-plugin/issues/1033/labels{/name}","comments_url":"https://api.github.com/repos/fabric8io/docker-maven-plugin/issues/1033/comments","events_url":"https://api.github.com/repos/fabric8io/docker-maven-plugin/issues/1033/events","html_url":"https://github.com/fabric8io/docker-maven-plugin/issues/1033","id":326951972,"node_id":"MDU6SXNzdWUzMjY5NTE5NzI=","number":1033,"title":"Error pushing to GCR with one-lined JSON key as password","user":{"login":"seboudry","id":107411,"node_id":"MDQ6VXNlcjEwNzQxMQ==","avatar_url":"https://avatars2.githubusercontent.com/u/107411?v=4","gravatar_id":"","url":"https://api.github.com/users/seboudry","html_url":"https://github.com/seboudry","followers_url":"https://api.github.com/users/seboudry/followers","following_url":"https://api.github.com/users/seboudry/following{/other_user}","gists_url":"https://api.github.com/users/seboudry/gists{/gist_id}","starred_url":"https://api.github.com/users/seboudry/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/seboudry/subscriptions","organizations_url":"https://api.github.com/users/seboudry/orgs","repos_url":"https://api.github.com/users/seboudry/repos","events_url":"https://api.github.com/users/seboudry/events{/privacy}","received_events_url":"https://api.github.com/users/seboudry/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":5,"created_at":"2018-05-28T09:01:46Z","updated_at":"2018-09-11T10:12:05Z","closed_at":null,"author_association":"NONE","body":"### Description\r\nHi! Trying to push to GCR with d-m-p using JSON key mechanism.\r\nThe JSON key is passed to build using an environment variable, so must be a one-line string.\r\nDMP fails to decrypt password, it assumes that's a Maven encrypted password (`MavenPlexusCipher` matches the one-lined JSON with the Maven password regex).\r\n\r\nI filled this issue to record it, but don't know if you can handle a fix into d-m-p for this typical use case.\r\n\r\n### Info\r\n\r\n* d-m-p version : `0.25.2`\r\n* Maven version (`mvn -v`) :\r\n```\r\n[MVNVM] Using maven: 3.5.2\r\nApache Maven 3.5.2 (138edd61fd100ec658bfa2d307c43b76940a5d7d; 2017-10-18T09:58:13+02:00)\r\nMaven home: /Users/soudry/.mvnvm/apache-maven-3.5.2\r\nJava version: 1.8.0_172, vendor: Oracle Corporation\r\nJava home: /Library/Java/JavaVirtualMachines/jdk1.8.0_172.jdk/Contents/Home/jre\r\nDefault locale: fr_FR, platform encoding: UTF-8\r\nOS name: \"mac os x\", version: \"10.13.4\", arch: \"x86_64\", family: \"mac\"\r\n```\r\n* Docker version : `18.03.1-ce, build 9ee9f40`\r\n\r\n# Reproduce bug\r\n\r\nDownload a JSON key file from a Google service account.\r\nHave no issue with using JSON key file directly:\r\n```\r\nmvn fabric8:push \\\r\n  -Ddocker.push.registry=eu.gcr.io/awesome \\\r\n  -Ddocker.push.username=_json_key \\\r\n  \"-Ddocker.push.password=$(cat keyfile.json)\"\r\n```\r\n\r\nMake the JSON key file one-line and export it to an env variable:\r\n```\r\njq -c . keyfile.json > keyfile-oneline.json\r\nexport GCR_JSONKEY=$(cat keyfile-oneline.json)\r\n```\r\n\r\nTry using this env var:\r\n```\r\nmvn fabric8:push \\\r\n  -Ddocker.push.registry=eu.gcr.io/awesome \\\r\n  -Ddocker.push.username=_json_key \\\r\n  \"-Ddocker.push.password=${GCR_JSONKEY}\"\r\n```\r\n> Note that f-m-p as no implication in this bug, all Docker authentication is delegated to d-m-p.\r\n\r\n```\r\n[INFO] --- fabric8-maven-plugin:3.5.39:push (default-cli) @ qs-framework-fabric8-python-samples-echo ---\r\n[INFO] F8> Generators:\r\n[INFO] F8>  - spring-boot\r\n[INFO] F8>  - wildfly-swarm\r\n[INFO] F8>  - karaf\r\n[INFO] F8>  - vertx\r\n[INFO] F8>  - java-exec\r\n[INFO] F8>  - webapp\r\n[ERROR] F8> Cannot decrypt password: org.sonatype.plexus.components.sec.dispatcher.SecDispatcherException: org.sonatype.plexus.components.cipher.PlexusCipherException: java.lang.ArrayIndexOutOfBoundsException [null]\r\n[INFO] ------------------------------------------------------------------------\r\n[INFO] BUILD FAILURE\r\n[INFO] ------------------------------------------------------------------------\r\n[INFO] Total time: 5.554 s\r\n[INFO] Finished at: 2018-05-28T10:51:05+02:00\r\n[INFO] Final Memory: 87M/743M\r\n[INFO] ------------------------------------------------------------------------\r\n[ERROR] Failed to execute goal io.fabric8:fabric8-maven-plugin:3.5.39:push (default-cli) on project qs-framework-fabric8-python-samples-echo: Cannot decrypt password: org.sonatype.plexus.components.sec.dispatcher.SecDispatcherException: org.sonatype.plexus.components.cipher.PlexusCipherException: java.lang.ArrayIndexOutOfBoundsException: InvocationTargetException -> [Help 1]\r\norg.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal io.fabric8:fabric8-maven-plugin:3.5.39:push (default-cli) on project qs-framework-fabric8-python-samples-echo: Cannot decrypt password: org.sonatype.plexus.components.sec.dispatcher.SecDispatcherException: org.sonatype.plexus.components.cipher.PlexusCipherException: java.lang.ArrayIndexOutOfBoundsException\r\n\tat org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:213)\r\n\tat org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:154)\r\n\tat org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:146)\r\n\tat org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:117)\r\n\tat org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:81)\r\n\tat org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)\r\n\tat org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)\r\n\tat org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:309)\r\n\tat org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:194)\r\n\tat org.apache.maven.DefaultMaven.execute(DefaultMaven.java:107)\r\n\tat org.apache.maven.cli.MavenCli.execute(MavenCli.java:993)\r\n\tat org.apache.maven.cli.MavenCli.doMain(MavenCli.java:345)\r\n\tat org.apache.maven.cli.MavenCli.main(MavenCli.java:191)\r\n\tat sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)\r\n\tat sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)\r\n\tat sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)\r\n\tat java.lang.reflect.Method.invoke(Method.java:498)\r\n\tat org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)\r\n\tat org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)\r\n\tat org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)\r\n\tat org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)\r\nCaused by: org.apache.maven.plugin.MojoExecutionException: Cannot decrypt password: org.sonatype.plexus.components.sec.dispatcher.SecDispatcherException: org.sonatype.plexus.components.cipher.PlexusCipherException: java.lang.ArrayIndexOutOfBoundsException\r\n\tat io.fabric8.maven.docker.util.AuthConfigFactory.decrypt(AuthConfigFactory.java:445)\r\n\tat io.fabric8.maven.docker.util.AuthConfigFactory.getAuthConfigFromSystemProperties(AuthConfigFactory.java:232)\r\n\tat io.fabric8.maven.docker.util.AuthConfigFactory.createStandardAuthConfig(AuthConfigFactory.java:186)\r\n\tat io.fabric8.maven.docker.util.AuthConfigFactory.createAuthConfig(AuthConfigFactory.java:107)\r\n\tat io.fabric8.maven.docker.service.RegistryService.createAuthConfig(RegistryService.java:96)\r\n\tat io.fabric8.maven.docker.service.RegistryService.pushImages(RegistryService.java:46)\r\n\tat io.fabric8.maven.docker.PushMojo.executeInternal(PushMojo.java:38)\r\n\tat io.fabric8.maven.docker.AbstractDockerMojo.execute(AbstractDockerMojo.java:223)\r\n\tat io.fabric8.maven.plugin.mojo.build.PushMojo.execute(PushMojo.java:101)\r\n\tat org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)\r\n\tat org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)\r\n\t... 20 more\r\nCaused by: java.lang.reflect.InvocationTargetException\r\n\tat sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)\r\n\tat sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)\r\n\tat sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)\r\n\tat java.lang.reflect.Method.invoke(Method.java:498)\r\n\tat io.fabric8.maven.docker.util.AuthConfigFactory.decrypt(AuthConfigFactory.java:441)\r\n\t... 30 more\r\nCaused by: org.sonatype.plexus.components.sec.dispatcher.SecDispatcherException: org.sonatype.plexus.components.cipher.PlexusCipherException: java.lang.ArrayIndexOutOfBoundsException\r\n\tat org.sonatype.plexus.components.sec.dispatcher.DefaultSecDispatcher.decrypt(DefaultSecDispatcher.java:121)\r\n\t... 35 more\r\nCaused by: org.sonatype.plexus.components.cipher.PlexusCipherException: java.lang.ArrayIndexOutOfBoundsException\r\n\tat org.sonatype.plexus.components.cipher.PBECipher.decrypt64(PBECipher.java:193)\r\n\tat org.sonatype.plexus.components.cipher.DefaultPlexusCipher.decrypt(DefaultPlexusCipher.java:74)\r\n\tat org.sonatype.plexus.components.sec.dispatcher.DefaultSecDispatcher.decrypt(DefaultSecDispatcher.java:96)\r\n\t... 35 more\r\nCaused by: java.lang.ArrayIndexOutOfBoundsException\r\n\tat java.lang.System.arraycopy(Native Method)\r\n\tat org.sonatype.plexus.components.cipher.PBECipher.decrypt64(PBECipher.java:181)\r\n\t... 37 more\r\n```"},"comment":{"url":"https://api.github.com/repos/fabric8io/docker-maven-plugin/issues/comments/420221324","html_url":"https://github.com/fabric8io/docker-maven-plugin/issues/1033#issuecomment-420221324","issue_url":"https://api.github.com/repos/fabric8io/docker-maven-plugin/issues/1033","id":420221324,"node_id":"MDEyOklzc3VlQ29tbWVudDQyMDIyMTMyNA==","user":{"login":"Allsimon","id":8037169,"node_id":"MDQ6VXNlcjgwMzcxNjk=","avatar_url":"https://avatars2.githubusercontent.com/u/8037169?v=4","gravatar_id":"","url":"https://api.github.com/users/Allsimon","html_url":"https://github.com/Allsimon","followers_url":"https://api.github.com/users/Allsimon/followers","following_url":"https://api.github.com/users/Allsimon/following{/other_user}","gists_url":"https://api.github.com/users/Allsimon/gists{/gist_id}","starred_url":"https://api.github.com/users/Allsimon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Allsimon/subscriptions","organizations_url":"https://api.github.com/users/Allsimon/orgs","repos_url":"https://api.github.com/users/Allsimon/repos","events_url":"https://api.github.com/users/Allsimon/events{/privacy}","received_events_url":"https://api.github.com/users/Allsimon/received_events","type":"User","site_admin":false},"created_at":"2018-09-11T10:12:05Z","updated_at":"2018-09-11T10:12:05Z","author_association":"NONE","body":"A workaround just in case someone else needs it:\r\n\r\n```\r\nmvn fabric8:push  \\\r\n\t-Ddocker.push.registry=eu.gcr.io/awesome \\\r\n\t-Ddocker.username=oauth2accesstoken \\\r\n\t-Ddocker.password=$(gcloud auth print-access-token)\r\n```"}}
{"actor":{"display_login":"Allsimon"}}