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

Perforce plugin does not substitute all variables when polling for new changes

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open (View Workflow)
    • Priority: Major
    • Resolution: Unresolved
    • Component/s: perforce-plugin
    • Labels:
    • Environment:
      Windows 7 Professional 64-Bit, Jenkins 1.471, Winstone servlet engine, Perforce plugin 1.3.17
    • Similar Issues:

      Description

      The Perforce plugin does not substitute all variables when polling for changes. I use variables in the following fields: "Workspace (client)" and "View Map".
      The plugin replaces only the variable ${JOB_NAME} with the correct value, but ignores ${NODE_NAME} and ${USERNAME} (and perhaps some other variables too). Using %USERNAME% instead of ${USERNAME} does not work.

      The polling log looks like:

      Started on 14.08.2012 16:36:33
      Looking for changes...
      Using node: Jenkins
      Using master perforce client: ${USERNAME}admin.test${NODE_NAME}
      [JENKINS_HOME] $ "c:\Program Files\P4\p4.exe" workspace -o ${USERNAME}admin.test${NODE_NAME}
      [JENKINS_HOME] $ "c:\Program Files\P4\p4.exe" counter change
      [JENKINS_HOME] $ "c:\Program Files\P4\p4.exe" -s changes -s submitted //${USERNAME}admin.test

      {NODE_NAME}

      /...@26326,@26325
      No changes found.

      When I do not use polling (starting the job manually), the plugin has no problem to create and sync the workspace.

        Attachments

          Activity

          Hide
          rpetti Rob Petti added a comment -

          Builds get a full build environment set up for it, and they also have a simple mechanism for extracting those environment variables for substitution. Polling threads have neither. They only exist to run the necessary polling commands, so the environment is pretty bare, and there isn't an easy way to get the environment out of them afaik. Only build parameters, node properties, and global properties are fully supported. Like most other plugins, environment variables are not fully supported in the perforce plugin.

          I can add the substitutions for P4USER, P4PORT, etc explicitly to the substitutions being performed, but that might be the best I can do right now...

          Show
          rpetti Rob Petti added a comment - Builds get a full build environment set up for it, and they also have a simple mechanism for extracting those environment variables for substitution. Polling threads have neither. They only exist to run the necessary polling commands, so the environment is pretty bare, and there isn't an easy way to get the environment out of them afaik. Only build parameters, node properties, and global properties are fully supported. Like most other plugins, environment variables are not fully supported in the perforce plugin. I can add the substitutions for P4USER, P4PORT, etc explicitly to the substitutions being performed, but that might be the best I can do right now...
          Hide
          bernhardb Bernhard Berbuir added a comment -

          I wasn't aware about the different environments for build and polling. Perhaps it would be a got idea to document this in the wiki?

          Having a substitution for P4User would be sufficient for my needs.

          Show
          bernhardb Bernhard Berbuir added a comment - I wasn't aware about the different environments for build and polling. Perhaps it would be a got idea to document this in the wiki? Having a substitution for P4User would be sufficient for my needs.
          Hide
          rpetti Rob Petti added a comment -

          Generally environment variables are not using in plugin configuration, only build parameters, that's why it's undocumented. Feel free to update it, and I'll see if I can add the substitutions you requested. Granted, P4USER will always be constant, so it shouldn't even need to be defined as a parameter reference in your job configuration.

          Show
          rpetti Rob Petti added a comment - Generally environment variables are not using in plugin configuration, only build parameters, that's why it's undocumented. Feel free to update it, and I'll see if I can add the substitutions you requested. Granted, P4USER will always be constant, so it shouldn't even need to be defined as a parameter reference in your job configuration.
          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in jenkins
          User: Rob Petti
          Path:
          src/main/java/hudson/plugins/perforce/PerforceSCM.java
          http://jenkins-ci.org/commit/perforce-plugin/901aac98ef2347879aeacabae27035000a897d98
          Log:
          JENKINS-14787 added P4USER as a valid parameter substitution during polling

          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Rob Petti Path: src/main/java/hudson/plugins/perforce/PerforceSCM.java http://jenkins-ci.org/commit/perforce-plugin/901aac98ef2347879aeacabae27035000a897d98 Log: JENKINS-14787 added P4USER as a valid parameter substitution during polling
          Hide
          llamahunter Richard Lee added a comment -

          Discussed in another bug, but in case others have run into this issue, P4PASSWD also does not currently appear to be substituted during polling.

          Show
          llamahunter Richard Lee added a comment - Discussed in another bug, but in case others have run into this issue, P4PASSWD also does not currently appear to be substituted during polling.

            People

            • Assignee:
              Unassigned
              Reporter:
              bernhardb Bernhard Berbuir
            • Votes:
              2 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

              • Created:
                Updated: