GoCD: Modification check failed for material
15 Aug 2016 in Infrastructure
After adding submodules to a project, GoCD started complaining that it could not check for modifications whenever we tried to schedule a build for that pipeline. Checking go-server.log
on the server, we saw the following error:
2016-08-15 15:09:10,430 WARN [[email protected] for MaterialUpdateListener] MaterialDatabaseUpdater:121 - [Material Update] Modification check failed for material: URL: [email protected]:user/repo.git, Branch: master java.lang.RuntimeException: Working directory: pipelines/flyweight/dced6ed1-ebe5-4eb8-a96e-3ddc40cd8aa2\. Caused by: com.thoughtworks.go.util.command.CommandLineException: Working directory "/var/lib/go-server/pipelines/flyweight/dced6ed1-ebe5-4eb8-a96e-3ddc40cd8aa2/vendor" does not exist! at com.thoughtworks.go.util.command.CommandLine.checkWorkingDir(CommandLine.java:343) at com.thoughtworks.go.util.command.CommandLine.setWorkingDir(CommandLine.java:334) at com.thoughtworks.go.util.command.CommandLine.withWorkingDir(CommandLine.java:410) at com.thoughtworks.go.domain.materials.git.GitCommand.cleanUnversionedFiles(GitCommand.java:192) at com.thoughtworks.go.domain.materials.git.GitCommand.cleanAllUnversionedFiles(GitCommand.java:141) at com.thoughtworks.go.domain.materials.git.GitCommand.fetchAndReset(GitCommand.java:123) at com.thoughtworks.go.domain.materials.git.GitCommand.fetchAndResetToHead(GitCommand.java:167) at com.thoughtworks.go.domain.materials.git.GitCommand.gitLog(GitCommand.java:79) ... 19 more
We knew this was the issue as the new submodule was the vendor
folder, and GoCD was complaining that the vendor
folder could not be found.
It turns out that GoCD does not like to add submodules to an existing project. Once we removed the folder /var/lib/go-server/pipelines/flyweight/dced6ed1-ebe5-4eb8-a96e-3ddc40cd8aa2/
and triggered a new build, everything worked fine again. This is because GoCD performed a full clone, rather than checking for modifications.