Skip to content

"unknown commit ID" when having multiple checkouts and merge with target #3380

Description

@autoantwort

Jenkins and plugins versions report

Environment
Jenkins: 2.555.1
OS: Linux - 6.8.12-13-pve
Java: 21.0.11 - Ubuntu (OpenJDK 64-Bit Server VM)
---
active-directory:2.41.1
analysis-model-api:14.8.0-976.v5097f60f61a_4
antisamy-markup-formatter:173.v680e3a_b_69ff3
apache-httpcomponents-client-4-api:4.5.14-269.vfa_2321039a_83
apache-httpcomponents-client-5-api:5.6.1-195.v65ffe15189a_d
asm-api:9.10-211.v7d13903b_a_d89
authentication-tokens:1.144.v5ff4a_5ec5c33
bootstrap5-api:5.3.8-1038.vee76a_fe825ff
bouncycastle-api:2.30.1.84-291.v9f17b_21896e2
branch-api:2.1280.v0d4e5b_b_460ef
build-failure-analyzer:3.887.vc872cf1b_7dff
caffeine-api:3.2.3-194.v31a_b_f7a_b_5a_81
checks-api:402.vca_263b_f200e3
cloudbees-folder:6.1100.ve9eed61d16c4
command-launcher:134.v025a_5fcf9dea_
commons-compress-api:1.28.0-3
commons-lang3-api:3.20.0-109.ve43756e2d2b_4
commons-text-api:1.15.0-218.va_61573470393
credentials:1502.v5c95e620ddfe
credentials-binding:725.ve52b_2328a_fde
data-tables-api:2.3.7-1558.vf82fa_133ce1c
display-url-api:2.217.va_6b_de84cc74b_
dtkit-api:3.0.3
durable-task:671.v340ff7959010
echarts-api:6.0.0-1281.vd3d21a_1ca_cb_4
eddsa-api:0.3.0.1-29.v67e9a_1c969b_b_
email-ext:1933.1935.v276319e3cc47
embeddable-build-status:637.vd878e68178f8
envinject:2.941.v351a_20c0a_3ca_
envinject-api:1.241.vdd714803b_403
external-monitor-job:223.vb_fddcf42c9b_3
favorite:2.263.v941d21defef7
font-awesome-api:7.2.0-983.v3f63c34eddb_9
forensics-api:4.1891.v5e60f3377506
git:5.10.1
git-client:6.6.0
git-forensics:4.2385.va_e15df49d352
git-server:137.ve0060b_432302
gitlab-api:6.3.0-126.vd066b_d896159
gitlab-branch-source:740.v04f287f9194d
gitlab-plugin:1.9.13
gson-api:2.14.0-201.v8eefe5515533
handy-uri-templates-2-api:2.1.8-38.vcea_5d521d5f3
htmlpublisher:427.1
instance-identity:203.v15e81a_1b_7a_38
ionicons-api:94.vcc3065403257
jackson-annotations2-api:2.21-7.v4777a_f3a_a_d47
jackson2-api:2.21.2-436.v29efdb_7418ff
jackson3-api:3.1.2-73.v3e5485d8b_148
jakarta-activation-api:2.1.4-1
jakarta-mail-api:2.1.5-1
jakarta-xml-bind-api:4.0.6-12.vb_1833c1231d3
javadoc:354.vee1a_660b_4990
javax-activation-api:1.2.0-8
javax-mail-api:1.6.2-11
jaxb:2.3.9-143.v5979df3304e6
jdk-tool:83.v417146707a_3d
jenkins-design-language:1.27.25
jersey2-api:2.48-180.ve47b_264f849b_
jersey3-api:3.1.11-4.v77818819c2e1
jobConfigHistory:1356.ve360da_6c523a_
joda-time-api:2.14.2-193.v422b_efce56e0
jquery3-api:3.7.1-682.vfa_cdce169929
jsch:0.2.16-95.v3eecb_55fa_b_78
json-api:20251224-185.v0cc18490c62c
json-path-api:3.0.0-218.vcd4dd1355de2
jsoup:1.22.2-95.vc5d00f1eb_42d
junit:1403.vd9d1413fd205
ldap:807.809.vd3a_4e5e4ec98
lockable-resources:1515.v380548282a_59
mailer:534.v1b_36f5864073
matrix-auth:3.2.10
matrix-project:870.v9db_fcfc2f45b_
maven-plugin:3.27
metrics:4.2.37-494.v06f9a_939d33a_
mina-sshd-api-common:2.16.0-167.va_269f38cc024
mina-sshd-api-core:2.16.0-167.va_269f38cc024
msbuild:1.41
nvm-wrapper:0.1.7
okhttp-api:5.3.2-200.vedb_720a_cf1f8
opentelemetry:3.1589.ve81b_b_fa_927d5
opentelemetry-api:1.54.1.102.v276c93ee966d
oss-symbols-api:442.v99039087229b_
pam-auth:1.12
pipeline-build-step:584.vdb_a_2cc3a_d07a_
pipeline-graph-analysis:254.v0f63a_a_447dca_
pipeline-groovy-lib:798.v5cc688825312
pipeline-input-step:551.vdff487c5998c
pipeline-milestone-step:152.v6e22b_8cfc66c
pipeline-model-api:2.2277.v00573e73ddf1
pipeline-model-definition:2.2277.v00573e73ddf1
pipeline-model-extensions:2.2277.v00573e73ddf1
pipeline-rest-api:2.41
pipeline-stage-step:345.va_96187909426
pipeline-stage-tags-metadata:2.2277.v00573e73ddf1
pipeline-stage-view:2.41
pipeline-utility-steps:2.20.0
plain-credentials:199.v9f8e1f741799
plugin-util-api:7.1341.v039f146993d9
prism-api:1.30.0-727.vc475481f034d
prometheus:852.v317db_5d17a_b_0
publish-over:238.v1db_583004c9b_
publish-over-cifs:194.v0274950f275c
pubsub-light:1.19
resource-disposer:0.25
scm-api:728.vc30dcf7a_0df5
script-security:1402.v94c9ce464861
simple-theme-plugin:230.v8b_fd91b_b_800c
snakeyaml-api:2.5-149.v72471e9c6371
snakeyaml-engine-api:3.0.1-5.vd98ea_ff3b_92e
sse-gateway:1.29
ssh-agent:396.vcc7d84e622ec
ssh-credentials:372.va_250881b_08cd
ssh-slaves:3.1097.v868116049892
sshd:3.384.vc89b_5e138cf9
structs:362.va_b_695ef4fdf9
timestamper:1.30
token-macro:477.vd4f0dc3cb_cf1
trilead-api:2.284.v1974ea_324382
variant:70.va_d9f17f859e0
warnings-ng:13.10097.v277a_958a_b_c09
woodstox-core-api:7.1.1-1.v4d297985f397
workflow-aggregator:608.v67378e9d3db_1
workflow-api:1413.v2ff1a_5e720fa_
workflow-basic-steps:1098.v808b_fd7f8cf4
workflow-cps:4315.va_e456c4e7f4f
workflow-durable-task-step:1479.v56e587f413a_7
workflow-job:1571.1580.v18e46842c125
workflow-multibranch:821.vc3b_4ea_780798
workflow-scm-step:466.va_d69e602552b_
workflow-step-api:724.v538c2362b_dfb_
workflow-support:1015.v785e5a_b_b_8b_22
ws-cleanup:0.49
xunit:3.1.6

What Operating System are you using (both controller, and any agents involved in the problem)?

controller ist debian, agents are Windows 10/11

Reproduction steps

We have a pipeline that does multiple checkous, more or less in short:

node('windows&&nodejs') {
  checkout scm;
}
node('windows&&nodejs') {
  checkout scm;
  // ...
  recordIssues(qualityGates: [[threshold: 1, type: 'NEW_MODIFIED', unstable: false]], skipBlames: true, ignoreQualityGate: true)
}

Triggered by a Multibranch Pipeline with the gitlab source plugin with Discover merge requests from origin and Merging the merge request with the current target branch revision

The first checkout now does:

> git merge 78cb8b3f5de656cd404c88d36b0e0a475a96a781 # timeout=10
 Merge succeeded, producing d9a65f617951ac47ae104b958fdf5c4f04bb1fd4
 Checking out Revision d9a65f617951ac47ae104b958fdf5c4f04bb1fd4 (feature-AUF-4086-unified-pipeline)
 Commit message: "Merge commit '78cb8b3f5de656cd404c88d36b0e0a475a96a781' into HEAD"
...
 [GitCheckoutListener] Recording commits of 'git git@git.tetys.de:grp/src.git'
 [GitCheckoutListener] Found previous build 'Gitlab-Cpp-multiarch/MR-11575 #16' that contains recorded Git commits
 [GitCheckoutListener] -> Starting recording of new commits since '8b5877c'
 [GitCheckoutListener] -> Multiple parent commits found - storing latest commit of local merge 'd9a65f6'
 [GitCheckoutListener] -> Using parent commit 'a590118' of local merge as starting point
 [GitCheckoutListener] -> Storing target branch head '78cb8b3' (second parent of local merge) 
 [GitCheckoutListener] -> Recorded 200 new commits
 [GitCheckoutListener] -> The latest commit 'd9a65f617951ac47ae104b958fdf5c4f04bb1fd4' is a merge commit
 [GitCheckoutListener] -> Git commit decorator successfully obtained 'io.jenkins.plugins.gitlabbranchsource.helpers.GitLabBrowser@41ee4404' to render commit links

and the second (order is strange):

> git config --get remote.origin.url # timeout=10
 using GIT_SSH to set credentials SSH (login to GitLab)
 Merge succeeded, producing 0bc83fcc18516b2f8cc02a223df58ee261947f6b
 Checking out Revision 0bc83fcc18516b2f8cc02a223df58ee261947f6b (feature-AUF-4086-unified-pipeline)
 Commit message: "Merge commit '78cb8b3f5de656cd404c88d36b0e0a475a96a781' into HEAD"
 First time build. Skipping changelog.
 Verifying host key using known hosts file, will automatically accept unseen keys
  > git merge 78cb8b3f5de656cd404c88d36b0e0a475a96a781 # timeout=10
...
 [GitCheckoutListener] Skipping recording, since SCM 'git git@git.tetys.de:grp/src.git' already has been processed

It then fails with:

 > git rev-parse "HEAD^{commit}" # timeout=10
 [MSVC Win32-Debug] Obtaining reference build from reference recorder
 [MSVC Win32-Debug] -> Found 'develop-Cpp-Debug #1772'
 [MSVC Win32-Debug] Quality gate successful for reference build 'develop-Cpp-Debug #1772', using this build as reference
 [MSVC Win32-Debug] Using reference build 'develop-Cpp-Debug #1772' to compute new, fixed, and outstanding issues
 [MSVC Win32-Debug] Issues delta (vs. reference build): outstanding: 3841, new: 1, fixed: 0
 [MSVC Win32-Debug] Detect all issues that are part of modified code
 [MSVC Win32-Debug] No relevant modified code found
 [MSVC Win32-Debug] Evaluating quality gates
 [MSVC Win32-Debug] -> All quality gates have been passed
 [MSVC Win32-Debug] -> Details for each quality gate:
 [MSVC Win32-Debug]    - [New (in modified code)]: ≪Success≫ - (Actual value: 0, Quality gate: 1.00)
 [MSVC Win32-Debug] Health report is disabled - skipping
 [MSVC Win32-Debug] Created analysis result for 3842 issues (found 1 new issues, fixed 0 issues)
 [MSVC Win32-Debug] Attaching ResultAction with ID 'msvc-win32-debug' to build 'Gitlab-Cpp-multiarch/MR-11575 #17'.
 [MSVC Win32-Debug] [-ERROR-] Errors while computing delta: 
 [MSVC Win32-Debug] [-ERROR-] Calculating the Git code delta is not possible due to an unknown commit ID

Expected Results

It should use the commit from the current checkout and not some commit from another checkout which is not accessible.

Actual Results

It tries to reference a merge commit which was produces in another checkout at another node.

Anything else?

No response

Are you interested in contributing a fix?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Fields

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions