[JIRA] [p4-plugin] (JENKINS-29296) P4 Plugin: Downstream job not using correct changelist

130 views
Skip to first unread message

martin.a.hulth@intel.com (JIRA)

unread,
Jul 8, 2015, 3:08:01 PM7/8/15
to jenkinsc...@googlegroups.com
Martin Hulth created an issue
 
Jenkins / Bug JENKINS-29296
P4 Plugin: Downstream job not using correct changelist
Issue Type: Bug Bug
Assignee: Paul Allen
Components: p4-plugin
Created: 08/Jul/15 7:07 PM
Environment: Jenkins ver. 1.613 | P4 Plugin 1.2.4 | Build Flow 0.17 | Java 1.7.0_25 (32-bit) | Win8.1 (64-bit)
Labels: p4-plugin
Priority: Major Major
Reporter: Martin Hulth

I have a build flow that gets triggered by an SCMTRIGGER (ie "Polling per change"). It creates a downstream build job where the expectation is that it would use the SCMTRIGGER changelist to sync on. This is not the case, however, if a checkin has occured after the initial job was triggered. It will pick up all changes and sync to the latest for the downstream build.

When I look at the env vars for the downstream job, I see both a CHANGELIST and a P4_CHANGELIST. The first one is the correct CL, the other is the wrong CL for this job. An easy fix would be to use the CHANGELIST instead of the P4_CHANGELIST to sync on. (Can I override the P4_CHANGELIST as a build parameter being passed in??)

Here is a breakdown of the initial SCMTRIGGER postcheckin job and the subsequent DOWNSTREAM build job it spawned (Perforce changes followed by pertinent env vars for each):

////////////////////////////////////////////////////////////////////////////////////////////
// Build #809 (SCMTRIGGER)
////////////////////////////////////////////////////////////////////////////////////////////

POLLING LOG:
------------

View as plain text
This page captures the polling log that triggered this build.

Started on Jul 7, 2015 6:09:47 PM
Polling SCM changes on master
P4: Polling on: master with:jenkins_XXX_postcheckin
... p4 client -o jenkins_XXX_postcheckin
+

P4 Task: establishing connection.
... server: perforce.XXX.com:3666
... node: XXX001
... p4 cstat //jenkins_XXX_postcheckin/...
+
P4: Polling with label/change: 441291,now
... p4 changes -m100 //jenkins_XXX_postcheckin/...@441291,now
+
... p4 change -o 441300
+
... p4 describe -s 441300
+
... found change: 441300
next change: 441300
Done. Took 1.6 sec
Changes found

ENVIRONMENT VARIABLES:
----------------------

...
BUILD_CAUSE SCMTRIGGER,SCMTRIGGER
BUILD_CAUSE_SCMTRIGGER true
BUILD_DISPLAY_NAME #809
BUILD_ID 809
BUILD_NUMBER 809
...
EXECUTOR_NUMBER -1
...
JOB_NAME postcheckin_XXX
...
NODE_LABELS master
...
ROOT_BUILD_CAUSE SCMTRIGGER
ROOT_BUILD_CAUSE_SCMTRIGGER true
...

////////////////////////////////////////////////////////////////////////////////////////////
// Build #5649 (UPSTREAMTRIGGER)
////////////////////////////////////////////////////////////////////////////////////////////

CHANGES:
--------

441304 by XXX on Jul 7, 2015 6:23:17 AM
...
441300 by XXX on Jul 7, 2015 6:08:44 AM

ENVIRONMENT VARIABLES:
----------------------
...
BUILD_CAUSE UPSTREAMTRIGGER
BUILD_CAUSE_UPSTREAMTRIGGER true
BUILD_DISPLAY_NAME #5649
BUILD_ID 5649
BUILD_NUMBER 5649
...
CHANGELIST 441300 <=============== This is the CORRECT upstream CL
...
EXECUTOR_NUMBER 0
...
JOB_NAME build_XXX
...
NODE_LABELS build_pool
...
P4_CHANGELIST 441304 <=============== This is the INCORRECT latest CL
P4_CLIENT jenkins_XXX_build
...
ROOT_BUILD_CAUSE SCMTRIGGER
ROOT_BUILD_CAUSE_SCMTRIGGER true
...

Add Comment Add Comment
 
This message was sent by Atlassian JIRA (v6.4.2#64017-sha1:e244265)
Atlassian logo

pallen@perforce.com (JIRA)

unread,
Jul 9, 2015, 8:58:01 AM7/9/15
to jenkinsc...@googlegroups.com
Paul Allen commented on Bug JENKINS-29296
 
Re: P4 Plugin: Downstream job not using correct changelist

You can use 'change' (as a build parameter) to override the changelist that 'p4' will use for the sync.

Did you raise this with our support team? It's just I have had a very similar question from support.

I'm not familiar with mechanics of the Build Flow plugin, I'll need to setup a test environment to see if I can reproduce this. Do let me know if setting 'change' works as an alternative.

martin.a.hulth@intel.com (JIRA)

unread,
Jul 10, 2015, 2:18:01 PM7/10/15
to jenkinsc...@googlegroups.com

Setting 'change' as a parameter worked like a charm. That works for me for now. Thanks.

I think the CHANGELIST var is commonly used - not just in the Build Flow plugin, but the old Perforce plugin as well (though you should verify that). My assumption was that your plugin was using it as well. I'm fine with using the "change" var going forward.

Not sure who sets the P4_CHANGELIST var, though, as I assumed it was your plugin. I'm not using it so I really don't care one way or the other there.

I have not contacted the support team regarding this btw.

martin.a.hulth@intel.com (JIRA)

unread,
Jul 10, 2015, 2:19:01 PM7/10/15
to jenkinsc...@googlegroups.com
Martin Hulth edited a comment on Bug JENKINS-29296
Setting 'change' as a parameter worked like a charm.  That works  This suits my needs  for  me for  now. Thanks.

I think the CHANGELIST var is commonly used - not just in the Build Flow plugin, but the old Perforce plugin as well
 (  - though you should verify  that)  if it is a standard Jenkins SCM environment var . My assumption was that your plugin was using it as well. I'm fine with using the "change" var going forward.


Not sure who sets the P4_CHANGELIST var, though, as I assumed it was your plugin. I'm not using it so I really don't care one way or the other there.

I have not contacted the support team regarding this btw.

martin.a.hulth@intel.com (JIRA)

unread,
Jul 10, 2015, 5:44:01 PM7/10/15
to jenkinsc...@googlegroups.com
Martin Hulth edited a comment on Bug JENKINS-29296
Setting 'change' as a parameter worked like a charm. This suits my needs for now. Thanks.

I think the CHANGELIST var is commonly used - not just in the Build Flow plugin, but the old Perforce plugin as well - though you should verify if it is a standard Jenkins SCM environment var. My assumption was that your plugin was using it as well. I'm fine with using the "change" var going forward.


Not sure who sets the P4_CHANGELIST var, though, as I assumed it was your plugin. I'm not using it so I really don't care one way or the other there.

I have not contacted the support team regarding this btw.


EDIT: I'm actually not sure who sets P4_CHANGELIST vs CHANGELIST for various types of jobs. Verify that if you intend to use either, but "change" works fine for me now as a parameter I pass in.

pallen@perforce.com (JIRA)

unread,
Jul 13, 2015, 4:55:01 AM7/13/15
to jenkinsc...@googlegroups.com

Glad to hear this has resolved your issue. The 'change' param is used by the 'Perforce Swarm' review integration and is read at the start of the build. I added P4_CHANGELIST early on in development, to help downstream Jobs and labels, but it is not read at the start of a build.

I don't know where CHANGELIST is set perhaps another plugin?

pallen@perforce.com (JIRA)

unread,
Jul 13, 2015, 5:02:01 AM7/13/15
to jenkinsc...@googlegroups.com
Paul Allen resolved as Fixed
 

Use the 'change' param to set the change and P4_CHANGELIST to evaluate the change used in the build.

Note: their values may not be the same.

For example, take a code line //depot/projA/src/... with changes:
change 196 'Fix A'
change 198 'Fix B'
change 204 'Feature X'

Setting 'change' to 200 will build from that change, but the last submitted change under the code line might be 198, so P4_CHANGELIST will report 198.

Change By: Paul Allen
Status: Open Resolved
Resolution: Fixed

martin.a.hulth@intel.com (JIRA)

unread,
Jul 13, 2015, 5:29:01 PM7/13/15
to jenkinsc...@googlegroups.com
Martin Hulth commented on Bug JENKINS-29296
 
Re: P4 Plugin: Downstream job not using correct changelist

Thanks for the follow-up and clarification. The plugin is working great now.

pallen@perforce.com (JIRA)

unread,
May 6, 2016, 8:52:04 AM5/6/16
to jenkinsc...@googlegroups.com
Paul Allen closed an issue as Fixed
 

Resolved to Closed

Change By: Paul Allen
Status: Resolved Closed
Reply all
Reply to author
Forward
0 new messages