jenkinsci / jenkinsci/git-forensics-plugin

Failure when the project repository and shared pipeline library both use Git

Open
#1,307 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
43
Forks
29
Avg merge
5d 12h
Merged PRs (30d)
5

Description

Git Forensics cannot create a Git miner in a Jenkins Pipeline that uses:
1. A Git repository for the project checkout.
2. A shared Jenkins Pipeline library that is also loaded from Git.
3. A Windows Jenkins agent.
4. A multibranch or merge-request build.

The project checkout completes successfully. The workspace is a valid Git repository, and normal Git commands such as git rev-parse HEAD work. However, Forensics fails when it creates the Git client:
```
[Forensics] Creating SCM miner to obtain statistics for affected repository files
[Forensics] -> checking SCM 'git https://gitlab.example/project/repository.git'
[Forensics] Exception while creating a GitClient instance for work tree 'C:\J\workspace\project'
[Forensics] -> Git miner could not be created
[Forensics] -> No suitable miner found.
```
The build log also contains Git operations involving the shared pipeline library, for example:
`> git rev-parse "^{commit}"`

The shared library and the project repository are different Git repositories, but both are processed during the same build. It appears that SCM or commit information from the pipeline library may be used while Forensics creates a Git client for the project workspace.

### Expected behavior
Forensics should select the project repository SCM and create a Git miner for the project workspace, independently of the Git-based shared pipeline library.

### Actual behavior
Forensics fails with the generic message:
`Exception while creating a GitClient instance`
The underlying exception is not shown.

### Environment
- Jenkins agent: Windows
- Project SCM: Git
- Shared Pipeline Library SCM: Git
- Build type: multibranch / merge request
- Jenkins version: 2.568.3
- Git client plugin (git-client): 6.6.1
- Git Forensics Plugin (git-forensics): 4.2463.vf6fecb_444a_b_3
- Git plugin (git): 5.10.1
- Pipeline: Build Step (pipeline-build-step): 601.v6d4c6d1a_9dc7
- Pipeline: Groovy Libraries (pipeline-groovy-lib): 805.va_fc79344957d
- Pipeline: Input Step (pipeline-input-step): 560.v56198a_642157
- Pipeline: Milestone Step (pipeline-milestone-step): 152.v6e22b_8cfc66c
- Pipeline: Model API (pipeline-model-api): 2.2293.v6e7193cec599
- Pipeline: Declarative (pipeline-model-definition): 2.2293.v6e7193cec599
- Pipeline: Declarative Extension Points API (pipeline-model-extensions): 2.2293.v6e7193cec599
- Pipeline: REST API Plugin (pipeline-rest-api): 2.41
- Pipeline: Stage Step (pipeline-stage-step): 345.va_96187909426
- Pipeline: Stage Tags Metadata (pipeline-stage-tags-metadata): 2.2293.v6e7193cec599
- Pipeline Utility Steps (pipeline-utility-steps): 3.810.va_7672d206740
- Forensics API Plugin (forensics-api): 4.1923.v445c56df9b_2e

Contributor guide

Open the contributing guide

Research direction

Reproduce the Windows multibranch or merge-request build with both the project Git repository and Git-based shared library. Start at the GitClient creation used by the SCM miner and expose which SCM or commit information is selected; done when the project SCM is chosen independently and the Git miner is created successfully.

Written by the indexing model from the issue text.

Assessment

Tech stack
git, java
Domain
devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.