TWChennai / gocd-git-path-material-plugin

GoCD plugin introducing a Git material that watches on sub-directories of git repositories
Apache License 2.0
36 stars 16 forks source link

Support for git submodules #3

Open jskswamy opened 8 years ago

jdel commented 5 years ago

Hello,

Do you still plan to implement this functionality ?

I am experiencing an issue with the plugin when using it on a repo that contains a submodule, even if the watched path is not a submodule. Some other pipelines have the exact same setup with repos that don't contain submodule and they work perfectly fine.

I also checked sanity of the repo in in the flyweight directory and it seems to be ok.

Help on this would be much appreciated. Please see the attached logs below.

GoCD: 18.1 GitPathPlugin: 1.2.3

go-server.log

2019-01-30 16:29:55,023 WARN  [100@MessageListener for MaterialUpdateListener] MaterialDatabaseUpdater:112 - [Material Update] Modification check failed for material: [url=git@server:namespace/repo.git, path=not/a/submodule/path/, branch=master]
java.lang.RuntimeException: Interaction with plugin with id 'GitPathMaterial' implementing 'scm' extension failed while requesting for 'latest-revision'. Reason: [The plugin sent a response that could not be understood by Go. Plugin returned with code '500' and the following response: '"InvalidRefNameException: Branch name <null> is not allowed"']
        at com.thoughtworks.go.plugin.access.PluginRequestHelper.submitRequest(PluginRequestHelper.java:57)
        at com.thoughtworks.go.plugin.access.scm.SCMExtension.getLatestRevision(SCMExtension.java:111)
        at com.thoughtworks.go.server.service.materials.PluggableSCMMaterialPoller.latestModification(PluggableSCMMaterialPoller.java:62)
        at com.thoughtworks.go.server.service.materials.PluggableSCMMaterialPoller.latestModification(PluggableSCMMaterialPoller.java:47)
        at com.thoughtworks.go.server.service.MaterialService.latestModification(MaterialService.java:105)
        at com.thoughtworks.go.server.materials.LegacyMaterialChecker.findLatestModification(LegacyMaterialChecker.java:49)
        at com.thoughtworks.go.server.materials.ScmMaterialUpdater.insertLatestOrNewModifications(ScmMaterialUpdater.java:55)
        at com.thoughtworks.go.server.materials.ScmMaterialUpdater.addNewMaterialWithModifications(ScmMaterialUpdater.java:69)
        at com.thoughtworks.go.server.materials.PluggableSCMMaterialUpdater.addNewMaterialWithModifications(PluggableSCMMaterialUpdater.java:66)
        at com.thoughtworks.go.server.materials.MaterialDatabaseUpdater.addNewMaterialWithModifications(MaterialDatabaseUpdater.java:163)
        at com.thoughtworks.go.server.materials.MaterialDatabaseUpdater.initializeMaterialWithLatestRevision(MaterialDatabaseUpdater.java:121)
        at com.thoughtworks.go.server.materials.MaterialDatabaseUpdater.access$000(MaterialDatabaseUpdater.java:47)
        at com.thoughtworks.go.server.materials.MaterialDatabaseUpdater$1.doInTransaction(MaterialDatabaseUpdater.java:88)
        at com.thoughtworks.go.server.transaction.TransactionCallback.doWithExceptionHandling(TransactionCallback.java:24)
        at com.thoughtworks.go.server.transaction.TransactionTemplate$3.doInTransaction(TransactionTemplate.java:53)
        at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:130)
        at com.thoughtworks.go.server.transaction.TransactionTemplate.executeWithExceptionHandling(TransactionTemplate.java:49)
        at com.thoughtworks.go.server.materials.MaterialDatabaseUpdater.updateMaterial(MaterialDatabaseUpdater.java:85)
        at com.thoughtworks.go.server.materials.MaterialUpdateListener.onMessage(MaterialUpdateListener.java:50)
        at com.thoughtworks.go.server.materials.MaterialUpdateListener.onMessage(MaterialUpdateListener.java:30)
        at com.thoughtworks.go.server.messaging.activemq.JMSMessageListenerAdapter.runImpl(JMSMessageListenerAdapter.java:73)
        at com.thoughtworks.go.server.messaging.activemq.JMSMessageListenerAdapter.run(JMSMessageListenerAdapter.java:53)
        at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.RuntimeException: The plugin sent a response that could not be understood by Go. Plugin returned with code '500' and the following response: '"InvalidRefNameException: Branch name <null> is not allowed"'
        at com.thoughtworks.go.plugin.access.PluginRequestHelper.submitRequest(PluginRequestHelper.java:55)
        ... 22 common frames omitted

plugin-GitPathMaterial.log

