Skip to content

Execution of git-commit-id-plugin in Docker build fails #518

Open
@cheppsn

Description

@cheppsn

Describe the bug

Building with standard configuration from Bamboo in Docker image (mounting project directory with git repository) fails with

18-Aug-2020 22:06:17 | [INFO] --- git-commit-id-plugin:4.0.2:revision (default) @ **** ---
-- | --
18-Aug-2020 22:06:17 | [INFO] dotGitDirectory /data/.git
18-Aug-2020 22:06:24 | [WARNING] locking FileBasedConfig[/root/.config/jgit/config] failed after 5 retries
18-Aug-2020 22:06:24 | [INFO] ------------------------------------------------------------------------
18-Aug-2020 22:06:24 | [INFO] BUILD FAILURE
18-Aug-2020 22:06:24 | [INFO] ------------------------------------------------------------------------
18-Aug-2020 22:06:24 | [INFO] Total time:  8.449 s
18-Aug-2020 22:06:24 | [INFO] Finished at: 2020-08-18T20:06:24Z
18-Aug-2020 22:06:24 | [INFO] ------------------------------------------------------------------------
18-Aug-2020 22:06:24 | [ERROR] Failed to execute goal pl.project13.maven:git-commit-id-plugin:4.0.2:revision (default) on project ****: Could not complete Mojo execution...: Error: Missing unknown bc06d4f079f817a2827803c9f12b6833ec2bfcfb -> [Help 1]
18-Aug-2020 22:06:24 | [ERROR]
18-Aug-2020 22:06:24 | [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
18-Aug-2020 22:06:24 | [ERROR] Re-run Maven using the -X switch to enable full debug logging.
18-Aug-2020 22:06:24 | [ERROR]
18-Aug-2020 22:06:24 | [ERROR] For more information about the errors and possible solutions, please read the following articles:
18-Aug-2020 22:06:24 | [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
18-Aug-2020 22:06:25 | Exit code: 1, output: STDOUT:  [INFO] --------------------------------[ jar ]---------------------------------STDOUT:  [INFO] STDOUT:  [INFO] --- maven-clean-plugin:2.4.1:clean (default-clean) @ **** ---STDOUT:  [INFO] STDOUT:  [INFO] --- git-commit-id-plugin:4.0.2:revision (default) @ **** ---STDOUT:  [INFO] dotGitDirectory /data/.git STDOUT:  [WARNING] locking FileBasedConfig[/root/.config/jgit/config] failed after 5 retries STDOUT:  [INFO] ------------------------------------------------------------------------STDOUT:  [INFO] BUILD FAILURESTDOUT:  [INFO] ------------------------------------------------------------------------STDOUT:  [INFO] Total time:  8.449 sSTDOUT:  [INFO] Finished at: 2020-08-18T20:06:24ZSTDOUT:  [INFO] ------------------------------------------------------------------------STDOUT:  [ERROR] Failed to execute goal pl.project13.maven:git-commit-id-plugin:4.0.2:revision (default) on project carbonapp: Could not complete Mojo execution...: Error: Missing unknown bc06d4f079f817a2827803c9f12b6833ec2bfcfb 
...

Steps to Reproduce

<plugin>
                <groupId>pl.project13.maven</groupId>
                <artifactId>git-commit-id-plugin</artifactId>
                <version>4.0.2</version>
                <executions>
                    <execution>
                        <id>get-the-git-infos</id>
                        <goals>
                            <goal>revision</goal>
                        </goals>
                        <phase>initialize</phase>
                    </execution>
                </executions>
                <configuration>
                    <generateGitPropertiesFile>true</generateGitPropertiesFile>
                    <generateGitPropertiesFilename>${project.build.outputDirectory}/git.properties</generateGitPropertiesFilename>
                    <includeOnlyProperties>
                        <includeOnlyProperty>^git.build.(time|version)$</includeOnlyProperty>
                        <includeOnlyProperty>^git.commit.id.(abbrev|full)$</includeOnlyProperty>
                        <includeOnlyProperty>^git.dirty$</includeOnlyProperty>
                    </includeOnlyProperties>
                    <commitIdGenerationMode>full</commitIdGenerationMode>
                </configuration>
            </plugin>

Execute mvn clean package in docker container from Bamboo build, project directory mounted as /data.

Expected behavior

Error should not occur.

Additional context

I don't know if the git-commit-id-plugin uses JGit behind the scenes, but this seems to be the same problem as described here: https://community.sonarsource.com/t/error-locking-filebasedconfig-root-config-jgit-config-failed-after-5-retries/21899.

I suspect that this is happening, because the JGit config is created inside the /root directory of the docker container, which is a different drive than /data drive where the git repo is mounted.

I did open an eclipse bug for JGit: https://bugs.eclipse.org/bugs/show_bug.cgi?id=566170

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions