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

Problems with Private Registry #632

Closed
mgparada opened this issue Mar 15, 2017 · 23 comments
Closed

Problems with Private Registry #632

mgparada opened this issue Mar 15, 2017 · 23 comments
Assignees
Labels
Milestone

Comments

@mgparada
Copy link

mgparada commented Mar 15, 2017

Issue Overview

I have an Arquillian Cube working building my own images, but some days ago I just config a private Registry (under ssl and with user&pass) and trying to pull the images from it, fails always.

PS: I can pull images from Registry manually ;-) So it's not a Registry misconfiguration or something like this.

Expected Behaviour

I expect that Arquillian downloads (pull) images from my own Registry, in order to use always a pre-build image.

Current Behaviour

When I execute the gradle task and the Arquillian Runner starts, configured to find the image from the Registry, it fails with some NullPointerExceptions.

Additional Information

The arquillian cube config:

<extension qualifier="docker">
        <property name="serverVersion">1.12</property>
        <property name="dockerInsideDockerResolution">false</property>
        <property name="serverUri">https://127.0.0.1:2376</property>
        <property name="tlsVerify">DOCKER_CERT_PATH</property>
        <property name="definitionFormat">CUBE</property>
        <property name="dockerRegistry">xx.yy.com:1234</property>
        <property name="username">xx</property>
        <property name="password">xxxxxx</property>
        <property name="email">mauro@yy.com</property>
        <property name="dockerContainers">
            my-arquillian-service:
                image: aaa/bbb/ccc/my-image-name
        </property>
    </extension>

I tried changing some parameters..
<property name="dockerRegistry">https://xx.yy.com:1234/v2</property>,

<property name="dockerContainers">
            my-arquillian-service:
                image: xx.yy.com:1234/aaa/bbb/ccc/my-image-name
        </property>

So, i've tried with some differents options but i cannot make it works..
The error is as follows:

Arquillian has previously been attempted initialized, but failed. See cause for previous exception
java.lang.RuntimeException: Arquillian has previously been attempted initialized, but failed. See cause for previous exception
	at org.jboss.arquillian.junit.Arquillian.run(Arquillian.java:107)
	at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecuter.runTestClass(JUnitTestClassExecuter.java:114)
	at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecuter.execute(JUnitTestClassExecuter.java:57)
	at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassProcessor.processTestClass(JUnitTestClassProcessor.java:66)
	at org.gradle.api.internal.tasks.testing.SuiteTestClassProcessor.processTestClass(SuiteTestClassProcessor.java:51)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:35)
	at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
	at org.gradle.internal.dispatch.ContextClassLoaderDispatch.dispatch(ContextClassLoaderDispatch.java:32)
	at org.gradle.internal.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:93)
	at com.sun.proxy.$Proxy3.processTestClass(Unknown Source)
	at org.gradle.api.internal.tasks.testing.worker.TestWorker.processTestClass(TestWorker.java:109)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:35)
	at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
	at org.gradle.internal.remote.internal.hub.MessageHub$Handler.run(MessageHub.java:377)
	at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:54)
	at org.gradle.internal.concurrent.StoppableExecutorImpl$1.run(StoppableExecutorImpl.java:40)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.RuntimeException: Could not create new instance of class org.jboss.arquillian.test.impl.EventTestRunnerAdaptor
	at org.jboss.arquillian.test.spi.SecurityActions.newInstance(SecurityActions.java:166)
	at org.jboss.arquillian.test.spi.SecurityActions.newInstance(SecurityActions.java:103)
	at org.jboss.arquillian.test.spi.TestRunnerAdaptorBuilder.build(TestRunnerAdaptorBuilder.java:52)
	at org.jboss.arquillian.junit.Arquillian.run(Arquillian.java:114)
	at org.junit.runners.Suite.runChild(Suite.java:128)
	at org.junit.runners.Suite.runChild(Suite.java:27)
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
	... 26 more
Caused by: java.lang.reflect.InvocationTargetException
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
	at org.jboss.arquillian.test.spi.SecurityActions.newInstance(SecurityActions.java:162)
	... 37 more
Caused by: java.lang.NullPointerException
	at org.arquillian.cube.docker.impl.util.ConfigUtil.load(ConfigUtil.java:97)
	at org.arquillian.cube.docker.impl.util.ConfigUtil.load(ConfigUtil.java:86)
	at org.arquillian.cube.docker.impl.docker.cube.CubeConverter.<init>(CubeConverter.java:22)
	at org.arquillian.cube.docker.impl.docker.cube.CubeConverter.create(CubeConverter.java:34)
	at org.arquillian.cube.docker.impl.client.DockerContainerDefinitionParser.convert(DockerContainerDefinitionParser.java:89)
	at org.arquillian.cube.docker.impl.client.CubeDockerConfiguration.fromMap(CubeDockerConfiguration.java:225)
	at org.arquillian.cube.docker.impl.client.CubeDockerConfigurator.configure(CubeDockerConfigurator.java:88)
	at org.arquillian.cube.docker.impl.client.CubeDockerConfigurator.configure(CubeDockerConfigurator.java:77)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:96)
	at org.jboss.arquillian.core.impl.EventContextImpl.invokeObservers(EventContextImpl.java:99)
	at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:81)
	at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:145)
	at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:116)
	at org.jboss.arquillian.core.impl.ManagerImpl.bindAndFire(ManagerImpl.java:265)
	at org.jboss.arquillian.core.impl.InstanceImpl.set(InstanceImpl.java:74)
	at org.arquillian.cube.impl.client.CubeConfigurator.configure(CubeConfigurator.java:24)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:96)
	at org.jboss.arquillian.core.impl.EventContextImpl.invokeObservers(EventContextImpl.java:99)
	at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:81)
	at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:145)
	at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:116)
	at org.jboss.arquillian.core.impl.ManagerImpl.bindAndFire(ManagerImpl.java:265)
	at org.jboss.arquillian.core.impl.InstanceImpl.set(InstanceImpl.java:74)
	at org.jboss.arquillian.config.impl.extension.ConfigurationRegistrar.loadConfiguration(ConfigurationRegistrar.java:73)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:96)
	at org.jboss.arquillian.core.impl.EventContextImpl.invokeObservers(EventContextImpl.java:99)
	at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:81)
	at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:145)
	at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:116)
	at org.jboss.arquillian.core.impl.ManagerImpl.start(ManagerImpl.java:290)
	at org.jboss.arquillian.test.impl.EventTestRunnerAdaptor.<init>(EventTestRunnerAdaptor.java:63)
	... 42 more

Any kind of help would be appreciated!
I didn't find many docs about it so I followed some examples to figure out how i should configure.

Thanks!

@dipak-pawar
Copy link
Contributor

Thank you for reporting this issue @mgparada. I'll take a look into this today.

@mgparada
Copy link
Author

Update:

As @lordofthejars said, I tried to Docker-Compose file but still failing. The error is a bit different, but seems that is ignoring the dockerRegistry property.
My arquillian.xml:

<extension qualifier="docker">
        <property name="serverVersion">1.12</property>
        <property name="dockerInsideDockerResolution">false</property>
        <property name="serverUri">https://127.0.0.1:2376</property>
        <property name="tlsVerify">DOCKER_CERT_PATH</property>
        <property name="dockerRegistry">xx.yy.com:1234</property>
        <property name="username">xx</property>
        <property name="password">xx</property>
        <property name="email">mauro@xx.com</property>
        <property name="dockerContainersFile">src/test/resources/docker-compose.yml</property>
    </extension>

and the error is like that:

Caused by: com.github.dockerjava.api.exception.UnauthorizedException: Get https://registry-1.docker.io/v2/library/null/manifests/latest: unauthorized: incorrect username or password

	at com.github.dockerjava.jaxrs.filter.ResponseStatusExceptionFilter.filter(ResponseStatusExceptionFilter.java:45)
	at org.glassfish.jersey.client.ClientFilteringStages$ResponseFilterStage.apply(ClientFilteringStages.java:140)
	at org.glassfish.jersey.client.ClientFilteringStages$ResponseFilterStage.apply(ClientFilteringStages.java:128)
	at org.glassfish.jersey.process.internal.Stages.process(Stages.java:171)
	at org.glassfish.jersey.client.ClientRuntime.invoke(ClientRuntime.java:257)
	at org.glassfish.jersey.client.JerseyInvocation$2.call(JerseyInvocation.java:701)
	at org.glassfish.jersey.internal.Errors.process(Errors.java:315)
	at org.glassfish.jersey.internal.Errors.process(Errors.java:297)
	at org.glassfish.jersey.internal.Errors.process(Errors.java:228)
	at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:444)
	at org.glassfish.jersey.client.JerseyInvocation.invoke(JerseyInvocation.java:697)
	at org.glassfish.jersey.client.JerseyInvocation$Builder.method(JerseyInvocation.java:448)
	at org.glassfish.jersey.client.JerseyInvocation$Builder.post(JerseyInvocation.java:349)
	at com.github.dockerjava.jaxrs.async.POSTCallbackNotifier.response(POSTCallbackNotifier.java:29)
	at com.github.dockerjava.jaxrs.async.AbstractCallbackNotifier.call(AbstractCallbackNotifier.java:50)
	at com.github.dockerjava.jaxrs.async.AbstractCallbackNotifier.call(AbstractCallbackNotifier.java:24)
	... 4 more

