Can use normal streams but not task streams with a "Modern SCM".
This is because it uses a manual workspace and really needs to use a streams workspace when using task streams.
Reproduction steps:
(1) Add library to a main line stream:
$ p4 print //streams_libs/main/subdirectory/src/org/bar/lib.groovy //streams_libs/main/subdirectory/src/org/bar/lib.groovy#1 - add change 3 (text) package org.bar; def testFunc () { echo "HELLO FROM testFunc version 3" dispEnv() } return this;
(2) Create a task stream called from the mainline called '//streams_libs/task'.
(3) Create the following Modern SCM library definition
(4) Create a pipeline job with the folowing groovy:
@Library('task-stream-lib') import org.bar.lib.* pipeline { agent any stages { stage("Repro") { steps { script { def z = new org.bar.lib() z.testFunc() z.dispEnv() } } } } }
(5) Run the job. The following error is seen:
P4 Task: establishing connection. ... server: localhost:1666 ... node: vm-kwirth-jenkins24621 P4 Task: cleanup client: jenkins-lib-845375b0-c92a-4a45-9445-d47878b27034 ... p4 client -o jenkins-lib-845375b0-c92a-4a45-9445-d47878b27034 +... p4 revert /var/lib/jenkins/workspace/UseTaskStreamLibModern%40libs/3203c928762ddc75___ +P4 Task: remove client: jenkins-lib-845375b0-c92a-4a45-9445-d47878b27034 ... p4 client -d jenkins-lib-845375b0-c92a-4a45-9445-d47878b27034 +ERROR: Library task-stream-lib-modern expected to contain at least one of src or vars directories 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 PluginClassLoader for script-security//org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.GroovySandbox$Scope.parse(GroovySandbox.java:163) at PluginClassLoader for workflow-cps//org.jenkinsci.plugins.workflow.cps.CpsGroovyShell.doParse(CpsGroovyShell.java:190) at PluginClassLoader for workflow-cps//org.jenkinsci.plugins.workflow.cps.CpsGroovyShell.reparse(CpsGroovyShell.java:175) at PluginClassLoader for workflow-cps//org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.parseScript(CpsFlowExecution.java:652) at PluginClassLoader for workflow-cps//org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.start(CpsFlowExecution.java:598) at PluginClassLoader for workflow-job//org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:335) at hudson.model.ResourceController.execute(ResourceController.java:101) at hudson.model.Execu
- causes
-
JENKINS-73736 Document that Modern SCM libraries do not support Task streams
- Open