Uploaded image for project: 'Dev - Nexus Repo'
  1. Dev - Nexus Repo
  2. NEXUS-17646

Unnecessary validation on docker repo creation

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Not A Bug
    • Affects Version/s: 3.13.0
    • Fix Version/s: None
    • Component/s: Docker, Scripting
    • Labels:

      Description

      When running the below command via script, I get an error that seems to speak to validation on the custom index field even though when registry is selected, that field is not needed.

      repository.createDockerProxy('dockerp6', 'https://registry-1.docker.io', 'REGISTRY', '', 14, 25, 'default', true, false)
      

      ERROR:

      2018-07-20 13:51:13,706-0400 WARN  [Karaf local console user karaf] *SYSTEM org.sonatype.nexus.repository.config.internal.ConfigurationFacetImpl - Validation failed; 1 constraints violated:
        1) URL should be in the format 'http://www.example.com', type: class org.sonatype.nexus.repository.config.internal.ConfigurationFacetImpl$SectionWrapper, property: attributes[dockerProxy].indexUrl, value: 
      
      2018-07-20 13:51:13,710-0400 ERROR [Karaf local console user karaf] *SYSTEM org.apache.karaf.shell.support.ShellUtil - Exception caught while executing command
      javax.script.ScriptException: javax.script.ScriptException: javax.validation.ConstraintViolationException
      	at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:162)
      	at org.sonatype.nexus.internal.script.ScriptServiceImpl.eval(ScriptServiceImpl.java:153)
      	at org.sonatype.nexus.common.script.ScriptService$eval$1.call(Unknown Source)
      	at org.sonatype.nexus.internal.script.ScriptAction.execute(ScriptAction.groovy:119)
      	at org.apache.karaf.shell.impl.action.command.ActionCommand.execute(ActionCommand.java:83)
      	at org.apache.karaf.shell.impl.console.osgi.secured.SecuredCommand.execute(SecuredCommand.java:67)
      	at org.apache.karaf.shell.impl.console.osgi.secured.SecuredCommand.execute(SecuredCommand.java:87)
      	at org.apache.felix.gogo.runtime.Closure.executeCmd(Closure.java:480)
      	at org.apache.felix.gogo.runtime.Closure.executeStatement(Closure.java:406)
      	at org.apache.felix.gogo.runtime.Pipe.run(Pipe.java:108)
      	at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:182)
      	at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:119)
      	at org.apache.felix.gogo.runtime.CommandSessionImpl.execute(CommandSessionImpl.java:94)
      	at org.apache.karaf.shell.impl.console.ConsoleSessionImpl.run(ConsoleSessionImpl.java:274)
      	at java.lang.Thread.run(Thread.java:748)
      Caused by: javax.script.ScriptException: javax.validation.ConstraintViolationException
      	at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:324)
      	at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:159)
      	... 14 common frames omitted
      Caused by: javax.validation.ConstraintViolationException: null
      	at org.sonatype.nexus.repository.manager.internal.RepositoryImpl.validate(RepositoryImpl.java:174)
      	at org.sonatype.nexus.repository.manager.internal.RepositoryManagerImpl.newRepository(RepositoryManagerImpl.java:173)
      	at org.sonatype.nexus.repository.manager.internal.RepositoryManagerImpl.create(RepositoryManagerImpl.java:321)
      	at org.sonatype.nexus.common.stateguard.MethodInvocationAction.run(MethodInvocationAction.java:39)
      	at org.sonatype.nexus.common.stateguard.StateGuard$GuardImpl.run(StateGuard.java:270)
      	at org.sonatype.nexus.common.stateguard.GuardedInterceptor.invoke(GuardedInterceptor.java:53)
      	at org.sonatype.nexus.script.plugin.internal.provisioning.RepositoryApiImpl.createRepository(RepositoryApiImpl.groovy:449)
      	at org.sonatype.nexus.script.plugin.internal.provisioning.RepositoryApiImpl$createRepository.callCurrent(Unknown Source)
      	at org.sonatype.nexus.script.plugin.internal.provisioning.RepositoryApiImpl.createDockerProxy(RepositoryApiImpl.groovy:295)
      	at org.sonatype.nexus.script.plugin.RepositoryApi$createDockerProxy.call(Unknown Source)
      	at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47)
      	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
      	at Script3.run(Script3.groovy:29)
      	at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:321)
      	... 15 common frames omitted
      Error executing command: javax.script.ScriptException: javax.validation.ConstraintViolationException
      

      Workaround:
      If I change this to the below command it works.

      //repository.createDockerProxy('dockerp6', 'https://registry-1.docker.io', 'REGISTRY', 'https://index.docker.io/', 14, 25, 'default', true, false)
      

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned Unassigned
              Reporter:
              jtom Joe Tom
              Last Updated By:
              Peter Lynch Peter Lynch
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Date of First Response:

                  tigCommentSecurity.panel-title