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

global variables overwrite node variables

    XMLWordPrintable

Details

    • Bug
    • Status: Open (View Workflow)
    • Major
    • Resolution: Unresolved
    • pipeline
    • None
    • Jenkins ver. 2.46.2

    Description

      Since latest upgrade of (pipeline) plug-ins, global variables take precedence over variables defined by nodes. Before the update it was possible for a node to override a global variable and adjust it to the local needs.

      Might be related to the changes made for JENKINS-43396, amongst others the Pipeline: Job plug-in was updated from 2.10 to 2.11 on our system

      Attachments

        Issue Links

          Activity

            daniel1zhang daniel zhang added a comment -

            We encountered the same issue and it happens after the Pipeline: Job plugin version 2.25. And I tend to agree with pavake. If we are going to create a new pipeline job, then we can follow the method provided by  jglick, but if we already have a lot of jobs at Jenkins, then we have to ask all users to check and modify their jobs, this will be a huge disaster to users.

            daniel1zhang daniel zhang added a comment - We encountered the same issue and it happens after the Pipeline: Job plugin version 2.25. And I tend to agree with pavake . If we are going to create a new pipeline job, then we can follow the method provided by   jglick , but if we already have a lot of jobs at Jenkins, then we have to ask all users to check and modify their jobs, this will be a huge disaster to users.
            gremlinmaster David Wolff added a comment - - edited

            I don't get that.

            The jenkins help clearly says that the Environment variables section from the Node Properties will overwrite the one from the Configure System page.
            So either the logic or the documentation should be changed.

            Although from my point of view it is more reliable to have environment variables like JAVA_HOME that can be used by scripts then setting these environment variables inside the script.
            If I set them inside scripts I am bound to a fixed path and the script can't be executed on systems where this path doesn't exist. If I use the environment variable that the system defines it is irrelevant where java has been installed.

            Unfortunately using the withEnv step also doesn't solve the problem. In our setup we are building on the master as well on the agents but need
            a different configuration for the agents.

            In our case if a developer decides to build his feature branch he starts a vm that automatically connects to jenkins as an agent.
            To make it easy for the developer to find his agent the hostname of the developers pc is incorporated into the agent name.

            Therefore it's not possible to check for the agent name in Jenkinsfiles and use different environment settings because I don't know the name of the Agent.

            gremlinmaster David Wolff added a comment - - edited I don't get that. The jenkins help clearly says that the Environment variables section from the Node Properties will overwrite the one from the Configure System page. So either the logic or the documentation should be changed. Although from my point of view it is more reliable to have environment variables like JAVA_HOME that can be used by scripts then setting these environment variables inside the script. If I set them inside scripts I am bound to a fixed path and the script can't be executed on systems where this path doesn't exist. If I use the environment variable that the system defines it is irrelevant where java has been installed. Unfortunately using the withEnv step also doesn't solve the problem. In our setup we are building on the master as well on the agents but need a different configuration for the agents. In our case if a developer decides to build his feature branch he starts a vm that automatically connects to jenkins as an agent. To make it easy for the developer to find his agent the hostname of the developers pc is incorporated into the agent name. Therefore it's not possible to check for the agent name in Jenkinsfiles and use different environment settings because I don't know the name of the Agent.
            ranyel Daniel Pintilie added a comment - - edited

            Hi, any updates on this issues? Would be really nice to have it fixed.

            ranyel Daniel Pintilie added a comment - - edited Hi, any updates on this issues? Would be really nice to have it fixed.

            Stumbled across that issue too and now I'm wondering why in 5 years noone seemed to take interest in fixing it and JENKINS-54767 has been abandoned after been in review for almost a year.

            dageissl Daniel Geißler added a comment - Stumbled across that issue too and now I'm wondering why in 5 years noone seemed to take interest in fixing it and JENKINS-54767 has been abandoned after been in review for almost a year.

            Got the same issue.. oO whats going on here?

            shampoonator Guido Schaumann added a comment - Got the same issue.. oO whats going on here?

            People

              Unassigned Unassigned
              gordin Christoph Vogtländer
              Votes:
              32 Vote for this issue
              Watchers:
              41 Start watching this issue

              Dates

                Created:
                Updated: