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

Pipeline with Job DSL's ExecuteDslScripts and Mercurial

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      I tried to use a Jenkinsfile with DSL-PlugIn. I get the following stacktrace because hg clones to "workspace@script" instead of "workspace".

      Jenkinsfile

      node {
      	step([
      		$class: 'ExecuteDslScripts',
      		scriptLocation: [targets: ['resources/jenkins/dsl/*.groovy', 'resources/jenkins/dsl/Releases/*.groovy'].join('\n')],
      		removedJobAction: 'DISABLE',
      		removedViewAction: 'DELETE',
      		lookupStrategy: 'JENKINS_ROOT',
      		additionalClasspath: 'resources/jenkins/dsl'
      	])
      }
      
      $ hg clone --rev default --noupdate http://e6430:8000 /var/lib/jenkins/jobs/_Seeder_/workspace@script
      
      adding changesets
      adding manifests
      adding file changes
      added 7095 changesets with 26676 changes to 3195 files
      [workspace@script] $ hg update --rev default
      1622 files updated, 0 files merged, 0 files removed, 0 files unresolved
      [workspace@script] $ hg log --rev . --template {node}
      
      [workspace@script] $ hg log --rev . --template {rev}
      WARN: Revision data for previous build unavailable; unable to determine change log
      [workspace@script] $ hg log --rev . --template {node}
      [workspace@script] $ hg log --rev . --template {rev}
      [Pipeline] node
      Running on master in /var/lib/jenkins/jobs/_Seeder_/workspace
      [Pipeline] {
      [Pipeline] step
      /var/lib/jenkins/jobs/_Seeder_/workspace does not exist.
      	at org.apache.tools.ant.types.AbstractFileSet.getDirectoryScanner(AbstractFileSet.java:483)
      	at hudson.FilePath.glob(FilePath.java:1769)
      	at hudson.FilePath.access$1700(FilePath.java:195)
      	at hudson.FilePath$32.invoke(FilePath.java:1747)
      	at hudson.FilePath$32.invoke(FilePath.java:1744)
      	at hudson.FilePath.act(FilePath.java:1018)
      	at hudson.FilePath.act(FilePath.java:996)
      	at hudson.FilePath.list(FilePath.java:1744)
      	at hudson.FilePath.list(FilePath.java:1729)
      	at hudson.FilePath.list(FilePath.java:1715)
      	at hudson.FilePath$list$2.call(Unknown Source)
      	at javaposse.jobdsl.plugin.ScriptRequestGenerator$_getScriptRequests_closure2.doCall(ScriptRequestGenerator.groovy:48)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:498)
      	at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93)
      	at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
      	at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:294)
      	at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1024)
      	at groovy.lang.Closure.call(Closure.java:414)
      	at groovy.lang.Closure.call(Closure.java:430)
      	at org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:2030)
      	at org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:1890)
      	at org.codehaus.groovy.runtime.DefaultGroovyMethods$each.call(Unknown Source)
      	at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
      	at org.codehaus.groovy.runtime.DefaultGroovyMethods$each.call(Unknown Source)
      	at com.cloudbees.groovy.cps.CpsDefaultGroovyMethods.each(CpsDefaultGroovyMethods.groovy:26)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:498)
      	at org.codehaus.groovy.runtime.metaclass.ReflectionMetaMethod.invoke(ReflectionMetaMethod.java:54)
      	at org.codehaus.groovy.runtime.metaclass.NewInstanceMetaMethod.invoke(NewInstanceMetaMethod.java:56)
      	at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite$PojoMetaMethodSiteNoUnwrapNoCoerce.invoke(PojoMetaMethodSite.java:274)
      	at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite.call(PojoMetaMethodSite.java:56)
      	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125)
      	at javaposse.jobdsl.plugin.ScriptRequestGenerator.getScriptRequests(ScriptRequestGenerator.groovy:47)
      	at javaposse.jobdsl.plugin.ExecuteDslScripts.perform(ExecuteDslScripts.java:275)
      	at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:68)
      	at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:59)
      	at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1$1.call(AbstractSynchronousNonBlockingStepExecution.java:52)
      	at hudson.security.ACL.impersonate(ACL.java:221)
      	at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1.run(AbstractSynchronousNonBlockingStepExecution.java:49)
      	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
      	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
      	at java.lang.Thread.run(Thread.java:745)
      [Pipeline] }
      [Pipeline] // node
      [Pipeline] End of Pipeline
      ERROR: /var/lib/jenkins/jobs/_Seeder_/workspace does not exist.
      Finished: FAILURE
      

      If I create "/var/lib/jenkins/jobs/Seeder/workspace" manually I get this one:

      Gestartet durch Benutzer anonymous
      [workspace@script] $ hg showconfig paths.default
      [workspace@script] $ hg pull --rev default
      pulling from http://e6430:8000/
      no changes found
      [workspace@script] $ hg update --clean --rev default
      0 files updated, 0 files merged, 0 files removed, 0 files unresolved
      [workspace@script] $ hg log --rev . --template {node}
      [workspace@script] $ hg log --rev . --template {rev}
      [workspace@script] $ hg log --rev 8d9fbfe32cb66756f3d2a747cb9ba4f995e3fcdf
      changeset:   7094:8d9fbfe32cb6
      tag:         tip
      [...]
      
      [workspace@script] $ hg log --template "<changeset node='{node}' author='{author|xmlescape}' rev='{rev}' date='{date}'><msg>{desc|xmlescape}</msg><added>{file_adds|stringify|xmlescape}</added><deleted>{file_dels|stringify|xmlescape}</deleted><files>{files|stringify|xmlescape}</files><parents>{parents}</parents></changeset>\n" --rev "ancestors('default') and not ancestors(8d9fbfe32cb66756f3d2a747cb9ba4f995e3fcdf)" --encoding UTF-8 --encodingmode replace
      [workspace@script] $ hg log --rev . --template {node}
      [workspace@script] $ hg log --rev . --template {rev}
      [Pipeline] node
      Running on master in /var/lib/jenkins/jobs/_Seeder_/workspace
      [Pipeline] {
      [Pipeline] step
      [Pipeline] }
      [Pipeline] // node
      [Pipeline] End of Pipeline
      ERROR: no Job DSL script(s) found at resources/jenkins/dsl/*.groovy
      Finished: FAILURE
      

        Attachments

          Issue Links

            Activity

            Hide
            daspilker Daniel Spilker added a comment -

            This is either a problem of the Mercurial plugin or the Pipeline plugin. Job DSL just uses the workspace that is passed into SimpleBuildStep#perform(...).

            Show
            daspilker Daniel Spilker added a comment - This is either a problem of the Mercurial plugin or the Pipeline plugin. Job DSL just uses the workspace that is passed into SimpleBuildStep#perform(...) .
            Hide
            bitwiseman Liam Newman added a comment -

            A. Klitzing
            I don't see a `checkout scm` call in your code. I'd expect to see:

            node {
                    checkout scm
            	step([
            		$class: 'ExecuteDslScripts',
            		scriptLocation: [targets: ['resources/jenkins/dsl/*.groovy', 'resources/jenkins/dsl/Releases/*.groovy'].join('\n')],
            		removedJobAction: 'DISABLE',
            		removedViewAction: 'DELETE',
            		lookupStrategy: 'JENKINS_ROOT',
            		additionalClasspath: 'resources/jenkins/dsl'
            	])
            }
            
            Show
            bitwiseman Liam Newman added a comment - A. Klitzing I don't see a `checkout scm` call in your code. I'd expect to see: node { checkout scm step([ $class: 'ExecuteDslScripts' , scriptLocation: [targets: [ 'resources/jenkins/dsl/*.groovy' , 'resources/jenkins/dsl/Releases/*.groovy' ].join( '\n' )], removedJobAction: 'DISABLE' , removedViewAction: 'DELETE' , lookupStrategy: 'JENKINS_ROOT' , additionalClasspath: 'resources/jenkins/dsl' ]) }
            Hide
            misery A. Klitzing added a comment -

            Damn.... too stupid.
            Thank you very much!

            Show
            misery A. Klitzing added a comment - Damn.... too stupid. Thank you very much!
            Hide
            bitwiseman Liam Newman added a comment -

            More likely too smart.
            Glad to help.

            Show
            bitwiseman Liam Newman added a comment - More likely too smart. Glad to help.

              People

              Assignee:
              Unassigned Unassigned
              Reporter:
              misery A. Klitzing
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: