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

Can't overload/update PYTHONPATH

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Component/s: envinject-plugin
    • Labels:
      None
    • Environment:
      Jenkins 1.473
      envinject 1.67 & 1.62
    • Similar Issues:

      Description

      I am attempting to prepend to the PYTHONPATH variable on slave nodes using the plugin. If I simply try to set the variable (Build Environment->Inject environment variables to the build process->Properties Content) like so:
      PYTHONPATH=${WORKSPACE}/ref/dist/python

      it does work. However, if I try to prepend to the variable like:
      PYTHONPATH=${WORKSPACE}/ref/dist/python:$PYTHONPATH
      or
      PYTHONPATH=${WORKSPACE}/ref/dist/python:${PYTHONPATH}

      I am met with the following error if the slave node hasn't already defined PYTHONPATH:
      [EnvInject] - Executing scripts and injecting environment variables after the SCM step.
      [EnvInject] - Injecting as environment variables the properties content
      PYTHONPATH=${WORKSPACE}/ref/dist/python:${PYTHONPATH}

      [EnvInject] - Variables injected successfully.
      [EnvInject] - Unset unresolved 'PYTHONPATH' variable.

      Then on my first build step, if I echo PYTHONPATH it's empty. It seems like merely referencing the variable in the value breaks down if it's not already defined. However, I can't assume that a slave node doesn't already have it set so I don't want to completely overwrite it.

        Attachments

          Activity

          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in jenkins
          User: Gregory Boissinot
          Path:
          src/main/java/org/jenkinsci/plugins/envinject/service/EnvInjectEnvVars.java
          http://jenkins-ci.org/commit/envinject-plugin/9abab6b3d9a7c6c8850dc1ac33d7976aab5ac718
          Log:
          Fix JENKINS-14930

          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Gregory Boissinot Path: src/main/java/org/jenkinsci/plugins/envinject/service/EnvInjectEnvVars.java http://jenkins-ci.org/commit/envinject-plugin/9abab6b3d9a7c6c8850dc1ac33d7976aab5ac718 Log: Fix JENKINS-14930
          Hide
          gbois Gregory Boissinot added a comment -

          Please could you check if this new SNAPSHOT Jenkins plugin fix the issue:
          https://buildhive.cloudbees.com/job/jenkinsci/job/envinject-plugin/49/org.jenkins-ci.plugins$envinject/

          Show
          gbois Gregory Boissinot added a comment - Please could you check if this new SNAPSHOT Jenkins plugin fix the issue: https://buildhive.cloudbees.com/job/jenkinsci/job/envinject-plugin/49/org.jenkins-ci.plugins$envinject/
          Hide
          gbois Gregory Boissinot added a comment -

          without any response from you, I release a new version

          Show
          gbois Gregory Boissinot added a comment - without any response from you, I release a new version

            People

            • Assignee:
              gbois Gregory Boissinot
              Reporter:
              mears Josh Davidson
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: