jenkinsci / jenkinsci/git-plugin

[JENKINS-59598] Git plugin "Merge before build" option with concurrent build cause git lock issue

Open
#3,480 0 comments 0 reactions 0 assignees View on GitHub
component:git-plugin imported-jira-issue priority:minor resolution:unresolved
Dominant language
Java
Stars
694
Forks
1.1k
Avg merge
1h 29m
Merged PRs (30d)
3

Description

The git extension h.p.g.e.PreBuildMerge Merge before build is using master workspace to try merging git branches.

But if executed concurrently this can cause concurrent access to git lock file stderr: fatal: Unable to create '/var/jenkins_home/workspace/pipeline-foo@​script/.git/index.lock': File exists.

Quick look at it maybe possible options/ideas:



  • mark the extension requiresWorkspaceForPolling


  • override change method getWorkingDirectory to return a new directory if context.isConcurrentBuild()


  • override decorateCheckoutCommand to use different directory

---
Originally reported by olamy, imported from: Git plugin "Merge before build" option with concurrent build cause git lock issue


  • status: Open
  • priority: Minor
  • component(s): git-plugin
  • resolution: Unresolved
  • votes: 1
  • watchers: 2
  • imported: 2025-12-02

Raw content of original issue

The git extension h.p.g.e.PreBuildMerge Merge before build is using master workspace to try merging git branches.

But if executed concurrently this can cause concurrent access to git lock file stderr: fatal: Unable to create '/var/jenkins_home/workspace/pipeline-foo@script/.git/index.lock': File exists.

Quick look at it maybe possible options/ideas:



  • mark the extension requiresWorkspaceForPolling


  • override change method getWorkingDirectory to return a new directory if context.isConcurrentBuild()


  • override decorateCheckoutCommand to use different directory


Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.