-
Type:
Bug
-
Resolution: Unresolved
-
Priority:
Minor
-
Component/s: git-plugin
-
Environment:System Properties
Name ↓
Value
awt.toolkit sun.awt.X11.XToolkit
executable-war /usr/share/jenkins/jenkins.war
file.encoding UTF-8
file.encoding.pkg sun.io
file.separator /
java.awt.graphicsenv sun.awt.X11GraphicsEnvironment
java.awt.headless true
java.awt.printerjob sun.print.PSPrinterJob
java.class.path /usr/share/jenkins/jenkins.war
java.class.version 52.0
java.endorsed.dirs /usr/lib/jvm/java-8-openjdk-amd64/jre/lib/endorsed
java.ext.dirs /usr/lib/jvm/java-8-openjdk-amd64/jre/lib/ext:/usr/java/packages/lib/ext
java.home /usr/lib/jvm/java-8-openjdk-amd64/jre
java.io.tmpdir /tmp
java.library.path /usr/java/packages/lib/amd64:/usr/lib/x86_64-linux-gnu/jni:/lib/x86_64-linux-gnu:/usr/lib/x86_64-linux-gnu:/usr/lib/jni:/lib:/usr/lib
java.runtime.name OpenJDK Runtime Environment
java.runtime.version 1.8.0_252-8u252-b09-1~deb9u1-b09
java.specification.name Java Platform API Specification
java.specification.vendor Oracle Corporation
java.specification.version 1.8
java.vendor Oracle Corporation
java.vendor.url http://java.oracle.com/
java.vendor.url.bug http://bugreport.sun.com/bugreport/
java.version 1.8.0_252
java.vm.info mixed mode
java.vm.name OpenJDK 64-Bit Server VM
java.vm.specification.name Java Virtual Machine Specification
java.vm.specification.vendor Oracle Corporation
java.vm.specification.version 1.8
java.vm.vendor Oracle Corporation
java.vm.version 25.252-b09
javax.accessibility.assistive_technologies org.GNOME.Accessibility.AtkWrapper
jetty.git.hash a304fd9f351f337e7c0e2a7c28878dd536149c6c
jna.loaded true
jna.platform.library.path /usr/lib/x86_64-linux-gnu:/lib/x86_64-linux-gnu:/lib64:/usr/lib:/lib:/usr/lib/x86_64-linux-gnu/libfakeroot
jnidispatch.path /var/lib/jenkins/.cache/JNA/temp/jna104384470270154600.tmp
line.separator
mail.smtp.sendpartial true
mail.smtps.sendpartial true
os.arch amd64
os.name Linux
os.version 4.9.0-8-amd64
path.separator :
sun.arch.data.model 64
sun.boot.class.path /usr/lib/jvm/java-8-openjdk-amd64/jre/lib/resources.jar:/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/rt.jar:/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/sunrsasign.jar:/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/jsse.jar:/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/jce.jar:/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/charsets.jar:/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/jfr.jar:/usr/lib/jvm/java-8-openjdk-amd64/jre/classes
sun.boot.library.path /usr/lib/jvm/java-8-openjdk-amd64/jre/lib/amd64
sun.cpu.endian little
sun.cpu.isalist
sun.font.fontmanager sun.awt.X11FontManager
sun.io.unicode.encoding UnicodeLittle
sun.java.command /usr/share/jenkins/jenkins.war --webroot=/var/cache/jenkins/war --httpPort=8080 --httpListenAddress=127.0.0.1
sun.java.launcher SUN_STANDARD
sun.jnu.encoding UTF-8
sun.management.compiler HotSpot 64-Bit Tiered Compilers
sun.os.patch.level unknown
user.country US
user.dir /
user.home /var/lib/jenkins
user.language en
user.name jenkins
user.timezone UTC
Environment Variables
Name ↓
Value
_ /usr/bin/daemon
HOME /var/lib/jenkins
JENKINS_HOME /var/lib/jenkins
LANG en_US.UTF-8
LOGNAME jenkins
MAIL /var/mail/jenkins
PATH /usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games
PWD /var/lib/jenkins
SHELL /bin/bash
SHLVL 1
USER jenkins
XDG_RUNTIME_DIR /run/user/109
XDG_SESSION_ID c10
Plugins
Name ↓
Version
Enabled
ace-editor 1.1 true
ant 1.11 false
antisamy-markup-formatter 2.0 true
apache-httpcomponents-client-4-api 4.5.10-2.0 true
authentication-tokens 1.3 true
basic-branch-build-strategies 1.3.2 true
bouncycastle-api 2.18 true
branch-api 2.5.6 true
build-timeout 1.20 true
build-with-parameters 1.4 true
chrome-frame-plugin 1.1 false
cloud-stats 0.25 true
cloudbees-folder 6.12 true
command-launcher 1.4 true
conditional-buildstep 1.3.6 true
config-file-provider 3.6.3 true
credentials 2.3.7 true
credentials-binding 1.23 true
cvs 2.16 false
display-url-api 2.3.2 true
docker-build-step 2.4 false
docker-commons 1.16 true
docker-workflow 1.23 false
durable-task 1.34 true
email-ext 2.69 true
external-monitor-job 1.7 true
gcal 0.4 false
gcm-notification 1.0 false
git 4.2.2 true
git-client 3.2.1 true
git-server 1.9 true
gitea 1.2.0 true
github 1.30.0 false
github-api 1.111 false
github-branch-source 2.7.2 false
github-organization-folder 1.6 false
google-analytics-usage-reporter 0.4 false
google-api-client-plugin 2.0-1.20.0 false
google-cloud-backup 0.6 false
google-cloud-health-check 0.3 false
google-container-registry-auth 0.3 false
google-deployment-manager 0.1 false
google-git-notes-publisher 0.3 false
google-login 1.6 false
google-metadata-plugin 0.3.1 false
google-oauth-plugin 1.0.0 true
google-play-android-publisher 3.0 false
google-source-plugin 0.4 false
google-storage-plugin 1.5.1 false
googleanalytics 1.3 false
gradle 1.36 false
handlebars 1.1.1 true
handy-uri-templates-2-api 2.1.8-1.0 true
htmlpublisher 1.23 true
icon-shim 2.0.3 true
instant-messaging 1.38 true
jackson2-api 2.11.0 true
javadoc 1.5 true
jclouds-jenkins 2.20 false
jdk-tool 1.4 true
jquery 1.12.4-1 true
jquery-detached 1.2.1 true
jsch 0.1.55.2 true
junit 1.29 true
kubernetes 1.25.7 true
kubernetes-client-api 4.9.2-1 true
kubernetes-credentials 0.6.2 true
ldap 1.24 true
lockable-resources 2.8 true
mailer 1.32 true
mapdb-api 1.0.9.0 true
matrix-auth 2.6.1 true
matrix-project 1.14 true
maven-plugin 3.6 true
momentjs 1.1.1 true
oauth-credentials 0.4 true
oic-auth 1.7 true
pam-auth 1.6 true
pipeline-build-step 2.12 true
pipeline-github-lib 1.0 true
pipeline-graph-analysis 1.10 true
pipeline-input-step 2.11 true
pipeline-milestone-step 1.3.1 true
pipeline-model-api 1.7.0 true
pipeline-model-declarative-agent 1.1.1 true
pipeline-model-definition 1.7.0 true
pipeline-model-extensions 1.7.0 true
pipeline-rest-api 2.13 true
pipeline-stage-step 2.3 true
pipeline-stage-tags-metadata 1.7.0 true
pipeline-stage-view 2.13 true
plain-credentials 1.7 true
resource-disposer 0.14 true
run-condition 1.3 true
scm-api 2.6.3 true
script-security 1.72 true
slack 2.40 true
snakeyaml-api 1.26.4 true
ssh-agent 1.19 true
ssh-credentials 1.18.1 true
ssh-slaves 1.31.2 true
structs 1.20 true
subversion 2.13.1 false
timestamper 1.11.3 true
token-macro 2.12 true
trilead-api 1.0.6 true
variant 1.3 true
windows-slaves 1.6 false
workflow-aggregator 2.6 true
workflow-api 2.40 true
workflow-basic-steps 2.20 true
workflow-cps 2.80 true
workflow-cps-global-lib 2.16 true
workflow-durable-task-step 2.35 true
workflow-job 2.39 true
workflow-multibranch 2.21 true
workflow-scm-step 2.11 true
workflow-step-api 2.22 true
workflow-support 3.4 true
ws-cleanup 0.38 true
System Properties Name ↓ Value awt.toolkit sun.awt.X11.XToolkit executable-war /usr/share/jenkins/jenkins.war file.encoding UTF-8 file.encoding.pkg sun.io file.separator / java.awt.graphicsenv sun.awt.X11GraphicsEnvironment java.awt.headless true java.awt.printerjob sun.print.PSPrinterJob java.class.path /usr/share/jenkins/jenkins.war java.class.version 52.0 java.endorsed.dirs /usr/lib/jvm/java-8-openjdk-amd64/jre/lib/endorsed java.ext.dirs /usr/lib/jvm/java-8-openjdk-amd64/jre/lib/ext:/usr/java/packages/lib/ext java.home /usr/lib/jvm/java-8-openjdk-amd64/jre java.io.tmpdir /tmp java.library.path /usr/java/packages/lib/amd64:/usr/lib/x86_64-linux-gnu/jni:/lib/x86_64-linux-gnu:/usr/lib/x86_64-linux-gnu:/usr/lib/jni:/lib:/usr/lib java.runtime.name OpenJDK Runtime Environment java.runtime.version 1.8.0_252-8u252-b09-1~deb9u1-b09 java.specification.name Java Platform API Specification java.specification.vendor Oracle Corporation java.specification.version 1.8 java.vendor Oracle Corporation java.vendor.url http://java.oracle.com/ java.vendor.url.bug http://bugreport.sun.com/bugreport/ java.version 1.8.0_252 java.vm.info mixed mode java.vm.name OpenJDK 64-Bit Server VM java.vm.specification.name Java Virtual Machine Specification java.vm.specification.vendor Oracle Corporation java.vm.specification.version 1.8 java.vm.vendor Oracle Corporation java.vm.version 25.252-b09 javax.accessibility.assistive_technologies org.GNOME.Accessibility.AtkWrapper jetty.git.hash a304fd9f351f337e7c0e2a7c28878dd536149c6c jna.loaded true jna.platform.library.path /usr/lib/x86_64-linux-gnu:/lib/x86_64-linux-gnu:/lib64:/usr/lib:/lib:/usr/lib/x86_64-linux-gnu/libfakeroot jnidispatch.path /var/lib/jenkins/.cache/JNA/temp/jna104384470270154600.tmp line.separator mail.smtp.sendpartial true mail.smtps.sendpartial true os.arch amd64 os.name Linux os.version 4.9.0-8-amd64 path.separator : sun.arch.data.model 64 sun.boot.class.path /usr/lib/jvm/java-8-openjdk-amd64/jre/lib/resources.jar:/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/rt.jar:/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/sunrsasign.jar:/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/jsse.jar:/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/jce.jar:/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/charsets.jar:/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/jfr.jar:/usr/lib/jvm/java-8-openjdk-amd64/jre/classes sun.boot.library.path /usr/lib/jvm/java-8-openjdk-amd64/jre/lib/amd64 sun.cpu.endian little sun.cpu.isalist sun.font.fontmanager sun.awt.X11FontManager sun.io.unicode.encoding UnicodeLittle sun.java.command /usr/share/jenkins/jenkins.war --webroot=/var/cache/jenkins/war --httpPort=8080 --httpListenAddress=127.0.0.1 sun.java.launcher SUN_STANDARD sun.jnu.encoding UTF-8 sun.management.compiler HotSpot 64-Bit Tiered Compilers sun.os.patch.level unknown user.country US user.dir / user.home /var/lib/jenkins user.language en user.name jenkins user.timezone UTC Environment Variables Name ↓ Value _ /usr/bin/daemon HOME /var/lib/jenkins JENKINS_HOME /var/lib/jenkins LANG en_US.UTF-8 LOGNAME jenkins MAIL /var/mail/jenkins PATH /usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games PWD /var/lib/jenkins SHELL /bin/bash SHLVL 1 USER jenkins XDG_RUNTIME_DIR /run/user/109 XDG_SESSION_ID c10 Plugins Name ↓ Version Enabled ace-editor 1.1 true ant 1.11 false antisamy-markup-formatter 2.0 true apache-httpcomponents-client-4-api 4.5.10-2.0 true authentication-tokens 1.3 true basic-branch-build-strategies 1.3.2 true bouncycastle-api 2.18 true branch-api 2.5.6 true build-timeout 1.20 true build-with-parameters 1.4 true chrome-frame-plugin 1.1 false cloud-stats 0.25 true cloudbees-folder 6.12 true command-launcher 1.4 true conditional-buildstep 1.3.6 true config-file-provider 3.6.3 true credentials 2.3.7 true credentials-binding 1.23 true cvs 2.16 false display-url-api 2.3.2 true docker-build-step 2.4 false docker-commons 1.16 true docker-workflow 1.23 false durable-task 1.34 true email-ext 2.69 true external-monitor-job 1.7 true gcal 0.4 false gcm-notification 1.0 false git 4.2.2 true git-client 3.2.1 true git-server 1.9 true gitea 1.2.0 true github 1.30.0 false github-api 1.111 false github-branch-source 2.7.2 false github-organization-folder 1.6 false google-analytics-usage-reporter 0.4 false google-api-client-plugin 2.0-1.20.0 false google-cloud-backup 0.6 false google-cloud-health-check 0.3 false google-container-registry-auth 0.3 false google-deployment-manager 0.1 false google-git-notes-publisher 0.3 false google-login 1.6 false google-metadata-plugin 0.3.1 false google-oauth-plugin 1.0.0 true google-play-android-publisher 3.0 false google-source-plugin 0.4 false google-storage-plugin 1.5.1 false googleanalytics 1.3 false gradle 1.36 false handlebars 1.1.1 true handy-uri-templates-2-api 2.1.8-1.0 true htmlpublisher 1.23 true icon-shim 2.0.3 true instant-messaging 1.38 true jackson2-api 2.11.0 true javadoc 1.5 true jclouds-jenkins 2.20 false jdk-tool 1.4 true jquery 1.12.4-1 true jquery-detached 1.2.1 true jsch 0.1.55.2 true junit 1.29 true kubernetes 1.25.7 true kubernetes-client-api 4.9.2-1 true kubernetes-credentials 0.6.2 true ldap 1.24 true lockable-resources 2.8 true mailer 1.32 true mapdb-api 1.0.9.0 true matrix-auth 2.6.1 true matrix-project 1.14 true maven-plugin 3.6 true momentjs 1.1.1 true oauth-credentials 0.4 true oic-auth 1.7 true pam-auth 1.6 true pipeline-build-step 2.12 true pipeline-github-lib 1.0 true pipeline-graph-analysis 1.10 true pipeline-input-step 2.11 true pipeline-milestone-step 1.3.1 true pipeline-model-api 1.7.0 true pipeline-model-declarative-agent 1.1.1 true pipeline-model-definition 1.7.0 true pipeline-model-extensions 1.7.0 true pipeline-rest-api 2.13 true pipeline-stage-step 2.3 true pipeline-stage-tags-metadata 1.7.0 true pipeline-stage-view 2.13 true plain-credentials 1.7 true resource-disposer 0.14 true run-condition 1.3 true scm-api 2.6.3 true script-security 1.72 true slack 2.40 true snakeyaml-api 1.26.4 true ssh-agent 1.19 true ssh-credentials 1.18.1 true ssh-slaves 1.31.2 true structs 1.20 true subversion 2.13.1 false timestamper 1.11.3 true token-macro 2.12 true trilead-api 1.0.6 true variant 1.3 true windows-slaves 1.6 false workflow-aggregator 2.6 true workflow-api 2.40 true workflow-basic-steps 2.20 true workflow-cps 2.80 true workflow-cps-global-lib 2.16 true workflow-durable-task-step 2.35 true workflow-job 2.39 true workflow-multibranch 2.21 true workflow-scm-step 2.11 true workflow-step-api 2.22 true workflow-support 3.4 true ws-cleanup 0.38 true
We were trying to use a Git-based shared library in Jenkins at a certain tag. In this case, we were trying to checkout the tag "2", but it chose "2.0.5" instead, which is not what we wanted:
Â
Loading library JenkinsScripts@2
Attempting to resolve 2 from remote references... > git --version # timeout=10
> git ls-remote -h -t – https://our-repo.git # timeout=10
Candidate partial match: refs/tags/2.0.5 revision 280c1ed276d8cc9d314b312547ddf960b02fe2e7
Found match: refs/tags/2 revision 7fa2a841b2d38165a0ed28e8671451fea6
Selected match: 2.0.5 revision 280c1ed276d8cc9d314b312547ddf960b02fe2e7
Resolving tag commit... (remote references may be a lightweight tag or an annotated tag)
# More output that's not relevant
> git fetch --tags --progress – origin +refs/heads/:refs/remotes/origin/ # timeout=10
> git rev-parse refs/tags/2.0.5^{commit} # timeout=10
Resolved tag 2 revision 280c1ed276d8cc9d314b312547ddf960b02fe2e7
Â
You can see above that it found an exact tag match, but still selected the partial tag match of "2.0.5".
Â
Here's the raw git output we get if we run that ls-remote directly:
$ git ls-remote -h -t – https://our-repo.git
2554769 HEAD
2554769 refs/heads/master
79d78b0 refs/tags/2
a387cfb refs/tags/2.0.0
6b287b4 refs/tags/2.0.1
38f18cf refs/tags/2.0.10
a8c107d refs/tags/2.0.11
ff6886e refs/tags/2.0.12
861aa6a refs/tags/2.0.13
c01866a refs/tags/2.0.14
7fa2a84 refs/tags/2.0.15
88a1ef9 refs/tags/2.0.2
7ced43c refs/tags/2.0.3
352a812 refs/tags/2.0.4
280c1ed refs/tags/2.0.5
d5c121c refs/tags/2.0.6
4b9f5f0 refs/tags/2.0.7
a756958 refs/tags/2.0.8
019272b refs/tags/2.0.9
Â
It seems that if the a partial tag is found before the exact tag, it choses the partial one instead of the exact tag inside this loop:
https://github.com/jenkinsci/git-plugin/blob/git-4.2.2/src/main/java/jenkins/plugins/git/AbstractGitSCMSource.java#L842
Â
It will set shortHashMatch to 2.0.5's revision, and then when it finds the exact "match" of the "2" tag, it breaks out of the loop:
Â
But since shortHashMatch is set, it processes that first:Â
https://github.com/jenkinsci/git-plugin/blob/git-4.2.2/src/main/java/jenkins/plugins/git/AbstractGitSCMSource.java#L920
Â
I would expect an exact tag match to take priority over a partial tag match.