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

PROMOTED_* variables not exposed to all promoted build actions

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • promoted-builds-plugin
    • None
    • Jenkins 1.606 on CentOS 6
      EnvInject plugin 1.90
      Parameterized Trigger plugin 2.26
      Promoted Builds plugin 2.21

      My aim is to access certain information created by the build being promoted. Specifically, version numbers which I want to use to create a release number that a parameterized build action or a build script action will use.

      It seems the environment of the build being promoted is not exposed directly to build actions, nor the builds triggered by the promotion, so my first thought was to use an "inject environment variables" action to load the environment saved by the build being promoted using a path deduced from the PROMOTED_* variables like this:

      ${JENKINS_HOME}/jobs/${PROMOTED_JOB_NAME}/builds/${PROMOTED_NUMBER}/injectedEnvVars.txt

      However, only JENKINS_HOME gets expanded, the other variables do not seem to be in scope. The only place I can see the PROMOTED_* variables appearing in scope is within a build script action.

      Other plugins affecting the environment do seem to allow their variables to appear in scope within configuration variables of actions, so I am wondering if this could be fixed in the promoted builds plugin? Or perhaps I just need to do something extra I don't know about.

      The "inject environment variables" action does not seem to offer any means to run a script, just the option to either to load a file, and/or to define properties directly in a text area. I've tried accessing the PROMOTED_* variables in both with no success.

      Alternatively, if the promoted builds plugin could provide some other way of accessing the environment of the build being promoted this might do, but it would seem most useful to users if the PROMOTED_* variables were more uniformly visible.

      Thanks!

            Unassigned Unassigned
            wu_lee Nick S
            Votes:
            6 Vote for this issue
            Watchers:
            9 Start watching this issue

              Created:
              Updated: