Chamila De Alwis created NIFIREG-433:
----------------------------------------

             Summary: [Git Flow Persistence] Use of refspec for push remote is 
not working
                 Key: NIFIREG-433
                 URL: https://issues.apache.org/jira/browse/NIFIREG-433
             Project: NiFi Registry
          Issue Type: Bug
    Affects Versions: 0.8.0
            Reporter: Chamila De Alwis


The documentation states that for {{Remote to Push}} property for 
{{GitFlowPersistenceProvider}} can take a Git refspec for input if different 
branches needs to be used. However, when a value like 
{{refs/heads/dev:refs/remotes/origin/dev}} is set, Nifi Registry fails to 
startup with the following error message.

{code}
Caused by: java.lang.IllegalArgumentException: The configured remote 
'refs/heads/dev:refs/remotes/origin/dev' to push does not exist. Available 
remotes are [origin]
        at 
org.apache.nifi.registry.provider.flow.git.GitFlowMetaData.loadGitRepository(GitFlowMetaData.java:223)
        at 
org.apache.nifi.registry.provider.flow.git.GitFlowPersistenceProvider.onConfigured(GitFlowPersistenceProvider.java:100)
        at 
org.apache.nifi.registry.provider.StandardProviderFactory.getFlowPersistenceProvider(StandardProviderFactory.java:166)
        at 
org.apache.nifi.registry.provider.StandardProviderFactory$$EnhancerBySpringCGLIB$$c667832b.CGLIB$getFlowPersistenceProvider$2(<generated>)
        at 
org.apache.nifi.registry.provider.StandardProviderFactory$$EnhancerBySpringCGLIB$$c667832b$$FastClassBySpringCGLIB$$7ba69f22.invoke(<generated>)
        at 
org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:244)
        at 
org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:331)
        at 
org.apache.nifi.registry.provider.StandardProviderFactory$$EnhancerBySpringCGLIB$$c667832b.getFlowPersistenceProvider(<generated>)
        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.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154)
        ... 86 common frames omitted
{code}

When digging into the code, it can be seen that in 
{{GitMetadata.loadGitRepository()}} 
(https://github.com/apache/nifi-registry/blob/rel/nifi-registry-0.8.0/nifi-registry-core/nifi-registry-framework/src/main/java/org/apache/nifi/registry/provider/flow/git/GitFlowMetaData.java#L218)
 the remotes are listed and compared with the value given. 
I'm not familiar with JGit that much, but it looks like 
{{remote.getName().equals(remoteToPush)}} should be replaced with code to check 
the push refspecs against `remoteToPush` value. 

Furthermore, when the actual push happens at 
{{GitMetaData.startPushThread()}}(https://github.com/apache/nifi-registry/blob/rel/nifi-registry-0.8.0/nifi-registry-core/nifi-registry-framework/src/main/java/org/apache/nifi/registry/provider/flow/git/GitFlowMetaData.java#L295)
 the remote to push is again set, but without the refspec. 

Not sure if I've grasped this correctly. If this is possible and my 
configuration is wrong, would a more correct example be provided? 




--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to