2019-01-30 16:14:55,054 ERROR [101@MessageListener for MaterialUpdateListener] GetLatestRevisionRequestHandler:82 - get latest revision:
java.lang.RuntimeException: checkout all sub-modules failed
        at com.thoughtworks.go.scm.plugin.jgit.JGitHelper.checkoutAllModifiedFilesInSubmodules(JGitHelper.java:408)
        at com.thoughtworks.go.scm.plugin.jgit.GitHelper.fetchAndReset(GitHelper.java:106)
        at com.thoughtworks.go.scm.plugin.jgit.GitHelper.fetchAndResetToHead(GitHelper.java:95)
        at com.thoughtworks.go.scm.plugin.jgit.GitHelper.cloneOrFetch(GitHelper.java:37)
        at com.thoughtworks.go.scm.plugin.jgit.GitHelper.cloneOrFetch(GitHelper.java:28)
        at com.thoughtworks.go.scm.plugin.model.requestHandlers.GetLatestRevisionRequestHandler.handle(GetLatestRevisionRequestHandler.java:38)
        at com.thoughtworks.go.scm.plugin.GitPathMaterialPlugin.handle(GitPathMaterialPlugin.java:35)
        at com.thoughtworks.go.plugin.infra.DefaultPluginManager$2.execute(DefaultPluginManager.java:167)
        at com.thoughtworks.go.plugin.infra.DefaultPluginManager$2.execute(DefaultPluginManager.java:162)
        at com.thoughtworks.go.plugin.infra.FelixGoPluginOSGiFramework.executeActionOnTheService(FelixGoPluginOSGiFramework.java:316)
        at com.thoughtworks.go.plugin.infra.FelixGoPluginOSGiFramework.doOn(FelixGoPluginOSGiFramework.java:246)
        at com.thoughtworks.go.plugin.infra.DefaultPluginManager.submitTo(DefaultPluginManager.java:162)
        at com.thoughtworks.go.plugin.access.PluginRequestHelper.submitRequest(PluginRequestHelper.java:48)
        at com.thoughtworks.go.plugin.access.scm.SCMExtension.getLatestRevision(SCMExtension.java:111)
        at com.thoughtworks.go.server.service.materials.PluggableSCMMaterialPoller.latestModification(PluggableSCMMaterialPoller.java:62)
        at com.thoughtworks.go.server.service.materials.PluggableSCMMaterialPoller.latestModification(PluggableSCMMaterialPoller.java:47)
        at com.thoughtworks.go.server.service.MaterialService.latestModification(MaterialService.java:105)
        at com.thoughtworks.go.server.materials.LegacyMaterialChecker.findLatestModification(LegacyMaterialChecker.java:49)
        at com.thoughtworks.go.server.materials.ScmMaterialUpdater.insertLatestOrNewModifications(ScmMaterialUpdater.java:55)
        at com.thoughtworks.go.server.materials.ScmMaterialUpdater.addNewMaterialWithModifications(ScmMaterialUpdater.java:69)
        at com.thoughtworks.go.server.materials.PluggableSCMMaterialUpdater.addNewMaterialWithModifications(PluggableSCMMaterialUpdater.java:66)
        at com.thoughtworks.go.server.materials.MaterialDatabaseUpdater.addNewMaterialWithModifications(MaterialDatabaseUpdater.java:163)
        at com.thoughtworks.go.server.materials.MaterialDatabaseUpdater.initializeMaterialWithLatestRevision(MaterialDatabaseUpdater.java:121)
        at com.thoughtworks.go.server.materials.MaterialDatabaseUpdater.access$000(MaterialDatabaseUpdater.java:47)
        at com.thoughtworks.go.server.materials.MaterialDatabaseUpdater$1.doInTransaction(MaterialDatabaseUpdater.java:88)
        at com.thoughtworks.go.server.transaction.TransactionCallback.doWithExceptionHandling(TransactionCallback.java:24)
        at com.thoughtworks.go.server.transaction.TransactionTemplate$3.doInTransaction(TransactionTemplate.java:53)
        at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:130)
        at com.thoughtworks.go.server.transaction.TransactionTemplate.executeWithExceptionHandling(TransactionTemplate.java:49)
        at com.thoughtworks.go.server.materials.MaterialDatabaseUpdater.updateMaterial(MaterialDatabaseUpdater.java:85)
        at com.thoughtworks.go.server.materials.MaterialUpdateListener.onMessage(MaterialUpdateListener.java:50)
        at com.thoughtworks.go.server.materials.MaterialUpdateListener.onMessage(MaterialUpdateListener.java:30)
        at com.thoughtworks.go.server.messaging.activemq.JMSMessageListenerAdapter.runImpl(JMSMessageListenerAdapter.java:73)
        at com.thoughtworks.go.server.messaging.activemq.JMSMessageListenerAdapter.run(JMSMessageListenerAdapter.java:53)
        at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.RuntimeException: sub-module checkout failed
        at com.thoughtworks.go.scm.plugin.jgit.JGitHelper.checkoutSubmodule(JGitHelper.java:615)
        at com.thoughtworks.go.scm.plugin.jgit.JGitHelper.checkoutAllModifiedFilesInSubmodules(JGitHelper.java:405)
        ... 34 common frames omitted
Caused by: org.eclipse.jgit.api.errors.InvalidRefNameException: Branch name <null> is not allowed
        at org.eclipse.jgit.api.CheckoutCommand.processOptions(CheckoutCommand.java:518)
        at org.eclipse.jgit.api.CheckoutCommand.call(CheckoutCommand.java:204)
        at com.thoughtworks.go.scm.plugin.jgit.JGitHelper.checkoutSubmodule(JGitHelper.java:613)
        ... 35 common frames omitted
2019-01-30 16:14:55,055 INFO  [101@MessageListener for MaterialUpdateListener] JsonUtils:57 - GoPluginApiResponse: "InvalidRefNameException: Branch name <null> is not allowed"
2019-01-30 16:14:55,055 INFO  [101@MessageListener for MaterialUpdateListener] GitPathMaterialPlugin:57 - Response code: 500
2019-01-30 16:14:55,055 INFO  [101@MessageListener for MaterialUpdateListener] GitPathMaterialPlugin:57 - With response body: "InvalidRefNameException: Branch name <null> is not allowed"

Thanks and regards