Starting with docker-compose works like a charm. I cannot figure out which could be the problem..

@lordofthejars
Copy link
Member

lordofthejars commented Mar 15, 2017 via email

@dipak-pawar
Copy link
Contributor

@lordofthejars We are setting it inside DcokerClientExecutor class in it's constructor.

@lordofthejars
Copy link
Member

lordofthejars commented Mar 15, 2017 via email

@lordofthejars
Copy link
Member

I have found the bug. It is in our code. As a workaround you can do this https://github.com/docker-java/docker-java#properties-docker-javaproperties

@mgparada
Copy link
Author

wops, thanks @lordofthejars. Tomorrow I'll check it out.

@lordofthejars
Copy link
Member

Tomorrow I will also try to provide a PR with the fix.

@bartoszmajsak We should release alpha21 when this fixed since it is an important bug.

@bartoszmajsak
Copy link
Member

Any time you feel like it @lordofthejars

@lordofthejars
Copy link
Member

@mgparada I have pushed a new version of cube at https://github.com/lordofthejars/arquillian-cube/tree/issue-632 But the funny thing is that I have created an example of using another docker registry https://bintray.com/lordofthejars/continuous_delivery/lordofthejars%3Acomposer And I have not configured anything. I have not set the dockerRegistry property and my docker-compose file just contained lordofthejars-docker-continuous_delivery.bintray.io/lordofthejars/composer:1.0.0-alpine as the image to be used, and docker host automatically resolved to the other host and not docker.io.

Obviously your case is different since you are using a private repository. So what I would do is:

Clone https://github.com/lordofthejars/arquillian-cube Checkout the branch that is named issue-632. Run mvn install -DskipTests and use this snapshot and setting dockerRegistry, username and password of your private registry and of course using in docker compose the full path definition (host/namespace/container:version) form.

@mgparada
Copy link
Author

Thanks @lordofthejars! I'll check it out and i'll use this snapshot while the new release not coming out.

@lordofthejars
Copy link
Member

lordofthejars commented Mar 17, 2017 via email

@mgparada
Copy link
Author

mgparada commented Mar 20, 2017

Hi @lordofthejars, sorry for the delay!
I'm trying this new version but still fails. I just find a problem parsing the image key, retrieved from the docker-compose file, and creating the Image object.

In Image.java class, inside the valueOf function, you're setting the image properties (nam & tag), but the switch does not contemplate some options.. in my case: my image url is something like:
registry.mauro.com:1234/my/custom/repo/myimage:latest
so as you are splitting by '/' this returns an array of 5 elements.. but there are no case for 5 elements.
Watching the code I see that you're assuming that the <organization_namespace> is one word or something that does not contain /.. but i think that the common structure for the namespace is something like my/org/bucket.
So, finally, the image, is creating with tag & name = null, the value which initializes these properties.

@lordofthejars
Copy link
Member

I have not seen any example like you mention before :) watching public docker repositories I have always seen the same pattern. Anyway, if it works on docker-machine it means we need to add support as well. So from your previous example registry.mauro.com:1234 is the private host. my/custom/repo is the organization, myimage is the image name and latest the tag right?

@mgparada
Copy link
Author

uhm.. yep, i'm watching and you're right! may be i should change my namespaces format... :)

Yes, in my case I using this format:

  • domain: registry.domain.xxx:port
  • namespace: my/registry/namespace
  • image name: myimage
  • version: latest

but i guess that version could be latest or something like 1.2.3, right?

@lordofthejars
Copy link
Member

yes, this is not a problem. But this format works on docker-machine right?

@mgparada
Copy link
Author

yep, it's working. I test it in docker > v1.12

@lordofthejars
Copy link
Member

ok, then we need to add this specific use case as well. Thank you so much.

@mgparada
Copy link
Author

mgparada commented Mar 20, 2017

Ok, perfect! Thank you so much for your work! ;-)
If you need some test on it, just tell me something

@lordofthejars
Copy link
Member

@mgparada At #640 you've got a version that works with multiple levels in organization name. Can you give it a try please? Tests passes, but what I would like to see is working with private registry :)

@mgparada
Copy link
Author

Yay! it's working now! Thx! ;)

@lordofthejars
Copy link
Member

Thank you very much for your patience and reporting the bug. Now it is merged and shipped in next release.

@lordofthejars lordofthejars self-assigned this Mar 20, 2017
@lordofthejars lordofthejars added this to the 1.0.0.Alpha21 milestone Mar 20, 2017
@lordofthejars
Copy link
Member

#640

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants