[JIRA] (JENKINS-57314) P4 Sync to label after sync to head without deleting non labeled files

35 views
Skip to first unread message

delfimvalverde@gmail.com (JIRA)

unread,
May 2, 2019, 12:12:02 PM5/2/19
to jenkinsc...@googlegroups.com
Jose Valverde created an issue
 
Jenkins / Bug JENKINS-57314
P4 Sync to label after sync to head without deleting non labeled files
Issue Type: Bug Bug
Assignee: Unassigned
Components: p4-plugin
Created: 2019-05-02 16:11
Environment: linux
Priority: Major Major
Reporter: Jose Valverde

I've created a perforce workspace and I've sync it to the head version.

However I would like to sync the same workspace to a label but without deleting files that are not in the label. Like running the command p4 sync <workspace>/... @=label . 

I've tried with may continuations of the populate command but all of them have run something like  p4 sync <arguments><workspace>/... @label 

Is there a way to have a to run the p4sync command to create a @= command?

 

Thanks!

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

kwirth@perforce.com (JIRA)

unread,
May 2, 2019, 1:12:02 PM5/2/19
to jenkinsc...@googlegroups.com

kwirth@perforce.com (JIRA)

unread,
May 2, 2019, 1:12:02 PM5/2/19
to jenkinsc...@googlegroups.com
Karl Wirth commented on Bug JENKINS-57314
 
Re: P4 Sync to label after sync to head without deleting non labeled files

Hi Jose Valverde - Not sure so I will try it out here and get back to you with my findings.

delfimvalverde@gmail.com (JIRA)

unread,
May 3, 2019, 4:29:02 AM5/3/19
to jenkinsc...@googlegroups.com
Jose Valverde updated an issue
 
Change By: Jose Valverde
I've created a perforce workspace and I've sync it to the head version.

However I would like to sync the same workspace to a label but without deleting files that are not in the label. Like running the command p4 sync <workspace>/... @=label . 

I've tried with may continuations many combinations of the populate command but all of them have run something like  p4 sync <arguments><workspace>/... @label 

Is there a way to
have a to run the p4sync command to create on jenkins so that it run a p4 sync * ** * @= command?*

 

*Thanks!*

kwirth@perforce.com (JIRA)

unread,
May 3, 2019, 11:07:06 AM5/3/19
to jenkinsc...@googlegroups.com
 
Re: P4 Sync to label after sync to head without deleting non labeled files

Hi Jose Valverde. I have not been able to find a way to do this so will mark this as an enhancement request for the developers. The workaround would be to do the whole sync using P4Groovy:

   https://www.perforce.com/manuals/jenkins/Content/P4Jenkins/p4groovy.html?Highlight=P4Groovy

You could then specify the command line you need for the sync.

kwirth@perforce.com (JIRA)

unread,
May 3, 2019, 11:08:01 AM5/3/19
to jenkinsc...@googlegroups.com

kwirth@perforce.com (JIRA)

unread,
May 3, 2019, 11:08:02 AM5/3/19
to jenkinsc...@googlegroups.com

delfimvalverde@gmail.com (JIRA)

unread,
May 3, 2019, 12:42:02 PM5/3/19
to jenkinsc...@googlegroups.com
Jose Valverde commented on Bug JENKINS-57314
 
Re: P4 Sync to label after sync to head without deleting non labeled files

Hi Karl Wirth .

Thanks for you feedback,

In the meanwhile, I'll try to sync my workspace as you've instructed!

delfimvalverde@gmail.com (JIRA)

unread,
May 7, 2019, 9:31:02 AM5/7/19
to jenkinsc...@googlegroups.com

Hi Karl Wirth,

I'm trying to change my job to run a P4Groovy, and I've created an example as in the link you've shared, and i'm getting the following error:

 

[Pipeline] End of Pipeline
ERROR: P4: Task Exception: Invalid credentials

 

This is my test code:

 

node("my_node") {
    // Define workspace
    def ws = [$class: 'StreamWorkspaceImpl', 
    charset: 'none', format: 'jenkins-${JOB_NAME}', 
    pinHost: false, streamName: '//my_workspace']// Create object
    def p4 = p4 (credential: 'my_client', workspace: manualSpec(charset: 'none', cleanup: false, name: 'jenkins-${NODE_NAME}-${JOB_NAME}-${EXECUTOR_NUMBER}', pinHost: false, spec: clientSpec(allwrite: false, backup: true, changeView: '', clobber: true, compress: false, line: 'LOCAL', locked: false, modtime: false, rmdir: false, serverID: '', streamName: '', type: 'WRITABLE', view: 'my_workspace')))
   p4.run('sync','...')
}

 

Please note that "my_client" is the same using in other working jobs.

Is there any additional configuration needed on my job, rather then what is on the shared link (de-select groovy sandbox) ?

 

Thanks for the help!

 

kwirth@perforce.com (JIRA)

unread,
May 7, 2019, 9:44:02 AM5/7/19
to jenkinsc...@googlegroups.com

Hi Jose Valverde,

Sorry 'credential' is a typo. That should be your Jenkins credential not the workspace name. For example:

 def p4 = p4 (credential: 'myJenkinsCrentialName',workspace: ...

delfimvalverde@gmail.com (JIRA)

unread,
May 7, 2019, 9:54:02 AM5/7/19
to jenkinsc...@googlegroups.com

Hi Karl Wirth,

My mistake, indeed I have my jenkins credentials on the fcredentials options not my workspace name.

fcp.pratas@gmail.com (JIRA)

unread,
May 7, 2019, 3:10:01 PM5/7/19
to jenkinsc...@googlegroups.com

fcp.pratas@gmail.com (JIRA)

unread,
May 7, 2019, 3:28:04 PM5/7/19
to jenkinsc...@googlegroups.com
Frederico Pratas commented on Bug JENKINS-57314
 
Re: P4 Sync to label after sync to head without deleting non labeled files

Hi Karl Wirth,

I've also tried this kind of construction.

In my case I have created a shared library (my_groovy_lib). Inside the vars/ folder I've placed a call p4SyncLabel.groovy (see in attachmentp4SyncLabel.groovy

Then inside the main pipe I call:

#!/usr/bin/env groovy  
@Library('my_groovy_lib') _
// Pipeline steering
pipeline {
 agent {
    label 'my_slave_0'
 }
 options {
    timestamps()
 }
 stages {
    stage('Test') {
       steps{
          echo 'Test'
          script{
             p4SyncLabel('my_p4_ticket_id', "jenkins_${NODE_NAME}_${JOB_BASE_NAME}_${EXECUTOR_NUMBER}",
                          "//depot/... //jenkins_${NODE_NAME}_${JOB_BASE_NAME}_${EXECUTOR_NUMBER}/...",
                         'head', true, false )
          }
        }
      }
   }
}

 

 

I'm getting the following output:

 

Started by user Frederico Pratas
Running in Durability level: MAX_SURVIVABILITY
Loading library my_groovy_lib@master
... p4 client -o jenkins_shared_lib_master_example +
... p4 info +
... p4 info +
... p4 client -o jenkins_shared_lib_master_example +
... No change in client detected.
... p4 counter change +
... p4 changes -m1 -ssubmitted //jenkins_shared_lib_master___ +
Building on Node: master
... p4 client -o jenkins_shared_lib_master_example +
... p4 info +
... p4 info +
... p4 client -o jenkins_shared_lib_master_example +
... No change in client detected.
P4 Task: establishing connection.
... server: XXXXX:1666
... node: XXXXX
P4 Task: reverting all pending and shelved revisions.
... p4 revert /var/lib/jenkins/workspace/example%40libs/sn___ +
... rm [abandoned files]
duration: (845ms)
P4 Task: cleaning workspace to match have list.
... p4 reconcile -w -f /var/lib/jenkins/workspace/example%___ +
duration: 0m 1s
P4 Task: syncing files at change: XXXXX
... p4 sync -q /var/lib/jenkins/workspace/example%40libs/s___ +
duration: 0m 4s
P4 Task: saving built changes.
Found last change XXXXX on syncID jenkins_shared_lib_NODE_NAME_example
... p4 client -o jenkins_shared_lib_master_example +
... p4 info +
... p4 info +
... p4 client -o jenkins_shared_lib_master_example +
... No change in client detected.
... p4 changes -m20 //jenkins_shared_lib_master_example/..___ +
... p4 changes -l -m1 @XXXXX +
... p4 user -o pratas +
... p4 describe -s -m51 XXXXX +
... p4 fixes -cXXXXX +
... done
[Pipeline] Start of Pipeline
[Pipeline] node
Running on my_slave_0 in /users/jenkins/workspace/example
[Pipeline] {
[Pipeline] timestamps
[Pipeline] {
[Pipeline] stage
[Pipeline] { (Test)
[Pipeline] echo
09:45:20 Test
[Pipeline] script
[Pipeline] {
[Pipeline] p4
[Pipeline] }
[Pipeline] // script
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // timestamps
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
ERROR: P4: Task Exception: Invalid credentials
Finished: FAILURE

 

 

I'm using the same credential that is used to load the library from p4, which as you can see works fine.

Any ideas what is wrong in the flow?

 

Thanks,

Frederico

 

 

delfimvalverde@gmail.com (JIRA)

unread,
May 31, 2019, 4:34:02 AM5/31/19
to jenkinsc...@googlegroups.com
Jose Valverde edited a comment on Bug JENKINS-57314
Hi [~p4karl],

Do you have any
ideia idea on why we are having this problem?

Thanks for the help,

Jose

delfimvalverde@gmail.com (JIRA)

unread,
May 31, 2019, 4:34:02 AM5/31/19
to jenkinsc...@googlegroups.com

Hi Karl Wirth,

Do you have any ideia on why we are having this problem?

Thanks for the help,

Jose

pallen@perforce.com (JIRA)

unread,
Jun 4, 2019, 9:38:02 AM6/4/19
to jenkinsc...@googlegroups.com

kwirth@perforce.com (JIRA)

unread,
Jun 6, 2019, 5:33:03 AM6/6/19
to jenkinsc...@googlegroups.com

kwirth@perforce.com (JIRA)

unread,
Jun 6, 2019, 5:34:02 AM6/6/19
to jenkinsc...@googlegroups.com
Karl Wirth commented on Bug JENKINS-57314
 
Re: P4 Sync to label after sync to head without deleting non labeled files

Hi Jose Valverde - Sorry I've been on vacation. I'll take a look and get back to you.

chrisc@bossalien.com (JIRA)

unread,
Jun 21, 2019, 12:05:04 PM6/21/19
to jenkinsc...@googlegroups.com

I'm hitting the same problem - I've been experimenting with using the P4 object to sync to a small subset of the stream we are building on. Using p4sync with the same credentials works correctly, but creating a p4 object and then syncing fails with "ERROR: P4: Task Exception: Invalid credentials". Unfortunately it's not practical to fully sync to our streams on the master, as they are quite large.

chrisc@bossalien.com (JIRA)

unread,
Jun 21, 2019, 12:06:02 PM6/21/19
to jenkinsc...@googlegroups.com
Chris Carr edited a comment on Bug JENKINS-57314
I'm hitting the same problem - I've been experimenting with using the P4 object to sync to a small subset of the stream we are building on on the master . Using p4sync with the same credentials works correctly, but creating a p4 object and then syncing fails with "ERROR: P4: Task Exception: Invalid credentials". Unfortunately it's not practical to fully sync to our streams on the master, as they are quite large.

chrisc@bossalien.com (JIRA)

unread,
Jun 21, 2019, 12:06:03 PM6/21/19
to jenkinsc...@googlegroups.com
Chris Carr edited a comment on Bug JENKINS-57314
I'm hitting the same problem - I've been experimenting with using the P4 object to sync to a small subset of the stream we are building on , on the master. Using p4sync with the same credentials works correctly, but creating a p4 object and then syncing fails with "ERROR: P4: Task Exception: Invalid credentials". Unfortunately it's not practical to fully sync to our streams on the master, as they are quite large.

kwirth@perforce.com (JIRA)

unread,
Jul 4, 2019, 11:24:03 AM7/4/19
to jenkinsc...@googlegroups.com

Hi both. I hit this invalid credentials when there was a typo in my credential ID. Can you please try the following simple code test to see if it works for you. Please replace 'JenkinsMaster' with the name of your Perforce credential ID and '//depot/Jam/...' with a small path in your depot:

def p4SyncLabel(String credential, String ws_name, String ws_view, String label, boolean append, boolean force){
        echo "In function ..."
        def ws = [$class: 'ManualWorkspaceImpl', name: ws_name, spec: [view: ws_view]]
        def p4 = p4(credential: credential, workspace: ws)
        p4.run('sync')
        echo "... function end"
}

pipeline {
 agent {
    label 'master'
 }
 options {
    timestamps()
 }
 stages {
    stage('Test') {
       steps{
          echo 'Test'
          script{
             p4SyncLabel('JenkinsMaster', "jenkins_${NODE_NAME}_${JOB_BASE_NAME}_${EXECUTOR_NUMBER}",
                          "//depot/Jam/... //jenkins_${NODE_NAME}_${JOB_BASE_NAME}_${EXECUTOR_NUMBER}/...",
                         'head', true, false )
          }
        }
      }
   }
}

chrisc@bossalien.com (JIRA)

unread,
Jul 4, 2019, 1:47:04 PM7/4/19
to jenkinsc...@googlegroups.com

Hi . I ran the job, and it failed with the output below.

I double checked the credentials name, and it was correct (and it's using the same credentials with a P4Sync call that has no problems). We're on version 1.9.6 of the Jenkins plugin, but plan on updating to 1.10.0 very shortly.

 
Running in Durability level: MAX_SURVIVABILITY[Pipeline] Start of Pipeline[Pipeline] nodeRunning on Jenkins in /var/lib/jenkins/workspace/Project/Test_P4Jenkins[Pipeline] {[Pipeline] timestamps[Pipeline] {[Pipeline] stage[Pipeline] { (Test)[Pipeline] echo*17:37:36* Test[Pipeline] script[Pipeline]

{[Pipeline] echo*17:37:36* In function ...[Pipeline] p4[Pipeline] }

[Pipeline] // script[Pipeline] }[Pipeline] // stage[Pipeline] }[Pipeline] // timestamps[Pipeline] }[Pipeline] // node[Pipeline] End of PipelineERROR: P4: Task Exception: Invalid credentials
Finished: FAILURE

chrisc@bossalien.com (JIRA)

unread,
Jul 4, 2019, 1:47:05 PM7/4/19
to jenkinsc...@googlegroups.com
Chris Carr edited a comment on Bug JENKINS-57314
Hi :). I ran the job, and it failed with the output below.


I double checked the credentials name, and it was correct (and it's using the same credentials with a P4Sync call that has no problems). We're on version 1.9.6 of the Jenkins plugin, but plan on updating to 1.10.0 very shortly.

{{   }}
{{ Running in Durability level: MAX_SURVIVABILITY[Pipeline] Start of Pipeline[Pipeline] nodeRunning on [Jenkins|https://jenkins-master.aws.bossalien.com/computer/(master)/] in /var/lib/jenkins/workspace/Project/Test_P4Jenkins[Pipeline] {[Pipeline] timestamps[Pipeline] {[Pipeline] stage[Pipeline] { (Test)[Pipeline] echo*17:37:36*  Test[Pipeline] script[Pipeline] }} { {{ [Pipeline] echo*17:37:36*  In function ...[Pipeline] p4[Pipeline] } }}{{ [Pipeline] // script[Pipeline] }[Pipeline] // stage[Pipeline] }[Pipeline] // timestamps[Pipeline] }[Pipeline] // node[Pipeline] End of PipelineERROR: P4: Task Exception: Invalid credentials }}
{{ Finished: FAILURE }}

chrisc@bossalien.com (JIRA)

unread,
Jul 4, 2019, 1:50:03 PM7/4/19
to jenkinsc...@googlegroups.com
Chris Carr edited a comment on Bug JENKINS-57314
Hi :). I ran the job, and it failed with the output below.

I double checked the credentials name, and it was correct (and it's using the same credentials with a P4Sync call that has no problems). We're on version 1.9.6 of the Jenkins plugin, but plan on updating to 1.10.0 very shortly.

 

-------

Started by user ccarr

Running in Durability level: MAX_SURVIVABILITY
[Pipeline] Start of Pipeline
[Pipeline] node
Running on Jenkins in /var/lib/jenkins/workspace/Project/Test_P4Jenkins

[Pipeline] {
[Pipeline] timestamps
[Pipeline] {
[Pipeline] stage
[Pipeline] { (Test)
[Pipeline] echo
18:37:36 Test
[Pipeline] script
[Pipeline]
{

{
[Pipeline] echo
18:37:36 In function ...
[Pipeline] p4
[Pipeline] }

[Pipeline] // script
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // timestamps
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
ERROR: P4: Task Exception: Invalid credentials
Finished: FAILURE

chrisc@bossalien.com (JIRA)

unread,
Jul 4, 2019, 1:50:03 PM7/4/19
to jenkinsc...@googlegroups.com
Chris Carr edited a comment on Bug JENKINS-57314
Hi :). I ran the job, and it failed with the output below.

I double checked the credentials name, and it was correct (and it's using the same credentials with a P4Sync call that has no problems). We're on version 1.9.6 of the Jenkins plugin, but plan on updating to 1.10.0 very shortly.

{{ }}
{{ Started by user ccarr
Running in Durability level: MAX_SURVIVABILITY
[Pipeline] Start of Pipeline
[Pipeline] nodeRunning node
Running
on [ Jenkins |https://jenkins-master.aws.bossalien.com/computer/(master)/] in /var/lib/jenkins/workspace/Project/Test_P4Jenkins
[Pipeline] {
[Pipeline] timestamps
[Pipeline] {
[Pipeline] stage
[Pipeline] { (Test)
[Pipeline] echo *17
18
:37:36 * Test
[Pipeline] script
[Pipeline] }} { {{
[Pipeline] echo *17
18
:37:36 * In function ...
[Pipeline] p4
[Pipeline] } }}{{
[Pipeline] // script
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // timestamps
[Pipeline] }
[Pipeline] // node
[Pipeline] End of PipelineERROR Pipeline
ERROR
: P4: Task Exception: Invalid credentials }}
{{ Finished: FAILURE }}

delfimvalverde@gmail.com (JIRA)

unread,
Jul 5, 2019, 4:25:02 AM7/5/19
to jenkinsc...@googlegroups.com

Hi Karl!

 

I'm having the same issue as mentioned above.

And we are also using version 1.9.6!

 
 
Running in Durability level: MAX_SURVIVABILITY[Pipeline] Start of Pipeline[Pipeline] node....[Pipeline] {[Pipeline] timestamps[Pipeline] {[Pipeline] stage[Pipeline] { (Test)[Pipeline] echo*09:20:51* Test[Pipeline] script[Pipeline]

{[Pipeline] echo*09:20:51* In function ...[Pipeline] p4[Pipeline] }

[Pipeline] // script[Pipeline] }[Pipeline] // stage[Pipeline] }[Pipeline] // timestamps[Pipeline] }[Pipeline] // node[Pipeline] End of PipelineERROR: P4: Task Exception: Invalid credentials
Finished: FAILURE

chrisc@bossalien.com (JIRA)

unread,
Jul 10, 2019, 9:04:02 AM7/10/19
to jenkinsc...@googlegroups.com

We've updated the p4 plugin to 1.10.1, and the issue still persists. I also tried adding a p4sync() call, using the same credentials string to do a preview sync in the same job. It worked fine, so the credentials are definitely okay.

kwirth@perforce.com (JIRA)

unread,
Jul 10, 2019, 2:45:07 PM7/10/19
to jenkinsc...@googlegroups.com

Hi Chris Carr, Jose Valverde

I'd like to setup a webex with one of you to investigate further. Can one of you comment in this case then send an email to sup...@perforce.com so I can arrange that.

 

Note: 1.0.2 just shipped today but as far as I know it has no credential related fixes.

 

Thanks in advance.

 

Karl

kwirth@perforce.com (JIRA)

unread,
Jul 17, 2019, 12:55:03 PM7/17/19
to jenkinsc...@googlegroups.com

Hi Chris Carr, Jose Valverde,

I just wanted to check in again to see if either of you are available for a webex during UK working hours?

delfimvalverde@gmail.com (JIRA)

unread,
Jul 18, 2019, 4:42:02 AM7/18/19
to jenkinsc...@googlegroups.com

Hi Karl Wirth,

 

Are you available to schedule a webex for next Monday (July 22) at 4PM UK time?

I'm going to send the email to sup...@perforce.com now! 

 

Thanks!

kwirth@perforce.com (JIRA)

unread,
Jul 18, 2019, 5:01:03 AM7/18/19
to jenkinsc...@googlegroups.com

fcp.pratas@gmail.com (JIRA)

unread,
Aug 1, 2019, 2:53:02 AM8/1/19
to jenkinsc...@googlegroups.com

Hi,

After some digging with the p4 team support we (Jose Valverde and I) managed to isolate and reproduce the credential issue.

Another bug has been created to track this JENKINS-58745

Chris Carr you may want to follow up in case the issue matches your setup as well.

Thanks,

Frederico

fcp.pratas@gmail.com (JIRA)

unread,
Aug 1, 2019, 3:13:03 AM8/1/19
to jenkinsc...@googlegroups.com
Frederico Pratas edited a comment on Bug JENKINS-57314
Hi,

After some digging with
the p4 team support  [~joel_brown] and [~p4karl]  we ([~citylife4] and I) managed to isolate and reproduce the credential issue.

Another bug has been created to track this [JENKINS-58745|https://urldefense.proofpoint.com/v2/url?u=https-3A__issues.jenkins-2Dci.org_browse_JENKINS-2D58745&d=DwMFaQ&c=DPL6_X_6JkXFx7AXWqB0tg&r=VUE8IMWRw4czmli0hTPLrZPuDrGc8PQ2GmqEhHAtl3k&m=3KXou6GA2FrtnXhOqcjv2RQY5XfhgYTeevCKlb1aCb4&s=qnyLzr7KApU4zNDux6KUqghfuExaVVznYg9XlHHcYVQ&e=]

[~chriscarr] you may want to follow up in case the issue matches your setup as well.

Thanks,

Frederico
Reply all
Reply to author
Forward
0 new messages