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

Workspace suffix should respect hudson.slaves.WorkspaceList

    XMLWordPrintable

Details

    Description

      CpsScmFlowDefinition.create() is hard coded to append the "@script" suffix onto workspace directories (line 94 of CpsScmFlowDefinition.java).

      This suffix string should at least respect the hudson.slaves.WorkspaceList separator character, or provide some other way to change this suffix string, as the @ symbol is often treated as a special character by various tools.

      Currently, it is entirely impossible to use the workflow plugin with Perforce due to this bug, as @ is an illegal character in Perforce paths. Trying to run a hello world script using "Groovy CPS DSL from SCM" results in:

      ERROR: failed to start build
      java.lang.InterruptedException: P4: Unable to setup workspace: com.perforce.p4java.exception.RequestException: Error in client specification.
      Embedded special characters (*, %%, #, @) not allowed in 'C:\Program Files (x86)\Jenkins\jobs\<redacted>\workspace@script'.

      at org.jenkinsci.plugins.p4.tasks.AbstractTask.setWorkspace(AbstractTask.java:63)
      at org.jenkinsci.plugins.p4.PerforceScm.checkout(PerforceScm.java:277)
      at org.jenkinsci.plugins.workflow.steps.scm.SCMStep.checkout(SCMStep.java:106)
      at org.jenkinsci.plugins.workflow.cps.CpsScmFlowDefinition.create(CpsScmFlowDefinition.java:108)
      at org.jenkinsci.plugins.workflow.cps.CpsScmFlowDefinition.create(CpsScmFlowDefinition.java:57)
      at org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:181)
      at hudson.model.ResourceController.execute(ResourceController.java:98)
      at hudson.model.Executor.run(Executor.java:374)

      Attachments

        Activity

          jglick Jesse Glick added a comment -

          Right, it should follow the defined character.

          Please bear in mind that CpsScmFlowDefinition is merely a convenience. You can achieve the same effect using a CpsFlowDefinition whose inline script allocates a node, checks out the SCM, uses load to parse it, then continues. (See the tutorial.)

          jglick Jesse Glick added a comment - Right, it should follow the defined character. Please bear in mind that CpsScmFlowDefinition is merely a convenience. You can achieve the same effect using a CpsFlowDefinition whose inline script allocates a node , checks out the SCM, uses load to parse it, then continues. (See the tutorial.)
          rpocase Robby Pocase added a comment -

          This has been addressed in the following pull request: https://github.com/jenkinsci/workflow-plugin/pull/124

          rpocase Robby Pocase added a comment - This has been addressed in the following pull request: https://github.com/jenkinsci/workflow-plugin/pull/124

          Code changed in jenkins
          User: Jesse Glick
          Path:
          cps/src/main/java/org/jenkinsci/plugins/workflow/cps/CpsScmFlowDefinition.java
          http://jenkins-ci.org/commit/workflow-plugin/b888a17b1af1fa0501c323c409985f4cfc887380
          Log:
          Merge pull request #124 from rpocase/master

          JENKINS-28179 Workspace suffix should respect hudon.slaves.WorkspaceList property

          Compare: https://github.com/jenkinsci/workflow-plugin/compare/0201a1211f28...b888a17b1af1

          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: cps/src/main/java/org/jenkinsci/plugins/workflow/cps/CpsScmFlowDefinition.java http://jenkins-ci.org/commit/workflow-plugin/b888a17b1af1fa0501c323c409985f4cfc887380 Log: Merge pull request #124 from rpocase/master JENKINS-28179 Workspace suffix should respect hudon.slaves.WorkspaceList property Compare: https://github.com/jenkinsci/workflow-plugin/compare/0201a1211f28...b888a17b1af1

          Code changed in jenkins
          User: Jesse Glick
          Path:
          CHANGES.md
          http://jenkins-ci.org/commit/workflow-plugin/408efbcfbc2f8603c23219321bb6ddbafb0117f6
          Log:
          [FIXED JENKINS-28179] Noting merge of #124.

          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: CHANGES.md http://jenkins-ci.org/commit/workflow-plugin/408efbcfbc2f8603c23219321bb6ddbafb0117f6 Log: [FIXED JENKINS-28179] Noting merge of #124.

          People

            jglick Jesse Glick
            sumdumgai A C
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: