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

Cant sync global libraries on Windows

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Blocker Blocker
    • p4-plugin
    • None
    • Windows 10
      P4Jenkins 1.14.2
      Jenkins 2.414.2
    • 1.14.4

      Can no longer use global pipeline libraries on Windows build machines with P4-Plugin 1.14.2.

      The plugin tries to delete a file that does not exist. For example:

      P4 Task: establishing connection.
      ... server: localhost:1666
      ... node: ak-windows10
      
      P4 Task: reverting all pending and shelved revisions.
      ... p4 revert E:\Jenkins\jobs\UseLibrary\builds\4\libs\b36202ef12a3cccf52a098edb6767318___
       +... rm [abandoned files]
      duration: (26ms)
      
      ... p4 sync -q E:\Jenkins\jobs\UseLibrary\builds\4\libs\b36202ef12a3cccf52a098edb676731___
       +... rm -rf E:\Jenkins\jobs\UseLibrary\builds\4\libs\b36202ef12a3cccf52a098edb6767318bbdb5f49b2e3730b9681b9a231882b02
      
      Unable to delete, trying alternative method... Cannot delete file: E:\Jenkins\jobs\UseLibrary\builds\4\libs\b36202ef12a3cccf52a098edb6767318bbdb5f49b2e3730b9681b9a231882b02
      P4 Task: attempt: 1
      ERROR: P4: Task Exception: java.nio.file.NoSuchFileException: E:\Jenkins\jobs\UseLibrary\builds\4\libs\b36202ef12a3cccf52a098edb6767318bbdb5f49b2e3730b9681b9a231882b02
      ERROR: Maximum checkout retry attempts reached, aborting
      org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
      WorkflowScript: Loading libraries failed
      
      1 error
      
      	at org.codehaus.groovy.control.ErrorCollector.failIfErrors(ErrorCollector.java:309)
      	at org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:1107)
      	at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:624)
      	at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:602)
      	at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:579)
      	at groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:323)
      	at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:293)
      	at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.GroovySandbox$Scope.parse(GroovySandbox.java:163)
      	at org.jenkinsci.plugins.workflow.cps.CpsGroovyShell.doParse(CpsGroovyShell.java:190)
      	at org.jenkinsci.plugins.workflow.cps.CpsGroovyShell.reparse(CpsGroovyShell.java:175)
      	at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.parseScript(CpsFlowExecution.java:580)
      	at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.start(CpsFlowExecution.java:526)
      	at org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:335)
      	at hudson.model.ResourceController.execute(ResourceController.java:101)
      	at hudson.model.Executor.run(Executor.java:442)
      Finished: FAILURE 

      The directory mentioned contains:

       Directory of E:\Jenkins\jobs\UseLibrary\builds\4
      
      29/09/2023  04:39    <DIR>          .
      29/09/2023  04:39    <DIR>          ..
      29/09/2023  04:39            12,485 build.xml
      29/09/2023  04:39             7,580 log
      29/09/2023  04:39                 0 log-index
                     3 File(s)         20,065 bytes
                     2 Dir(s)  42,075,430,912 bytes free 

      The only library files I can find are in:

       Directory of E:\Jenkins\workspace\UseLibrary@libs
      
      29/09/2023  04:38    <DIR>          .
      29/09/2023  04:38    <DIR>          ..
      29/09/2023  04:38               146 5edfffb5dfb17e7ebb537594f06b91d94dbab0c3bfbcffef31d1ff4c518e463b-scm-key.txt
      29/09/2023  04:36               146 b281fe57fb7f5a445572c66fd28f4da37bdfef9ea1f553dcaa6c330dc02b49e8-scm-key.txt
      29/09/2023  04:36               146 c6159958151d8f69018b94ba5a1fa5fdb62a0faf60c151086e9859c02793f230-scm-key.txt
                     3 File(s)            438 bytes
                     2 Dir(s)  42,075,430,912 bytes free 

      Reproduction steps:

      (1) Install Jenkins on WIndows machine.

      (2) Stop service using 'net stop jenkins'.

      (3) Set new JENKINS_HOME (not essential but makes  life easier):

      https://www.theserverside.com/blog/Coffee-Talk-Java-News-Stories-and-Opinions/Jenkins-Home-Directory-Location-Change-JENKINS_HOME-windows-linux-ubuntu

      (4) Start server and choose to install P4-Plugin during first startup.

      (5) Create a Perforce credential.

      (6) Add following file to Perforce at '//depot/myLibrary/src/org/foo/lib.groovy':

      package org.foo;
      
      def testFunc ()
      {
        echo "HELLO FROM testFunc version 3"
      }
      
      return this;  

      (7) Add a Global Library (modern SCM > Helix Library) called 'my-shared-library':

      (8) Create following pipeline job and run it:

      @Library('my-shared-library@now'import org.foo.lib.* 
      
      pipeline { 
        agent any
        stages { 
         stage("Repro") { 
            steps { 
              script { 
                def z = new org.foo.lib() 
                z.testFunc() 
               } 
             } 
         } 
        } 
      }  

            Unassigned Unassigned
            p4karl Karl Wirth
            Votes:
            2 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: