-
Bug
-
Resolution: Fixed
-
Major
-
None
-
Jenkins version 2.308 from clean docker image jenkins/jenkins:2.308, using only the standard included plugins, plus git-forensics 1.2.0, with forensics-api 1.3.0.
System Properties
awt.toolkit sun.awt.X11.XToolkit
executable-war /usr/share/jenkins/jenkins.war
file.encoding ANSI_X3.4-1968
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 55.0
java.home /opt/java/openjdk
java.io.tmpdir /tmp
java.library.path /usr/java/packages/lib:/usr/lib64:/lib64:/lib:/usr/lib
java.runtime.name OpenJDK Runtime Environment
java.runtime.version 11.0.12+7
java.specification.name Java Platform API Specification
java.specification.vendor Oracle Corporation
java.specification.version 11
java.vendor Eclipse Foundation
java.vendor.url https://adoptium.net/
java.vendor.url.bug https://github.com/adoptium/adoptium-support/issues
java.vendor.version Temurin-11.0.12+7
java.version 11.0.12
java.version.date 2021-07-20
java.vm.compressedOopsMode Zero based
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 11
java.vm.vendor Eclipse Foundation
java.vm.version 11.0.12+7
jdk.debug release
jenkins.model.Jenkins.slaveAgentPort 50000
jetty.git.hash 526006ecfa3af7f1a27ef3a288e2bef7ea9dd7e8
jna.loaded true
jna.platform.library.path /usr/lib/x86_64-linux-gnu:/lib/x86_64-linux-gnu:/lib64:/usr/lib:/lib
jnidispatch.path /var/jenkins_home/.cache/JNA/temp/jna17552883165724643220.tmp
line.separator
mail.smtp.sendpartial true
mail.smtps.sendpartial true
os.arch amd64
os.name Linux
os.version 5.10.0-8-amd64
path.separator :
sun.arch.data.model 64
sun.boot.library.path /opt/java/openjdk/lib
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
sun.java.launcher SUN_STANDARD
sun.jnu.encoding ANSI_X3.4-1968
sun.management.compiler HotSpot 64-Bit Tiered Compilers
sun.os.patch.level unknown
user.country US
user.dir /
user.home /var/jenkins_home
user.language en
user.name jenkins
user.timezone Etc/UTC
Environment Variables
COPY_REFERENCE_FILE_LOG /var/jenkins_home/copy_reference_file.log
HOME /var/jenkins_home
HOSTNAME e3fc0212e373
JAVA_HOME /opt/java/openjdk
JENKINS_ENABLE_FUTURE_JAVA true
JENKINS_HOME /var/jenkins_home
JENKINS_INCREMENTALS_REPO_MIRROR https://repo.jenkins-ci.org/incrementals
JENKINS_SLAVE_AGENT_PORT 50000
JENKINS_UC https://updates.jenkins.io
JENKINS_UC_EXPERIMENTAL https://updates.jenkins.io/experimental
JENKINS_VERSION 2.308
PATH /opt/java/openjdk/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
PWD /
REF /usr/share/jenkins/ref
SHLVL 0
Plugins
Name ↓
Version
Enabled
ace-editor 1.1 true
ant 1.11 true
antisamy-markup-formatter 2.1 true
apache-httpcomponents-client-4-api 4.5.13-1.0 true
bootstrap4-api 4.6.0-3 true
bootstrap5-api 5.1.0-3 true
bouncycastle-api 2.23 true
branch-api 2.6.5 true
build-timeout 1.20 true
caffeine-api 2.9.2-29.v717aac953ff3 true
checks-api 1.7.2 true
cloudbees-folder 6.16 true
command-launcher 1.6 true
credentials 2.5 true
credentials-binding 1.27 true
data-tables-api 1.10.25-3 true
display-url-api 2.3.5 true
durable-task 1.39 true
echarts-api 5.1.2-11 true
email-ext 2.83 true
font-awesome-api 5.15.4-1 true
forensics-api 1.3.0 true
git 4.8.2 true
git-client 3.9.0 true
git-forensics 1.2.0 true
git-server 1.10 true
github 1.34.0 true
github-api 1.123 true
github-branch-source 2.11.2 true
gradle 1.37.1 true
handlebars 3.0.8 true
jackson2-api 2.12.4 true
jaxb 2.3.0.1 true
jdk-tool 1.5 true
jjwt-api 0.11.2-9.c8b45b8bb173 true
jquery3-api 3.6.0-2 true
jsch 0.1.55.2 true
junit 1.52 true
ldap 2.7 true
lockable-resources 2.11 true
mailer 1.34 true
matrix-auth 2.6.8 true
matrix-project 1.19 true
momentjs 1.1.1 true
okhttp-api 3.14.9 true
pam-auth 1.6 true
pipeline-build-step 2.15 true
pipeline-github-lib 1.0 true
pipeline-graph-analysis 1.11 true
pipeline-input-step 2.12 true
pipeline-milestone-step 1.3.2 true
pipeline-model-api 1.9.1 true
pipeline-model-definition 1.9.1 true
pipeline-model-extensions 1.9.1 true
pipeline-rest-api 2.19 true
pipeline-stage-step 2.5 true
pipeline-stage-tags-metadata 1.9.1 true
pipeline-stage-view 2.19 true
plain-credentials 1.7 true
plugin-util-api 2.4.0 true
popper-api 1.16.1-2 true
popper2-api 2.9.3-1 true
resource-disposer 0.16 true
scm-api 2.6.5 true
script-security 1.78 true
snakeyaml-api 1.29.1 true
ssh-credentials 1.19 true
ssh-slaves 1.33.0 true
sshd 3.1.0 true
structs 1.23 true
timestamper 1.13 true
token-macro 266.v44a80cf277fd true
trilead-api 1.0.13 true
workflow-aggregator 2.6 true
workflow-api 2.46 true
workflow-basic-steps 2.24 true
workflow-cps 2.93 true
workflow-cps-global-lib 2.21 true
workflow-durable-task-step 2.39 true
workflow-job 2.41 true
workflow-multibranch 2.26 true
workflow-scm-step 2.13 true
workflow-step-api 2.24 true
workflow-support 3.8 true
ws-cleanup 0.39 trueJenkins version 2.308 from clean docker image jenkins/jenkins:2.308, using only the standard included plugins, plus git-forensics 1.2.0, with forensics-api 1.3.0. System Properties awt.toolkit sun.awt.X11.XToolkit executable-war /usr/share/jenkins/jenkins.war file.encoding ANSI_X3.4-1968 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 55.0 java.home /opt/java/openjdk java.io.tmpdir /tmp java.library.path /usr/java/packages/lib:/usr/lib64:/lib64:/lib:/usr/lib java.runtime.name OpenJDK Runtime Environment java.runtime.version 11.0.12+7 java.specification.name Java Platform API Specification java.specification.vendor Oracle Corporation java.specification.version 11 java.vendor Eclipse Foundation java.vendor.url https://adoptium.net/ java.vendor.url.bug https://github.com/adoptium/adoptium-support/issues java.vendor.version Temurin-11.0.12+7 java.version 11.0.12 java.version.date 2021-07-20 java.vm.compressedOopsMode Zero based 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 11 java.vm.vendor Eclipse Foundation java.vm.version 11.0.12+7 jdk.debug release jenkins.model.Jenkins.slaveAgentPort 50000 jetty.git.hash 526006ecfa3af7f1a27ef3a288e2bef7ea9dd7e8 jna.loaded true jna.platform.library.path /usr/lib/x86_64-linux-gnu:/lib/x86_64-linux-gnu:/lib64:/usr/lib:/lib jnidispatch.path /var/jenkins_home/.cache/JNA/temp/jna17552883165724643220.tmp line.separator mail.smtp.sendpartial true mail.smtps.sendpartial true os.arch amd64 os.name Linux os.version 5.10.0-8-amd64 path.separator : sun.arch.data.model 64 sun.boot.library.path /opt/java/openjdk/lib 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 sun.java.launcher SUN_STANDARD sun.jnu.encoding ANSI_X3.4-1968 sun.management.compiler HotSpot 64-Bit Tiered Compilers sun.os.patch.level unknown user.country US user.dir / user.home /var/jenkins_home user.language en user.name jenkins user.timezone Etc/UTC Environment Variables COPY_REFERENCE_FILE_LOG /var/jenkins_home/copy_reference_file.log HOME /var/jenkins_home HOSTNAME e3fc0212e373 JAVA_HOME /opt/java/openjdk JENKINS_ENABLE_FUTURE_JAVA true JENKINS_HOME /var/jenkins_home JENKINS_INCREMENTALS_REPO_MIRROR https://repo.jenkins-ci.org/incrementals JENKINS_SLAVE_AGENT_PORT 50000 JENKINS_UC https://updates.jenkins.io JENKINS_UC_EXPERIMENTAL https://updates.jenkins.io/experimental JENKINS_VERSION 2.308 PATH /opt/java/openjdk/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin PWD / REF /usr/share/jenkins/ref SHLVL 0 Plugins Name ↓ Version Enabled ace-editor 1.1 true ant 1.11 true antisamy-markup-formatter 2.1 true apache-httpcomponents-client-4-api 4.5.13-1.0 true bootstrap4-api 4.6.0-3 true bootstrap5-api 5.1.0-3 true bouncycastle-api 2.23 true branch-api 2.6.5 true build-timeout 1.20 true caffeine-api 2.9.2-29.v717aac953ff3 true checks-api 1.7.2 true cloudbees-folder 6.16 true command-launcher 1.6 true credentials 2.5 true credentials-binding 1.27 true data-tables-api 1.10.25-3 true display-url-api 2.3.5 true durable-task 1.39 true echarts-api 5.1.2-11 true email-ext 2.83 true font-awesome-api 5.15.4-1 true forensics-api 1.3.0 true git 4.8.2 true git-client 3.9.0 true git-forensics 1.2.0 true git-server 1.10 true github 1.34.0 true github-api 1.123 true github-branch-source 2.11.2 true gradle 1.37.1 true handlebars 3.0.8 true jackson2-api 2.12.4 true jaxb 2.3.0.1 true jdk-tool 1.5 true jjwt-api 0.11.2-9.c8b45b8bb173 true jquery3-api 3.6.0-2 true jsch 0.1.55.2 true junit 1.52 true ldap 2.7 true lockable-resources 2.11 true mailer 1.34 true matrix-auth 2.6.8 true matrix-project 1.19 true momentjs 1.1.1 true okhttp-api 3.14.9 true pam-auth 1.6 true pipeline-build-step 2.15 true pipeline-github-lib 1.0 true pipeline-graph-analysis 1.11 true pipeline-input-step 2.12 true pipeline-milestone-step 1.3.2 true pipeline-model-api 1.9.1 true pipeline-model-definition 1.9.1 true pipeline-model-extensions 1.9.1 true pipeline-rest-api 2.19 true pipeline-stage-step 2.5 true pipeline-stage-tags-metadata 1.9.1 true pipeline-stage-view 2.19 true plain-credentials 1.7 true plugin-util-api 2.4.0 true popper-api 1.16.1-2 true popper2-api 2.9.3-1 true resource-disposer 0.16 true scm-api 2.6.5 true script-security 1.78 true snakeyaml-api 1.29.1 true ssh-credentials 1.19 true ssh-slaves 1.33.0 true sshd 3.1.0 true structs 1.23 true timestamper 1.13 true token-macro 266.v44a80cf277fd true trilead-api 1.0.13 true workflow-aggregator 2.6 true workflow-api 2.46 true workflow-basic-steps 2.24 true workflow-cps 2.93 true workflow-cps-global-lib 2.21 true workflow-durable-task-step 2.39 true workflow-job 2.41 true workflow-multibranch 2.26 true workflow-scm-step 2.13 true workflow-step-api 2.24 true workflow-support 3.8 true ws-cleanup 0.39 true
Because of the way the find reference build loop is written, it fails to find a reference build if the git forensics is added to a project (for example, converting a legacy project to a pipeline) if there are enough commits in repository, even if an appropriate reference build is the HEAD of the reference branch.
The culprit is the getReferencePoint function, because the loop starts with the commit list initialized to the reference job's latest commits - which will be all of them on the first build, and if there are enough the loop won't even run once.
Reproduce steps:
- Create a new git repository
- Add a Jenkinsfile script that checks out the branch (checkout scm), and uses discoverGitReferenceBuild
- Add over 100 commits to the repository
- Create a new branch off the HEAD
- Create a new multibranch pipeline job in Jenkins for the repository
- Build the mainline
- Build the branch
I have created a repository https://github.com/Cetlan/git-forensics-bug that takes care of the first four steps.
The logs for the branch build should indicate that no reference build was found, even though the appropriate reference build should be the only build and the common commit should be the most recent commit in that branch)
"Workaround":
Set maxCommits to at least the number of commits in the longest branch that could be needed for a reference branch, at least until all branches/PRs are based on commits that are in "smaller" builds.