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

using ${JOB_NAME} in Workspace Name Format fails in Matrix jobs

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • p4-plugin
    • None
    • P4 plugin: 1.0.7
      Jenkins: 1.574

      When used in a Matrix job, ${JOB_NAME} has a '/' character in it, which is illegal for a workspace name in Perforce. This should be stripped or replaced.

          [JENKINS-24028] using ${JOB_NAME} in Workspace Name Format fails in Matrix jobs

          Paul Allen added a comment -

          Thanks for the details. Kind of odd why the root is null and the view is missing; I'll look into it.

          Paul Allen added a comment - Thanks for the details. Kind of odd why the root is null and the view is missing; I'll look into it.

          Paul Allen added a comment -

          Thinking about this; Manual mode was the only one I intended to use for variable expansion ${foo} in the View. However, Template and Streams were the modes I had thought would be used for slave/matrix builds.

          As you can see the View is expanded for the Parent as I would expect, but the workspace is assumed to have already been created for the children and so the fields are blank.

          I could enhance the plugin to either:

          1. Support view expansion for template workspaces (not possible for streams as the View is managed by the server).

          or

          2. For manual builds, auto create workspaces for the children at build time.

          Paul Allen added a comment - Thinking about this; Manual mode was the only one I intended to use for variable expansion ${foo} in the View. However, Template and Streams were the modes I had thought would be used for slave/matrix builds. As you can see the View is expanded for the Parent as I would expect, but the workspace is assumed to have already been created for the children and so the fields are blank. I could enhance the plugin to either: 1. Support view expansion for template workspaces (not possible for streams as the View is managed by the server). or 2. For manual builds, auto create workspaces for the children at build time.

          Michael Rose added a comment -

          Either way works for me. If that's not the way you intended for the Manual setup to be used, then there might be more gotcha waiting in option 2; so I'm kind of leaning towards option 1.

          Michael Rose added a comment - Either way works for me. If that's not the way you intended for the Manual setup to be used, then there might be more gotcha waiting in option 2; so I'm kind of leaning towards option 1.

          Michael Rose added a comment -

          On the other hand, it is a bit strange that the most flexible setup option is unavailable for one of the base job types. That probably should be fixed, or at least alert the user not to use it when creating a multi-configuration project.

          Michael Rose added a comment - On the other hand, it is a bit strange that the most flexible setup option is unavailable for one of the base job types. That probably should be fixed, or at least alert the user not to use it when creating a multi-configuration project.

          Michael Rose added a comment - - edited

          Hi p4paul, have you had a chance to look more into this?

          Michael Rose added a comment - - edited Hi p4paul , have you had a chance to look more into this?

          Code changed in jenkins
          User: Paul Allen
          Path:
          src/main/java/org/jenkinsci/plugins/p4/workspace/ManualWorkspaceImpl.java
          http://jenkins-ci.org/commit/p4-plugin/7536bbf2a32196961baed589f302cd13a122d02b
          Log:
          Fixed name in client map for Manual workspaces.

          The client name in the RHS of the depot view was not matching the
          correct name. The name was expanded, but not replaced with the '/' and
          '=' chars.

          Fixes JENKINS-24028

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Paul Allen Path: src/main/java/org/jenkinsci/plugins/p4/workspace/ManualWorkspaceImpl.java http://jenkins-ci.org/commit/p4-plugin/7536bbf2a32196961baed589f302cd13a122d02b Log: Fixed name in client map for Manual workspaces. The client name in the RHS of the depot view was not matching the correct name. The name was expanded, but not replaced with the '/' and '=' chars. Fixes JENKINS-24028

          Paul Allen added a comment -

          Fixed in 1.0.15

          Paul Allen added a comment - Fixed in 1.0.15

          Artem Goncharov added a comment - - edited

          Hi,

          I would say, that the issue is not really resolved. At least with the reserved word "label". By default in configuration matrix slave name is "label", each jenkins executor node has "label" assigned to it. So by default on a matrix project build fails with "Unable to find label: master" (or similar), as the word "label" is really the node's label, and not the node name or something similar. Additionally there is nowhere a hint, that word "label" can not be used for the P4 plugin to work properly.

          Example:
          > Building remotely on xxxx (SUSE_11) in workspace /mnt/nfs/jenkins/workspace/test/label/SUSE_11

          To summarize, I would recommend to analyze the issue and either to make it working by default or at least put a hints in the plugin configuration to rename 'configuration matrix>slave>name' from "label" to something else

          Artem Goncharov added a comment - - edited Hi, I would say, that the issue is not really resolved. At least with the reserved word "label". By default in configuration matrix slave name is "label", each jenkins executor node has "label" assigned to it. So by default on a matrix project build fails with "Unable to find label: master" (or similar), as the word "label" is really the node's label, and not the node name or something similar. Additionally there is nowhere a hint, that word "label" can not be used for the P4 plugin to work properly. Example: > Building remotely on xxxx (SUSE_11) in workspace /mnt/nfs/jenkins/workspace/test/label/SUSE_11 To summarize, I would recommend to analyze the issue and either to make it working by default or at least put a hints in the plugin configuration to rename 'configuration matrix>slave>name' from "label" to something else

          Paul Allen added a comment -

          Agreed I'll have to rename the Review build parameters, so label to com.perforce.label to give some namespace.

          Paul Allen added a comment - Agreed I'll have to rename the Review build parameters, so label to com.perforce.label to give some namespace.

          Paul Allen added a comment -

          Label variable moved to 'p4.label'.

          Paul Allen added a comment - Label variable moved to 'p4.label'.

            p4paul Paul Allen
            glimberg Grant Limberg
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: