Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-64889

p4 fetches builds changes (individual changelist details) unsafely, can save wrong changes

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor Minor
    • p4-plugin
    • None
    • Jenkins 2.269
      p4-jenkins 1.11.1

      Summary

      The plugin uses p4 changes -m20 //CLIENT/...@CL1,LAST_CL to fetch the changelog since the previous build.

      But it uses p4 changes -l -m1 @CL to fetch the details of each change, without scoping it to the Perforce client/workspace. The @CL filter without a file pattern doesn't seem to always work properly and can return any recent CL from the Perforce server, even from different repositories.

      Respective code paths – Checkout.getChangesFull() calls:

      Symptoms

      We noticed the following on a recent build's Perforce sync:

      ...
      (p4):cmd:... p4 changes -m20 //jenkins-[WORKSPACE-ID]___
      p4 changes -m20 //jenkins-[WORKSPACE-ID]-0/...@3574547,3575421
      
      Change 3575421 on 2021/02/09 by X@Y ...
      Change 3575321 on 2021/02/09 by X@Y ...
      Change 3574547 on 2021/02/08 by X@Y ...
      (p4):stop:8
      (p4):cmd:... p4 changes -l -m1 @3575421
      p4 changes -l -m1 @3575421
      
      Change 3575420 on 2021/02/09 by swarmadmin@swarm-2c02b25f-[snip] *pending* [snip CL description]
      (p4):stop:9
      (p4):cmd:... p4 user -o swarmadmin
      p4 user -o swarmadmin
      
      (p4):stop:10
      (p4):cmd:... p4 describe -s -S 3575420
      p4 describe -s -S 3575420
      
      (p4):stop:11
      (p4):cmd:... p4 fixes -c3575420
      p4 fixes -c3575420
      
      (p4):stop:12
      (p4):cmd:... p4 changes -l -m1 @3575321
      p4 changes -l -m1 @3575321
      
      Change 3575321 on 2021/02/09 by X@Y ...
      ..
      • p4-jenkins found CLs 3575421, 3575321 for the build changes (+ 3574547 from previous build/syncID)
      • Fetching details for CL 3575421 found... CL 3575420????
      • Fetching details for CL 3575321 found 3575321 details
      • → CLs 3575420 and 3575321 are saved in the Jenkins build's "changes".

      After testing the behaviour of p4 changes -l -m1 @X I'm surprised this works at all for most CLs (3575321 above), the command seems to always return the very latest CL on the entire Perforce server when I run it locally:

      > p4 changes -l -m1 @3575321
      Change 3578492 on 2021/02/16 by Y@Z...

       

      We have configured our builds with email-ext to send notifications to "culprits", i.e. all CL authors that led to a build failure. As this relies on the changes recorded by p4-jenkins, the wrong changes can notify the wrong people.
      Our case above ended up emailing our IT department (swarmadmin) as the owner of that Swarm change that was completely unrelated to the build.

      (internal ref: stresstest#130)

          [JENKINS-64889] p4 fetches builds changes (individual changelist details) unsafely, can save wrong changes

          Adrien Siebert created issue -
          Adrien Siebert made changes -
          Description Original: h3. Summary

          The plugin uses {{p4 changes -m20 {color:#de350b}//CLIENT/...@{color}CL1,LAST_CL}} to fetch the changelog since the previous build.

          But it uses {{p4 changes -l -m1 {color:#de350b}@{color}CL}} to fetch the details of each change, without scoping it to the Perforce client/workspace. The {{@}}{{CL}} filter without a file pattern doesn't seem to always work properly and _can return any(?)_ recent CL from the Perforce server, even from different repositories.

          Respective code paths -- [{{Checkout.getChangesFull()}}|https://github.com/jenkinsci/p4-plugin/blob/p4-1.11.1/src/main/java/org/jenkinsci/plugins/p4/tasks/CheckoutTask.java#L313-L317] calls:
           * To get the list, {{ClientHelper.listChanges()}} that adds the scope: [jenkinsci/p4-plugin/...p4/client/ClientHelper.java#L1208-L1209|https://github.com/jenkinsci/p4-plugin/blob/p4-1.11.1/src/main/java/org/jenkinsci/plugins/p4/client/ClientHelper.java#L1208-L1209]
           * To get individual changes, {{change.getChangeEntry()}} for a P4ChangeRef -> {{ConnectionHelper.getChangeSummary(id)}} that doesn't add the scope: [jenkinsci/p4-plugin/...ConnectionHelper.java#L405-L410|https://github.com/jenkinsci/p4-plugin/blob/p4-1.11.1/src/main/java/org/jenkinsci/plugins/p4/client/ConnectionHelper.java#L405-L410]

          h3. Symptoms

          We noticed the following on a recent build's Perforce sync:
          {code:java}
          ...
          (p4):cmd:... p4 changes -m20 //jenkins-[WORKSPACE-ID]___
          p4 changes -m20 //jenkins-[WORKSPACE-ID]-0/...@3574547,3575421

          Change 3575421 on 2021/02/09 by X@Y ...
          Change 3575321 on 2021/02/09 by X@Y ...
          Change 3574547 on 2021/02/08 by X@Y ...
          (p4):stop:8
          (p4):cmd:... p4 changes -l -m1 @3575421
          p4 changes -l -m1 @3575421

          Change 3575420 on 2021/02/09 by swarmadmin@swarm-2c02b25f-[snip] *pending* [snip CL description]
          (p4):stop:9
          (p4):cmd:... p4 user -o swarmadmin
          p4 user -o swarmadmin

          (p4):stop:10
          (p4):cmd:... p4 describe -s -S 3575420
          p4 describe -s -S 3575420

          (p4):stop:11
          (p4):cmd:... p4 fixes -c3575420
          p4 fixes -c3575420

          (p4):stop:12
          (p4):cmd:... p4 changes -l -m1 @3575321
          p4 changes -l -m1 @3575321

          Change 3575321 on 2021/02/09 by X@Y ...
          ..{code}
           * p4-jenkins found CLs 3575421, 3575321 for the build changes (+ 3574547 from previous build/syncID)
           * Fetching details for CL 3575421 found... CL 3575420????
           * Fetching details for CL 3575321 found 3575321 details

          After testing the behaviour of {{p4 changes -l -m1 @X}} I'm surprised this works at all for most CLs (3575321 above), the command seems to always return the very latest CL on the entire Perforce server when I run it locally:
          {code:java}
          > p4 changes -l -m1 @3575321
          Change 3578492 on 2021/02/16 by Y@Z...{code}
           

          We have configured our builds with [email-ext|https://plugins.jenkins.io/email-ext/] to send notifications to "culprits", i.e. all CL authors that led to a build failure. As this relies on the changes recorded by p4-jenkins, the wrong changes can notify the wrong people.
          Our case above ended up emailing our IT department (_swarmadmin_) as the owner of that Swarm change that was completely unrelated to the build.

          _(internal ref: stresstest#130)_
          New: h3. Summary

          The plugin uses {{p4 changes -m20 {color:#de350b}//CLIENT/...@{color}CL1,LAST_CL}} to fetch the changelog since the previous build.

          But it uses {{p4 changes -l -m1 {color:#de350b}@{color}CL}} to fetch the details of each change, without scoping it to the Perforce client/workspace. The {{@}}{{CL}} filter without a file pattern doesn't seem to always work properly and _can return any(?)_ recent CL from the Perforce server, even from different repositories.

          Respective code paths – [{{Checkout.getChangesFull()}}|https://github.com/jenkinsci/p4-plugin/blob/p4-1.11.1/src/main/java/org/jenkinsci/plugins/p4/tasks/CheckoutTask.java#L313-L317] calls:
           * To get the list, {{ClientHelper.listChanges()}} that adds the scope: [jenkinsci/p4-plugin/...p4/client/ClientHelper.java#L1208-L1209|https://github.com/jenkinsci/p4-plugin/blob/p4-1.11.1/src/main/java/org/jenkinsci/plugins/p4/client/ClientHelper.java#L1208-L1209]
           * To get individual changes, {{change.getChangeEntry()}} for a P4ChangeRef -> {{ConnectionHelper.getChangeSummary(id)}} that doesn't add the scope: [jenkinsci/p4-plugin/...ConnectionHelper.java#L405-L410|https://github.com/jenkinsci/p4-plugin/blob/p4-1.11.1/src/main/java/org/jenkinsci/plugins/p4/client/ConnectionHelper.java#L405-L410]

          h3. Symptoms

          We noticed the following on a recent build's Perforce sync:
          {code:java}
          ...
          (p4):cmd:... p4 changes -m20 //jenkins-[WORKSPACE-ID]___
          p4 changes -m20 //jenkins-[WORKSPACE-ID]-0/...@3574547,3575421

          Change 3575421 on 2021/02/09 by X@Y ...
          Change 3575321 on 2021/02/09 by X@Y ...
          Change 3574547 on 2021/02/08 by X@Y ...
          (p4):stop:8
          (p4):cmd:... p4 changes -l -m1 @3575421
          p4 changes -l -m1 @3575421

          Change 3575420 on 2021/02/09 by swarmadmin@swarm-2c02b25f-[snip] *pending* [snip CL description]
          (p4):stop:9
          (p4):cmd:... p4 user -o swarmadmin
          p4 user -o swarmadmin

          (p4):stop:10
          (p4):cmd:... p4 describe -s -S 3575420
          p4 describe -s -S 3575420

          (p4):stop:11
          (p4):cmd:... p4 fixes -c3575420
          p4 fixes -c3575420

          (p4):stop:12
          (p4):cmd:... p4 changes -l -m1 @3575321
          p4 changes -l -m1 @3575321

          Change 3575321 on 2021/02/09 by X@Y ...
          ..{code}
           * p4-jenkins found CLs {color:#00875a}{color:#0747a6}3575421{color}, 3575321{color} for the build changes (+ 3574547 from previous build/syncID)
           * Fetching details for CL {color:#0747a6}3575421 {color}found... CL {color:#de350b}3575420{color}????
           * Fetching details for CL {color:#00875a}3575321{color} found {color:#00875a}3575321{color} details
           * → CLs {color:#de350b}3575420{color} and {color:#00875a}3575321{color} are saved in the Jenkins build's "changes".

          After testing the behaviour of {{p4 changes -l -m1 @X}} I'm surprised this works at all for most CLs (3575321 above), the command seems to always return the very latest CL on the entire Perforce server when I run it locally:
          {code:java}
          > p4 changes -l -m1 @3575321
          Change 3578492 on 2021/02/16 by Y@Z...{code}
           

          We have configured our builds with [email-ext|https://plugins.jenkins.io/email-ext/] to send notifications to "culprits", i.e. all CL authors that led to a build failure. As this relies on the changes recorded by p4-jenkins, the wrong changes can notify the wrong people.
           Our case above ended up emailing our IT department (_swarmadmin_) as the owner of that Swarm change that was completely unrelated to the build.

          _(internal ref: stresstest#130)_
          Adrien Siebert made changes -
          Description Original: h3. Summary

          The plugin uses {{p4 changes -m20 {color:#de350b}//CLIENT/...@{color}CL1,LAST_CL}} to fetch the changelog since the previous build.

          But it uses {{p4 changes -l -m1 {color:#de350b}@{color}CL}} to fetch the details of each change, without scoping it to the Perforce client/workspace. The {{@}}{{CL}} filter without a file pattern doesn't seem to always work properly and _can return any(?)_ recent CL from the Perforce server, even from different repositories.

          Respective code paths – [{{Checkout.getChangesFull()}}|https://github.com/jenkinsci/p4-plugin/blob/p4-1.11.1/src/main/java/org/jenkinsci/plugins/p4/tasks/CheckoutTask.java#L313-L317] calls:
           * To get the list, {{ClientHelper.listChanges()}} that adds the scope: [jenkinsci/p4-plugin/...p4/client/ClientHelper.java#L1208-L1209|https://github.com/jenkinsci/p4-plugin/blob/p4-1.11.1/src/main/java/org/jenkinsci/plugins/p4/client/ClientHelper.java#L1208-L1209]
           * To get individual changes, {{change.getChangeEntry()}} for a P4ChangeRef -> {{ConnectionHelper.getChangeSummary(id)}} that doesn't add the scope: [jenkinsci/p4-plugin/...ConnectionHelper.java#L405-L410|https://github.com/jenkinsci/p4-plugin/blob/p4-1.11.1/src/main/java/org/jenkinsci/plugins/p4/client/ConnectionHelper.java#L405-L410]

          h3. Symptoms

          We noticed the following on a recent build's Perforce sync:
          {code:java}
          ...
          (p4):cmd:... p4 changes -m20 //jenkins-[WORKSPACE-ID]___
          p4 changes -m20 //jenkins-[WORKSPACE-ID]-0/...@3574547,3575421

          Change 3575421 on 2021/02/09 by X@Y ...
          Change 3575321 on 2021/02/09 by X@Y ...
          Change 3574547 on 2021/02/08 by X@Y ...
          (p4):stop:8
          (p4):cmd:... p4 changes -l -m1 @3575421
          p4 changes -l -m1 @3575421

          Change 3575420 on 2021/02/09 by swarmadmin@swarm-2c02b25f-[snip] *pending* [snip CL description]
          (p4):stop:9
          (p4):cmd:... p4 user -o swarmadmin
          p4 user -o swarmadmin

          (p4):stop:10
          (p4):cmd:... p4 describe -s -S 3575420
          p4 describe -s -S 3575420

          (p4):stop:11
          (p4):cmd:... p4 fixes -c3575420
          p4 fixes -c3575420

          (p4):stop:12
          (p4):cmd:... p4 changes -l -m1 @3575321
          p4 changes -l -m1 @3575321

          Change 3575321 on 2021/02/09 by X@Y ...
          ..{code}
           * p4-jenkins found CLs {color:#00875a}{color:#0747a6}3575421{color}, 3575321{color} for the build changes (+ 3574547 from previous build/syncID)
           * Fetching details for CL {color:#0747a6}3575421 {color}found... CL {color:#de350b}3575420{color}????
           * Fetching details for CL {color:#00875a}3575321{color} found {color:#00875a}3575321{color} details
           * → CLs {color:#de350b}3575420{color} and {color:#00875a}3575321{color} are saved in the Jenkins build's "changes".

          After testing the behaviour of {{p4 changes -l -m1 @X}} I'm surprised this works at all for most CLs (3575321 above), the command seems to always return the very latest CL on the entire Perforce server when I run it locally:
          {code:java}
          > p4 changes -l -m1 @3575321
          Change 3578492 on 2021/02/16 by Y@Z...{code}
           

          We have configured our builds with [email-ext|https://plugins.jenkins.io/email-ext/] to send notifications to "culprits", i.e. all CL authors that led to a build failure. As this relies on the changes recorded by p4-jenkins, the wrong changes can notify the wrong people.
           Our case above ended up emailing our IT department (_swarmadmin_) as the owner of that Swarm change that was completely unrelated to the build.

          _(internal ref: stresstest#130)_
          New: h3. Summary

          The plugin uses {{p4 changes -m20 {color:#de350b}//CLIENT/...@{color}CL1,LAST_CL}} to fetch the changelog since the previous build.

          But it uses {{p4 changes -l -m1 {color:#de350b}@{color}CL}} to fetch the details of each change, without scoping it to the Perforce client/workspace. The {{@}}{{CL}} filter without a file pattern doesn't seem to always work properly and _can return any(?)_ recent CL from the Perforce server, even from different repositories.

          Respective code paths – [{{Checkout.getChangesFull()}}|https://github.com/jenkinsci/p4-plugin/blob/p4-1.11.1/src/main/java/org/jenkinsci/plugins/p4/tasks/CheckoutTask.java#L313-L317] calls:
           * To get the list, {{ClientHelper.listChanges()}} that adds the scope: [jenkinsci/p4-plugin/...p4/client/ClientHelper.java#L1208-L1209|https://github.com/jenkinsci/p4-plugin/blob/p4-1.11.1/src/main/java/org/jenkinsci/plugins/p4/client/ClientHelper.java#L1208-L1209]
           * To get individual changes, {{change.getChangeEntry()}} for a P4ChangeRef -> {{ConnectionHelper.getChangeSummary(id)}} that doesn't add the scope: [jenkinsci/p4-plugin/...ConnectionHelper.java#L405-L410|https://github.com/jenkinsci/p4-plugin/blob/p4-1.11.1/src/main/java/org/jenkinsci/plugins/p4/client/ConnectionHelper.java#L405-L410]

          h3. Symptoms

          We noticed the following on a recent build's Perforce sync:
          {code:java}
          ...
          (p4):cmd:... p4 changes -m20 //jenkins-[WORKSPACE-ID]___
          p4 changes -m20 //jenkins-[WORKSPACE-ID]-0/...@3574547,3575421

          Change 3575421 on 2021/02/09 by X@Y ...
          Change 3575321 on 2021/02/09 by X@Y ...
          Change 3574547 on 2021/02/08 by X@Y ...
          (p4):stop:8
          (p4):cmd:... p4 changes -l -m1 @3575421
          p4 changes -l -m1 @3575421

          Change 3575420 on 2021/02/09 by swarmadmin@swarm-2c02b25f-[snip] *pending* [snip CL description]
          (p4):stop:9
          (p4):cmd:... p4 user -o swarmadmin
          p4 user -o swarmadmin

          (p4):stop:10
          (p4):cmd:... p4 describe -s -S 3575420
          p4 describe -s -S 3575420

          (p4):stop:11
          (p4):cmd:... p4 fixes -c3575420
          p4 fixes -c3575420

          (p4):stop:12
          (p4):cmd:... p4 changes -l -m1 @3575321
          p4 changes -l -m1 @3575321

          Change 3575321 on 2021/02/09 by X@Y ...
          ..{code}
           * p4-jenkins found CLs {color:#0747a6}{color:#00875a}3575421{color}{color}, {color:#00875a}3575321{color} for the build changes (+ 3574547 from previous build/syncID)
           * Fetching details for CL 3575421 found... CL {color:#de350b}3575420{color}????
           * Fetching details for CL {color:#00875a}3575321{color} found {color:#00875a}3575321{color} details
           * → CLs {color:#de350b}3575420{color} and {color:#00875a}3575321{color} are saved in the Jenkins build's "changes".

          After testing the behaviour of {{p4 changes -l -m1 @X}} I'm surprised this works at all for most CLs (3575321 above), the command seems to always return the very latest CL on the entire Perforce server when I run it locally:
          {code:java}
          > p4 changes -l -m1 @3575321
          Change 3578492 on 2021/02/16 by Y@Z...{code}
           

          We have configured our builds with [email-ext|https://plugins.jenkins.io/email-ext/] to send notifications to "culprits", i.e. all CL authors that led to a build failure. As this relies on the changes recorded by p4-jenkins, the wrong changes can notify the wrong people.
           Our case above ended up emailing our IT department (_swarmadmin_) as the owner of that Swarm change that was completely unrelated to the build.

          _(internal ref: stresstest#130)_
          Adrien Siebert made changes -
          Description Original: h3. Summary

          The plugin uses {{p4 changes -m20 {color:#de350b}//CLIENT/...@{color}CL1,LAST_CL}} to fetch the changelog since the previous build.

          But it uses {{p4 changes -l -m1 {color:#de350b}@{color}CL}} to fetch the details of each change, without scoping it to the Perforce client/workspace. The {{@}}{{CL}} filter without a file pattern doesn't seem to always work properly and _can return any(?)_ recent CL from the Perforce server, even from different repositories.

          Respective code paths – [{{Checkout.getChangesFull()}}|https://github.com/jenkinsci/p4-plugin/blob/p4-1.11.1/src/main/java/org/jenkinsci/plugins/p4/tasks/CheckoutTask.java#L313-L317] calls:
           * To get the list, {{ClientHelper.listChanges()}} that adds the scope: [jenkinsci/p4-plugin/...p4/client/ClientHelper.java#L1208-L1209|https://github.com/jenkinsci/p4-plugin/blob/p4-1.11.1/src/main/java/org/jenkinsci/plugins/p4/client/ClientHelper.java#L1208-L1209]
           * To get individual changes, {{change.getChangeEntry()}} for a P4ChangeRef -> {{ConnectionHelper.getChangeSummary(id)}} that doesn't add the scope: [jenkinsci/p4-plugin/...ConnectionHelper.java#L405-L410|https://github.com/jenkinsci/p4-plugin/blob/p4-1.11.1/src/main/java/org/jenkinsci/plugins/p4/client/ConnectionHelper.java#L405-L410]

          h3. Symptoms

          We noticed the following on a recent build's Perforce sync:
          {code:java}
          ...
          (p4):cmd:... p4 changes -m20 //jenkins-[WORKSPACE-ID]___
          p4 changes -m20 //jenkins-[WORKSPACE-ID]-0/...@3574547,3575421

          Change 3575421 on 2021/02/09 by X@Y ...
          Change 3575321 on 2021/02/09 by X@Y ...
          Change 3574547 on 2021/02/08 by X@Y ...
          (p4):stop:8
          (p4):cmd:... p4 changes -l -m1 @3575421
          p4 changes -l -m1 @3575421

          Change 3575420 on 2021/02/09 by swarmadmin@swarm-2c02b25f-[snip] *pending* [snip CL description]
          (p4):stop:9
          (p4):cmd:... p4 user -o swarmadmin
          p4 user -o swarmadmin

          (p4):stop:10
          (p4):cmd:... p4 describe -s -S 3575420
          p4 describe -s -S 3575420

          (p4):stop:11
          (p4):cmd:... p4 fixes -c3575420
          p4 fixes -c3575420

          (p4):stop:12
          (p4):cmd:... p4 changes -l -m1 @3575321
          p4 changes -l -m1 @3575321

          Change 3575321 on 2021/02/09 by X@Y ...
          ..{code}
           * p4-jenkins found CLs {color:#0747a6}{color:#00875a}3575421{color}{color}, {color:#00875a}3575321{color} for the build changes (+ 3574547 from previous build/syncID)
           * Fetching details for CL 3575421 found... CL {color:#de350b}3575420{color}????
           * Fetching details for CL {color:#00875a}3575321{color} found {color:#00875a}3575321{color} details
           * → CLs {color:#de350b}3575420{color} and {color:#00875a}3575321{color} are saved in the Jenkins build's "changes".

          After testing the behaviour of {{p4 changes -l -m1 @X}} I'm surprised this works at all for most CLs (3575321 above), the command seems to always return the very latest CL on the entire Perforce server when I run it locally:
          {code:java}
          > p4 changes -l -m1 @3575321
          Change 3578492 on 2021/02/16 by Y@Z...{code}
           

          We have configured our builds with [email-ext|https://plugins.jenkins.io/email-ext/] to send notifications to "culprits", i.e. all CL authors that led to a build failure. As this relies on the changes recorded by p4-jenkins, the wrong changes can notify the wrong people.
           Our case above ended up emailing our IT department (_swarmadmin_) as the owner of that Swarm change that was completely unrelated to the build.

          _(internal ref: stresstest#130)_
          New: h3. Summary

          The plugin uses {{p4 changes -m20 {color:#de350b}//CLIENT/...@{color}CL1,LAST_CL}} to fetch the changelog since the previous build.

          But it uses {{p4 changes -l -m1 {color:#de350b}@{color}CL}} to fetch the details of each change, without scoping it to the Perforce client/workspace. The {{@}}{{CL}} filter without a file pattern doesn't seem to always work properly and _can return any(?)_ recent CL from the Perforce server, even from different repositories.

          Respective code paths – [{{Checkout.getChangesFull()}}|https://github.com/jenkinsci/p4-plugin/blob/p4-1.11.1/src/main/java/org/jenkinsci/plugins/p4/tasks/CheckoutTask.java#L313-L317] calls:
           * To get the list, {{ClientHelper.listChanges()}} that adds the scope: [jenkinsci/p4-plugin/...p4/client/ClientHelper.java#L1208-L1209|https://github.com/jenkinsci/p4-plugin/blob/p4-1.11.1/src/main/java/org/jenkinsci/plugins/p4/client/ClientHelper.java#L1208-L1209]
           * To get individual changes, {{change.getChangeEntry()}} for a P4ChangeRef -> {{ConnectionHelper.getChangeSummary(id)}} that doesn't add the scope: [jenkinsci/p4-plugin/...ConnectionHelper.java#L405-L410|https://github.com/jenkinsci/p4-plugin/blob/p4-1.11.1/src/main/java/org/jenkinsci/plugins/p4/client/ConnectionHelper.java#L405-L410]

          h3. Symptoms

          We noticed the following on a recent build's Perforce sync:
          {code:java}
          ...
          (p4):cmd:... p4 changes -m20 //jenkins-[WORKSPACE-ID]___
          p4 changes -m20 //jenkins-[WORKSPACE-ID]-0/...@3574547,3575421

          Change 3575421 on 2021/02/09 by X@Y ...
          Change 3575321 on 2021/02/09 by X@Y ...
          Change 3574547 on 2021/02/08 by X@Y ...
          (p4):stop:8
          (p4):cmd:... p4 changes -l -m1 @3575421
          p4 changes -l -m1 @3575421

          Change 3575420 on 2021/02/09 by swarmadmin@swarm-2c02b25f-[snip] *pending* [snip CL description]
          (p4):stop:9
          (p4):cmd:... p4 user -o swarmadmin
          p4 user -o swarmadmin

          (p4):stop:10
          (p4):cmd:... p4 describe -s -S 3575420
          p4 describe -s -S 3575420

          (p4):stop:11
          (p4):cmd:... p4 fixes -c3575420
          p4 fixes -c3575420

          (p4):stop:12
          (p4):cmd:... p4 changes -l -m1 @3575321
          p4 changes -l -m1 @3575321

          Change 3575321 on 2021/02/09 by X@Y ...
          ..{code}
           * p4-jenkins found CLs {color:#0747a6}3575421{color}, {color:#00875a}3575321{color} for the build changes (+ 3574547 from previous build/syncID)
           * Fetching details for CL {color:#0747a6}3575421{color} found... CL {color:#de350b}3575420{color}????
           * Fetching details for CL {color:#00875a}3575321{color} found {color:#00875a}3575321{color} details
           * → CLs {color:#de350b}3575420{color} and {color:#00875a}3575321{color} are saved in the Jenkins build's "changes".

          After testing the behaviour of {{p4 changes -l -m1 @X}} I'm surprised this works at all for most CLs (3575321 above), the command seems to always return the very latest CL on the entire Perforce server when I run it locally:
          {code:java}
          > p4 changes -l -m1 @3575321
          Change 3578492 on 2021/02/16 by Y@Z...{code}
           

          We have configured our builds with [email-ext|https://plugins.jenkins.io/email-ext/] to send notifications to "culprits", i.e. all CL authors that led to a build failure. As this relies on the changes recorded by p4-jenkins, the wrong changes can notify the wrong people.
           Our case above ended up emailing our IT department (_swarmadmin_) as the owner of that Swarm change that was completely unrelated to the build.

          _(internal ref: stresstest#130)_
          Karl Wirth made changes -
          Assignee New: Karl Wirth [ p4karl ]

            p4karl Karl Wirth
            r_asiebert Adrien Siebert
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: