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

Using a variable injected during "Prepare envrionment" stage doesn't work for Perforce Label during SCM

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      I am trying to inject a variable from a file which will tell a Jenkins test job what perforce label it should use during SCM

      My file is named change.properties and looks like this:
      p4.changelist=386494

      In the test job, I have clicked the 'Prepare an environment for the job' section and then added the file location in the 'Properties File Path' box

      In the Perforce section, I am setting the perforce Label to be GPTCDTEST${p4.changelist}

      However when I run the job, I get this error:
      Invalid changelist/client/label/date '@GPTCDTEST${p4.changelist}'.

      which makes me think that it wasn't able to pick up the p4.changelist variable I injected.

      I have been able to do this by having an upstream job trigger the test job with parameters from the file, and this works fine, but I want to be able to have the job run on it own without requiring the upstream job.

      I also tried just inserting this variable in the 'Properties Content' section, but Perforce still can't find it:

      [EnvInject] - Injecting as environment variables the properties content
      p4.changelist=322332

      [EnvInject] - Variables injected successfully.

      ...

      com.tek42.perforce.PerforceException: Errors encountered while force syncing: error: Invalid changelist/client/label/date '@GPTCDTEST${p4.changelist}'.

      Is there an issue with linking up a variable from the Prepare Environment section to the perforce SCM section?

        Attachments

          Activity

          Hide
          brianfreedatwork Brian Freed added a comment -

          I have been able to verify that the Perforce Plugin can use global environment variables such as PATH, but is unable to find the local environment variables that were injected.

          Can the Perforce Plugin be updated to be able to use these local environment variables for property substitution?

          Show
          brianfreedatwork Brian Freed added a comment - I have been able to verify that the Perforce Plugin can use global environment variables such as PATH, but is unable to find the local environment variables that were injected. Can the Perforce Plugin be updated to be able to use these local environment variables for property substitution?
          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/5befc6822dbb7af0fb0f18a535efa0c826b89838
          Log:
          [FIXED JENKINS-12837] use full build environment for substitutions, not just job parameters

          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/5befc6822dbb7af0fb0f18a535efa0c826b89838 Log: [FIXED JENKINS-12837] use full build environment for substitutions, not just job parameters
          Hide
          dogfood dogfood added a comment -

          Integrated in plugins_perforce #180
          [FIXED JENKINS-12837] use full build environment for substitutions, not just job parameters (Revision 5befc6822dbb7af0fb0f18a535efa0c826b89838)

          Result = SUCCESS
          Rob Petti :
          Files :

          • src/main/java/hudson/plugins/perforce/PerforceSCM.java
          Show
          dogfood dogfood added a comment - Integrated in plugins_perforce #180 [FIXED JENKINS-12837] use full build environment for substitutions, not just job parameters (Revision 5befc6822dbb7af0fb0f18a535efa0c826b89838) Result = SUCCESS Rob Petti : Files : src/main/java/hudson/plugins/perforce/PerforceSCM.java
          Hide
          brianfreedatwork Brian Freed added a comment -

          Thanks for getting this fixed so quickly.

          Do you have a timeline for when this change will be released for us to download?

          Show
          brianfreedatwork Brian Freed added a comment - Thanks for getting this fixed so quickly. Do you have a timeline for when this change will be released for us to download?

            People

            • Assignee:
              gbois Gregory Boissinot
              Reporter:
              brianfreedatwork Brian Freed
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: