[JIRA] (JENKINS-54472) Pin build at Perforce Label does not support variable expansion

15 views
Skip to first unread message

Rocha@Stratovan.com (JIRA)

unread,
Nov 5, 2018, 1:44:02 PM11/5/18
to jenkinsc...@googlegroups.com
John Rocha created an issue
 
Jenkins / Bug JENKINS-54472
Pin build at Perforce Label does not support variable expansion
Issue Type: Bug Bug
Assignee: Unassigned
Components: p4-plugin
Created: 2018-11-05 18:43
Environment: CentOS-7 (Linux CentOS-7 3.10.0-862.14.4.el7.x86_64 #1 SMP Wed Sep 26 15:12:11 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux)

Jenkins war (org.jenkins-ci.main:jenkins-war:2.138.2)

P4 Plugin (1.9.3)
Labels: p4 p4plugin P4_PLUGIN
Priority: Major Major
Reporter: John Rocha

The description for the "Pin a build at Perforce Label" indicates the following:

When a build is triggered by Polling, Build Now or an external Action, the workspace will sync only to the specified label. Any other specified change or label will be ignored.

Supports variable expansion e.g. ${VAR}. If 'now' is used, or a variable that expands to 'now', then the latest change is used (within the scope of the workspace view).

This is not working.

I tried ${SV_P4_CHANGELOG} where the value was not set, and hence is empty, and the tool is looking for the label SV_P4_CHANGELOG, as shown below

Started by user aaaa
[EnvInject] - Loading node environment variables.
Building in workspace /a-directory
(p4):cmd:... p4 client -o build_jenkins_centos
p4 client -o build_jenkins_centos

(p4):stop:4
(p4):cmd:... p4 counter change
p4 counter change

(p4):stop:5
(p4):cmd:... p4 changes -m1 -ssubmitted //build_jenkins_centos/...
p4 changes -m1 -ssubmitted //build_jenkins_centos/...

Change ##### on ####/##/## by developer@developermachine 'Fixed bug'
(p4):stop:6
(p4):cmd:... p4 label -o SV_P4_CHANGELOG
p4 label -o SV_P4_CHANGELOG

(p4):stop:7
(p4):cmd:... p4 counter SV_P4_CHANGELOG
p4 counter SV_P4_CHANGELOG

(p4):stop:8
(p4):cmd:... p4 repos -C
p4 repos -C

(p4):stop:9
Building on Node: master
(p4):cmd:... p4 client -o build_jenkins_centos
p4 client -o build_jenkins_centos

(p4):stop:4

P4 Task: establishing connection.
... server: aaaaaaaa:####
... node: CentOS-7

P4 Task: reverting all pending and shelved revisions.
(p4):cmd:... p4 revert /a-directory/...
p4 revert /a-directory/...

/a-directory/... - file(s) not opened on this client.

(p4):stop:5
... rm [abandoned files]
duration: (19ms)

P4 Task: cleaning workspace to match have list.
(p4):cmd:... p4 reconcile -w -f /a-directory/...
p4 reconcile -w -f /a-directory/...

(p4):stop:6
duration: 0m 47s

(p4):cmd:... p4 label -o SV_P4_CHANGELOG
p4 label -o SV_P4_CHANGELOG

(p4):stop:7
(p4):cmd:... p4 client -o SV_P4_CHANGELOG
p4 client -o SV_P4_CHANGELOG

(p4):stop:8
(p4):cmd:... p4 counter SV_P4_CHANGELOG
p4 counter SV_P4_CHANGELOG

(p4):stop:9
P4: Unable to find client/label/counter: SV_P4_CHANGELOG
P4 Task: attempt: 1
ERROR: P4: Task Exception: hudson.AbortException: P4: Unable to find client/label/counter: SV_P4_CHANGELOG
Finished: FAILURE

If I change the configuration value to "$SV_P4_CHANGELOG", dropping the braces, I start getting output such as this:

p4):cmd:... p4 label -o $SV_P4_CHANGELOG
 p4 label -o $SV_P4_CHANGELOG

(p4):stop:7
 (p4):cmd:... p4 client -o $SV_P4_CHANGELOG
 p4 client -o $SV_P4_CHANGELOG

(p4):stop:8
 (p4):cmd:... p4 counter $SV_P4_CHANGELOG
 p4 counter $SV_P4_CHANGELOG

(p4):stop:9
 P4: Unable to find client/label/counter: $SV_P4_CHANGELOG
 P4 Task: attempt: 1
 ERROR: P4: Task Exception: hudson.AbortException: P4: Unable to find client/label/counter: $SV_P4_CHANGELOG
 Finished: FAILURE

 



 

This scenario is also observed on Ubuntu 18.

Add Comment Add Comment
 
This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d)

pallen@perforce.com (JIRA)

unread,
Dec 20, 2018, 10:38:02 AM12/20/18
to jenkinsc...@googlegroups.com
Paul Allen updated an issue
Change By: Paul Allen
Labels: P4_PLUGIN p4 p4plugin P4_B

pallen@perforce.com (JIRA)

unread,
Dec 20, 2018, 10:38:02 AM12/20/18
to jenkinsc...@googlegroups.com

Rocha@Stratovan.com (JIRA)

unread,
Sep 17, 2019, 12:47:01 PM9/17/19
to jenkinsc...@googlegroups.com
This message was sent by Atlassian Jira (v7.13.6#713006-sha1:cc4451f)
Atlassian logo

cbopardikar@perforce.com (JIRA)

unread,
Sep 23, 2019, 6:34:01 AM9/23/19
to jenkinsc...@googlegroups.com

Your comment is acknowledged. Will update here as soon as any progress is made.

kwirth@perforce.com (JIRA)

unread,
Sep 25, 2019, 5:44:03 AM9/25/19
to jenkinsc...@googlegroups.com
Karl Wirth assigned an issue to Karl Wirth
 
Change By: Karl Wirth
Assignee: Charusheela Bopardikar Karl Wirth

kwirth@perforce.com (JIRA)

unread,
Sep 25, 2019, 5:45:02 AM9/25/19
to jenkinsc...@googlegroups.com

kwirth@perforce.com (JIRA)

unread,
Sep 25, 2019, 11:10:07 AM9/25/19
to jenkinsc...@googlegroups.com
Karl Wirth commented on Bug JENKINS-54472
 
Re: Pin build at Perforce Label does not support variable expansion

Hi John Rocha - Have you tried this on P4-Plugin 10.1.3?

For us the label expansion works. For example my variable is defined as 'SV_P4_CHANGELOG' in the job and I set the parameter to 'karl_label' when I manually ran the build:

 

Started by user unknown or anonymous
Running as SYSTEM
[EnvInject] - Loading node environment variables.
Building on master in workspace /var/lib/jenkins/workspace/JENKINS-54472-PinBuildFreestyle
... p4 client -o jenkins-master-JENKINS-54472-PinBuildFreestyle-7
 +... p4 info
 +... p4 info
 +... p4 client -o jenkins-master-JENKINS-54472-PinBuildFreestyle-7
 +... p4 counter change
 +... p4 changes -m1 -ssubmitted //jenkins-master-JENKINS-54472-PinBuildFreestyle-7/...
 +... p4 label -o karl_label
 +... p4 label -o karl_label

This also was the behavior we saw with pipeline.

 

However it is important to note that P4-Plugin can only sync to automatic labels. This is due to a limitation in Jenkins. This does not seem to be documented so I have created JENKINS-59526.

 

kwirth@perforce.com (JIRA)

unread,
Sep 25, 2019, 11:13:02 AM9/25/19
to jenkinsc...@googlegroups.com

Rocha@Stratovan.com (JIRA)

unread,
Oct 17, 2019, 7:59:02 PM10/17/19
to jenkinsc...@googlegroups.com

Hello Karl Wirth,

I was able to get this to work with plugin 1.10.5 (I haven't tried for awhile, so it may work with earlier versions too).

What I did was as follows:

  1. Define a choice parameter: P4_LABEL, with string trimming enabled.

  2. Set the Perforce field "Pin build at Perforce Label" to ${P4_LABEL}

With this I successfully synced to change set 34307 by entering a value of @34307.

Moreover, if I enter nothing, using the default where P4_LABEL is now set to nothing, it correctly pulls latest as expected.

I think this case can be closed. I don't know if there was a fix that went in from when I first reported or if it was a miss-configuration on my part... but it works now when I do as explained above.

kwirth@perforce.com (JIRA)

unread,
Jan 2, 2020, 8:01:03 AM1/2/20
to jenkinsc...@googlegroups.com

kwirth@perforce.com (JIRA)

unread,
Jan 2, 2020, 8:01:03 AM1/2/20
to jenkinsc...@googlegroups.com
Karl Wirth closed an issue as Done
 

John has provided a workaround.

Change By: Karl Wirth
Status: Open Closed
Resolution: Done
Reply all
Reply to author
Forward
0 new messages