[JIRA] (JENKINS-57955) p4-plugin

9 views
Skip to first unread message

kierzo@kierzo.com (JIRA)

unread,
Jun 11, 2019, 6:07:05 AM6/11/19
to jenkinsc...@googlegroups.com
Kieron Kierzo created an issue
 
Jenkins / Bug JENKINS-57955
p4-plugin
Issue Type: Bug Bug
Assignee: Unassigned
Components: p4-plugin
Created: 2019-06-11 10:06
Environment: Windows Host and Agent, Jenkins ver. 2.176.1 (Pipeline in SCM)
Labels: windows
Priority: Major Major
Reporter: Kieron Kierzo

I sync my client workspace in three environments Windows, Mac and Linux

My step after syncing the workspace is to set up a symlink in each environment that points to a local third party dependencies folder used by the build.

I'm not wishing to add my third party dependencies folder to source control as the folder is about 18GB and would vastly increase the sync time and unnecessary as this folder doesn't change.

 

After adding the symlink and running the build, on the second run... the p4 plugin issues a force clean workspace before it syncs the workspace again.

 

On Mac and Linux, the third party symlink is deleted and recreated each time...

However on windows, instead of removing the link, it follows in to the link and deletes the contents of the dependencies folder, when all I am looking to to is unlink it.

 

On windows the command I am using to create the link is:

mklink /J "%WORKSPACE%\3rdparty" "C:\Jenkins\3rdparty"

 

And on Mac and Linux its:

ln -s /Jenkins/workspace/ 3rdparty

 

I notice that the cleanup command is an "rm -rf" which I am guessing must be handled differently on the windows agent.

 

it must be the recursive flag that's entering the folder.

maybe whats needed is the ability to run a custom removal command. (This will also fix another issue with the fact that the Mac needs to run the rm command with sudo if not running as root user, even if it has permissions to delete and modify the workspace folder, however the plugin only issues "rm -rf" not "sudo rm -rf". which took me a while to convince my IT department to enable the root user on the mac)

 

Thanks a lot as this one is a massive pain for me and can't seem to be able to work around it.

 

 

 

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

kierzo@kierzo.com (JIRA)

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

kwirth@perforce.com (JIRA)

unread,
Jun 11, 2019, 7:03:02 AM6/11/19
to jenkinsc...@googlegroups.com
Karl Wirth assigned an issue to Karl Wirth
Change By: Karl Wirth
Assignee: Karl Wirth

kwirth@perforce.com (JIRA)

unread,
Jun 11, 2019, 7:08:02 AM6/11/19
to jenkinsc...@googlegroups.com
Karl Wirth commented on Bug JENKINS-57955
 
Re: p4-plugin

Hi Kieron Kierzo - Thanks for reporting this. I'll check to see if creating a link instead of a junction changes the behavior.

Do you need the force clean workspace? If not then the workaround may be to use a different sync option such as 'Sync Only':

     https://www.perforce.com/manuals/jenkins/Content/P4Jenkins/populate-sync-only.html?Highlight=%22Sync%20Only%22

kwirth@perforce.com (JIRA)

unread,
Jun 11, 2019, 11:46:02 AM6/11/19
to jenkinsc...@googlegroups.com
 
Re: p4-plugin

Hi Kieron Kierzo, I have been able to reproduce this behavior. Changing it to 'mklink /D' does not solve the problem.

 

If it works for you, using 'sync only' is one workaround. Would another be to run 'rmdir' on the junction before the end of the job then recreate it next time?

 

Reproduction steps:

1. Create a file on the build machine called 'C:\filestore\Jenkins\temp\symlink_target1\file1'.

2. Add a file to '//depot/win_symlink/...'.

3. Create a pipeline job with the following config:

pipeline {
  agent { label 'Windows10' }
  stages {
    stage("Repro") {
      steps {
        script {
            checkout perforce(credential: 'JenkinsMaster', populate: forceClean(have: false, parallel: [enable: false, minbytes: '1024', minfiles: '1', threads: '4'], pin: '', quiet: false), 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: '//depot/win_symlink/... 
            bat 'dir /b /s'
            bat 'mklink /J "linkeddir" "C:\\filestore\\Jenkins\\temp\\symlink_target1"'
            bat 'dir /b /s'
        }
      }
    }
  }
}

4. Build the job.

5. Build the job again.

Result seen - 'C:\filestore\Jenkins\temp\symlink_target1\file1' is deleted.

Expected result - 'C:\filestore\Jenkins\temp\symlink_target1\file1' is not deleted.

kwirth@perforce.com (JIRA)

unread,
Jun 11, 2019, 11:47:02 AM6/11/19
to jenkinsc...@googlegroups.com
Karl Wirth updated an issue
Change By: Karl Wirth
Labels: windows P4_B

kwirth@perforce.com (JIRA)

unread,
Jun 11, 2019, 11:48:02 AM6/11/19
to jenkinsc...@googlegroups.com
Karl Wirth assigned an issue to Unassigned
Change By: Karl Wirth
Assignee: Karl Wirth

kwirth@perforce.com (JIRA)

unread,
Jun 11, 2019, 11:48:02 AM6/11/19
to jenkinsc...@googlegroups.com
Karl Wirth updated an issue
Change By: Karl Wirth
Environment:
Windows Host and Agent, Jenkins ver. 2.176.1 (Pipeline in SCM)

P4-Plugin 1.10.0
Reply all
Reply to author
Forward
0 new messages