jenkinsci / jenkinsci/git-plugin

[JENKINS-55884] Loading library fails with commit referenced by tag but not any branch

Open
#3,388 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

component:git-plugin imported-jira-issue priority:major resolution:unresolved
Dominant language
Java
Stars
694
Forks
1.1k
Avg merge
1h 29m
Merged PRs (30d)
3

Description

We have a library loaded dynamically in Pipeline script with 

library "mylib@​8c8a4a95f3187b82112cc2eb8539ba470c1eebff"

the sha1 in question is tagged on the remote, but not contained in any branch

Jenkins fails to load the library:

Loading library mylib@​8c8a4a95f3187b82112cc2eb8539ba470c1eebff
Attempting to resolve 8c8a4a95f3187b82112cc2eb8539ba470c1eebff from remote references...
> git --version # timeout=10
using GIT_SSH to set credentials Jenkins Account
> git ls-remote -h ssh://git@​our-bitbucket.com:7999/libProject/mylib.git # timeout=10
Could not find 8c8a4a95f3187b82112cc2eb8539ba470c1eebff in remote references. Pulling heads to local for deep search...
> git rev-parse --is-inside-work-tree # timeout=10
Setting origin to ssh://git@​our-bitbucket.com:7999/libProject/mylib.git
> git config remote.origin.url ssh://git@​our-bitbucket.com:7999/libProject/mylib.git # timeout=10
Fetching origin...
Fetching upstream changes from origin
> git --version # timeout=10
> git config --get remote.origin.url # timeout=10
using GIT_SSH to set credentials Jenkins Account
> git fetch --tags --progress origin +refs/heads/:refs/remotes/origin/
> git rev-parse 8c8a4a95f3187b82112cc2eb8539ba470c1eebff^{commit} # timeout=10
> git branch -a -v --no-abbrev --contains 8c8a4a95f3187b82112cc2eb8539ba470c1eebff # timeout=10
Could not find a branch containing commit 8c8a4a95f3187b82112cc2eb8539ba470c1eebff
[Bitbucket] Notifying commit build result
[Bitbucket] Build result notified
ERROR: No version 8c8a4a95f3187b82112cc2eb8539ba470c1eebff found for library mylib


Originally reported by phoenikz, imported from: Loading library fails with commit referenced by tag but not any branch
  • status: Open
  • priority: Major
  • component(s): git-plugin
  • resolution: Unresolved
  • votes: 2
  • watchers: 4
  • imported: 2025-12-02
Raw content of original issue

We have a library loaded dynamically in Pipeline script with 

library "mylib@8c8a4a95f3187b82112cc2eb8539ba470c1eebff"

the sha1 in question is tagged on the remote, but not contained in any branch

Jenkins fails to load the library:

Loading library mylib@8c8a4a95f3187b82112cc2eb8539ba470c1eebff Attempting to resolve 8c8a4a95f3187b82112cc2eb8539ba470c1eebff from remote references... > git --version # timeout=10 using GIT_SSH to set credentials Jenkins Account > git ls-remote -h ssh://git@our-bitbucket.com:7999/libProject/mylib.git # timeout=10 Could not find 8c8a4a95f3187b82112cc2eb8539ba470c1eebff in remote references. Pulling heads to local for deep search... > git rev-parse --is-inside-work-tree # timeout=10 Setting origin to ssh://git@our-bitbucket.com:7999/libProject/mylib.git > git config remote.origin.url ssh://git@our-bitbucket.com:7999/libProject/mylib.git # timeout=10 Fetching origin... Fetching upstream changes from origin > git --version # timeout=10 > git config --get remote.origin.url # timeout=10 using GIT_SSH to set credentials Jenkins Account > git fetch --tags --progress origin +refs/heads/:refs/remotes/origin/ > git rev-parse 8c8a4a95f3187b82112cc2eb8539ba470c1eebff^{commit} # timeout=10 > git branch -a -v --no-abbrev --contains 8c8a4a95f3187b82112cc2eb8539ba470c1eebff # timeout=10 Could not find a branch containing commit 8c8a4a95f3187b82112cc2eb8539ba470c1eebff [Bitbucket] Notifying commit build result [Bitbucket] Build result notified ERROR: No version 8c8a4a95f3187b82112cc2eb8539ba470c1eebff found for library mylib

environment
Jenkins 2.121.3 on RedHat Linux<br/>
Git plugin 3.9.2 <br/>
Git Client Plugin 2.7.6<br/>
Bitbucket Branch Source Plugin 2.4.0

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the library version-resolution path that produces the reported git ls-remote, fetch --tags, rev-parse, and branch --contains commands. Reproduce the failure with a commit reachable by a tag but not a branch, then verify that library loading resolves that version successfully without weakening the existing remote-reference checks.

Written by the indexing model from the issue text.

Assessment

Tech stack
git, java
Domain
devops, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.