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

Global variables are overriding local variables

    XMLWordPrintable

Details

    • Task
    • Status: In Review (View Workflow)
    • Blocker
    • Resolution: Unresolved
    • workflow-job-plugin
    • None
    • Jenkins 2.138.2 and 2.138.3

    Description

      We had this issue since 2.138.2, now we are on 2.138.3

      When running a build, its always ignoring the local parameters and its always taking into consideration only the global parameters. This makes it impossible for us to run builds with different parameters as they will always only follow the global parameters.

       

      The only way this could work is when there is no global parameters. If there is only Local parameters then they wont be overriden.

      Attachments

        Issue Links

          Activity

            fhajredini fisnik hajredini added a comment - - edited

            The following was generated using this groovy script:

            Jenkins.instance.pluginManager.plugins.each{
              plugin -> 
                println ("${plugin.getDisplayName()} (${plugin.getShortName()}): ${plugin.getVersion()}")
            }

            Durable Task Plugin (durable-task): 1.28
            Pipeline: Nodes and Processes (workflow-durable-task-step): 2.26
            GitHub Branch Source Plugin (github-branch-source): 2.4.1
            Pipeline: SCM Step (workflow-scm-step): 2.7
            Pipeline (workflow-aggregator): 2.6
            Pipeline: API (workflow-api): 2.33
            Pipeline: Declarative (pipeline-model-definition): 1.3.2
            Pipeline: GitHub Groovy Libraries (pipeline-github-lib): 1.0
            Ant Plugin (ant): 1.9
            Apache HttpComponents Client 4.x API Plugin (apache-httpcomponents-client-4-api): 4.5.5-3.0
            Workspace Cleanup Plugin (ws-cleanup): 0.36
            Command Agent Launcher Plugin (command-launcher): 1.2
            SSH Slaves plugin (ssh-slaves): 1.28.1
            Windows Slaves Plugin (windows-slaves): 1.3.1
            JavaScript GUI Lib: Moment.js bundle plugin (momentjs): 1.1.1
            Pipeline: Basic Steps (workflow-basic-steps): 2.12
            Lockable Resources plugin (lockable-resources): 2.3
            JDK Tool Plugin (jdk-tool): 1.1
            Pipeline: REST API Plugin (pipeline-rest-api): 2.10
            Pipeline: Shared Groovy Libraries (workflow-cps-global-lib): 2.12
            Folders Plugin (cloudbees-folder): 6.7
            JSch dependency plugin (jsch): 0.1.54.2
            Build Timeout (build-timeout): 1.19
            Job Configuration History Plugin (jobConfigHistory): 2.18.3
            Credentials Binding Plugin (credentials-binding): 1.17
            PAM Authentication plugin (pam-auth): 1.4
            Token Macro Plugin (token-macro): 2.5
            Matrix Authorization Strategy Plugin (matrix-auth): 2.3
            Docker Commons Plugin (docker-commons): 1.13
            Pipeline: Milestone Step (pipeline-milestone-step): 1.3.1
            LDAP Plugin (ldap): 1.20
            Green Balls (greenballs): 1.15
            External Monitor Job Type Plugin (external-monitor-job): 1.7
            Copy Artifact Plugin (copyartifact): 1.41
            Resource Disposer Plugin (resource-disposer): 0.12
            Pipeline: Build Step (pipeline-build-step): 2.7
            JavaScript GUI Lib: Handlebars bundle plugin (handlebars): 1.1.1
            Pipeline: Supporting APIs (workflow-support): 2.22
            Gradle Plugin (gradle): 1.29
            Pipeline: Job (workflow-job): 2.30-rc928.54893f9a5f5c
            Structs Plugin (structs): 1.17
            embeddable-build-status (embeddable-build-status): 1.9
            Pipeline: Groovy (workflow-cps): 2.60
            Matrix Project Plugin (matrix-project): 1.13
            Simple Theme Plugin (simple-theme-plugin): 0.5.1
            GitHub Authentication plugin (github-oauth): 0.29
            Branch API Plugin (branch-api): 2.1.1
            Trilead API Plugin (trilead-api): 1.0.1
            GitHub API Plugin (github-api): 1.92
            Pipeline: Stage View Plugin (pipeline-stage-view): 2.10
            OWASP Markup Formatter Plugin (antisamy-markup-formatter): 1.5
            Pipeline: Stage Tags Metadata (pipeline-stage-tags-metadata): 1.3.2
            bouncycastle API Plugin (bouncycastle-api): 2.17
            Jackson 2 API Plugin (jackson2-api): 2.9.7.1
            Email Extension Plugin (email-ext): 2.63
            JavaScript GUI Lib: ACE Editor bundle plugin (ace-editor): 1.1
            Docker Pipeline (docker-workflow): 1.17
            GitHub plugin (github): 1.29.3
            Pipeline: Multibranch (workflow-multibranch): 2.20
            JUnit Plugin (junit): 1.26.1
            SSH Credentials Plugin (ssh-credentials): 1.14
            Node and Label parameter plugin (nodelabelparameter): 1.7.2
            Credentials Plugin (credentials): 2.1.18
            Authentication Tokens API Plugin (authentication-tokens): 1.3
            Script Security Plugin (script-security): 1.48
            JavaScript GUI Lib: jQuery bundles (jQuery and jQuery UI) plugin (jquery-detached): 1.2.1
            Pipeline: Input Step (pipeline-input-step): 2.8
            jQuery plugin (jquery): 1.12.4-0
            Pipeline: Model API (pipeline-model-api): 1.3.2
            Pipeline: Declarative Extension Points API (pipeline-model-extensions): 1.3.2
            MapDB API Plugin (mapdb-api): 1.0.9.0
            Display URL API (display-url-api): 2.3.0
            Pipeline Graph Analysis Plugin (pipeline-graph-analysis): 1.9
            Plain Credentials Plugin (plain-credentials): 1.4
            Git client plugin (git-client): 2.7.4
            Pipeline: Stage Step (pipeline-stage-step): 2.3
            GIT server Plugin (git-server): 1.7
            Build With Parameters (build-with-parameters): 1.4
            Mailer Plugin (mailer): 1.22
            Timestamper (timestamper): 1.8.10
            Git plugin (git): 3.9.1
            Pipeline Utility Steps (pipeline-utility-steps): 2.2.0
            SCM API Plugin (scm-api): 2.3.0
            Subversion Plug-in (subversion): 2.12.1
            Pipeline: Declarative Agent API (pipeline-model-declarative-agent): 1.1.1
            Pipeline: Step API (workflow-step-api): 2.16
            Result: [Plugin:durable-task, Plugin:workflow-durable-task-step, Plugin:github-branch-source, Plugin:workflow-scm-step, Plugin:workflow-aggregator, Plugin:workflow-api, Plugin:pipeline-model-definition, Plugin:pipeline-github-lib, Plugin:ant, Plugin:apache-httpcomponents-client-4-api, Plugin:ws-cleanup, Plugin:command-launcher, Plugin:ssh-slaves, Plugin:windows-slaves, Plugin:momentjs, Plugin:workflow-basic-steps, Plugin:lockable-resources, Plugin:jdk-tool, Plugin:pipeline-rest-api, Plugin:workflow-cps-global-lib, Plugin:cloudbees-folder, Plugin:jsch, Plugin:build-timeout, Plugin:jobConfigHistory, Plugin:credentials-binding, Plugin:pam-auth, Plugin:token-macro, Plugin:matrix-auth, Plugin:docker-commons, Plugin:pipeline-milestone-step, Plugin:ldap, Plugin:greenballs, Plugin:external-monitor-job, Plugin:copyartifact, Plugin:resource-disposer, Plugin:pipeline-build-step, Plugin:handlebars, Plugin:workflow-support, Plugin:gradle, Plugin:workflow-job, Plugin:structs, Plugin:embeddable-build-status, Plugin:workflow-cps, Plugin:matrix-project, Plugin:simple-theme-plugin, Plugin:github-oauth, Plugin:branch-api, Plugin:trilead-api, Plugin:github-api, Plugin:pipeline-stage-view, Plugin:antisamy-markup-formatter, Plugin:pipeline-stage-tags-metadata, Plugin:bouncycastle-api, Plugin:jackson2-api, Plugin:email-ext, Plugin:ace-editor, Plugin:docker-workflow, Plugin:github, Plugin:workflow-multibranch, Plugin:junit, Plugin:ssh-credentials, Plugin:nodelabelparameter, Plugin:credentials, Plugin:authentication-tokens, Plugin:script-security, Plugin:jquery-detached, Plugin:pipeline-input-step, Plugin:jquery, Plugin:pipeline-model-api, Plugin:pipeline-model-extensions, Plugin:mapdb-api, Plugin:display-url-api, Plugin:pipeline-graph-analysis, Plugin:plain-credentials, Plugin:git-client, Plugin:pipeline-stage-step, Plugin:git-server, Plugin:build-with-parameters, Plugin:mailer, Plugin:timestamper, Plugin:git, Plugin:pipeline-utility-steps, Plugin:scm-api, Plugin:subversion, Plugin:pipeline-model-declarative-agent, Plugin:workflow-step-api]

            fhajredini fisnik hajredini added a comment - - edited The following was generated using this groovy script: Jenkins.instance.pluginManager.plugins.each{ plugin -> println ( "${plugin.getDisplayName()} (${plugin.getShortName()}): ${plugin.getVersion()}" ) } Durable Task Plugin (durable-task): 1.28 Pipeline: Nodes and Processes (workflow-durable-task-step): 2.26 GitHub Branch Source Plugin (github-branch-source): 2.4.1 Pipeline: SCM Step (workflow-scm-step): 2.7 Pipeline (workflow-aggregator): 2.6 Pipeline: API (workflow-api): 2.33 Pipeline: Declarative (pipeline-model-definition): 1.3.2 Pipeline: GitHub Groovy Libraries (pipeline-github-lib): 1.0 Ant Plugin (ant): 1.9 Apache HttpComponents Client 4.x API Plugin (apache-httpcomponents-client-4-api): 4.5.5-3.0 Workspace Cleanup Plugin (ws-cleanup): 0.36 Command Agent Launcher Plugin (command-launcher): 1.2 SSH Slaves plugin (ssh-slaves): 1.28.1 Windows Slaves Plugin (windows-slaves): 1.3.1 JavaScript GUI Lib: Moment.js bundle plugin (momentjs): 1.1.1 Pipeline: Basic Steps (workflow-basic-steps): 2.12 Lockable Resources plugin (lockable-resources): 2.3 JDK Tool Plugin (jdk-tool): 1.1 Pipeline: REST API Plugin (pipeline-rest-api): 2.10 Pipeline: Shared Groovy Libraries (workflow-cps-global-lib): 2.12 Folders Plugin (cloudbees-folder): 6.7 JSch dependency plugin (jsch): 0.1.54.2 Build Timeout (build-timeout): 1.19 Job Configuration History Plugin (jobConfigHistory): 2.18.3 Credentials Binding Plugin (credentials-binding): 1.17 PAM Authentication plugin (pam-auth): 1.4 Token Macro Plugin (token-macro): 2.5 Matrix Authorization Strategy Plugin (matrix-auth): 2.3 Docker Commons Plugin (docker-commons): 1.13 Pipeline: Milestone Step (pipeline-milestone-step): 1.3.1 LDAP Plugin (ldap): 1.20 Green Balls (greenballs): 1.15 External Monitor Job Type Plugin (external-monitor-job): 1.7 Copy Artifact Plugin (copyartifact): 1.41 Resource Disposer Plugin (resource-disposer): 0.12 Pipeline: Build Step (pipeline-build-step): 2.7 JavaScript GUI Lib: Handlebars bundle plugin (handlebars): 1.1.1 Pipeline: Supporting APIs (workflow-support): 2.22 Gradle Plugin (gradle): 1.29 Pipeline: Job (workflow-job): 2.30-rc928.54893f9a5f5c Structs Plugin (structs): 1.17 embeddable-build-status (embeddable-build-status): 1.9 Pipeline: Groovy (workflow-cps): 2.60 Matrix Project Plugin (matrix-project): 1.13 Simple Theme Plugin (simple-theme-plugin): 0.5.1 GitHub Authentication plugin (github-oauth): 0.29 Branch API Plugin (branch-api): 2.1.1 Trilead API Plugin (trilead-api): 1.0.1 GitHub API Plugin (github-api): 1.92 Pipeline: Stage View Plugin (pipeline-stage-view): 2.10 OWASP Markup Formatter Plugin (antisamy-markup-formatter): 1.5 Pipeline: Stage Tags Metadata (pipeline-stage-tags-metadata): 1.3.2 bouncycastle API Plugin (bouncycastle-api): 2.17 Jackson 2 API Plugin (jackson2-api): 2.9.7.1 Email Extension Plugin (email-ext): 2.63 JavaScript GUI Lib: ACE Editor bundle plugin (ace-editor): 1.1 Docker Pipeline (docker-workflow): 1.17 GitHub plugin (github): 1.29.3 Pipeline: Multibranch (workflow-multibranch): 2.20 JUnit Plugin (junit): 1.26.1 SSH Credentials Plugin (ssh-credentials): 1.14 Node and Label parameter plugin (nodelabelparameter): 1.7.2 Credentials Plugin (credentials): 2.1.18 Authentication Tokens API Plugin (authentication-tokens): 1.3 Script Security Plugin (script-security): 1.48 JavaScript GUI Lib: jQuery bundles (jQuery and jQuery UI) plugin (jquery-detached): 1.2.1 Pipeline: Input Step (pipeline-input-step): 2.8 jQuery plugin (jquery): 1.12.4-0 Pipeline: Model API (pipeline-model-api): 1.3.2 Pipeline: Declarative Extension Points API (pipeline-model-extensions): 1.3.2 MapDB API Plugin (mapdb-api): 1.0.9.0 Display URL API (display-url-api): 2.3.0 Pipeline Graph Analysis Plugin (pipeline-graph-analysis): 1.9 Plain Credentials Plugin (plain-credentials): 1.4 Git client plugin (git-client): 2.7.4 Pipeline: Stage Step (pipeline-stage-step): 2.3 GIT server Plugin (git-server): 1.7 Build With Parameters (build-with-parameters): 1.4 Mailer Plugin (mailer): 1.22 Timestamper (timestamper): 1.8.10 Git plugin (git): 3.9.1 Pipeline Utility Steps (pipeline-utility-steps): 2.2.0 SCM API Plugin (scm-api): 2.3.0 Subversion Plug-in (subversion): 2.12.1 Pipeline: Declarative Agent API (pipeline-model-declarative-agent): 1.1.1 Pipeline: Step API (workflow-step-api): 2.16 Result: [Plugin:durable-task, Plugin:workflow-durable-task-step, Plugin:github-branch-source, Plugin:workflow-scm-step, Plugin:workflow-aggregator, Plugin:workflow-api, Plugin:pipeline-model-definition, Plugin:pipeline-github-lib, Plugin:ant, Plugin:apache-httpcomponents-client-4-api, Plugin:ws-cleanup, Plugin:command-launcher, Plugin:ssh-slaves, Plugin:windows-slaves, Plugin:momentjs, Plugin:workflow-basic-steps, Plugin:lockable-resources, Plugin:jdk-tool, Plugin:pipeline-rest-api, Plugin:workflow-cps-global-lib, Plugin:cloudbees-folder, Plugin:jsch, Plugin:build-timeout, Plugin:jobConfigHistory, Plugin:credentials-binding, Plugin:pam-auth, Plugin:token-macro, Plugin:matrix-auth, Plugin:docker-commons, Plugin:pipeline-milestone-step, Plugin:ldap, Plugin:greenballs, Plugin:external-monitor-job, Plugin:copyartifact, Plugin:resource-disposer, Plugin:pipeline-build-step, Plugin:handlebars, Plugin:workflow-support, Plugin:gradle, Plugin:workflow-job, Plugin:structs, Plugin:embeddable-build-status, Plugin:workflow-cps, Plugin:matrix-project, Plugin:simple-theme-plugin, Plugin:github-oauth, Plugin:branch-api, Plugin:trilead-api, Plugin:github-api, Plugin:pipeline-stage-view, Plugin:antisamy-markup-formatter, Plugin:pipeline-stage-tags-metadata, Plugin:bouncycastle-api, Plugin:jackson2-api, Plugin:email-ext, Plugin:ace-editor, Plugin:docker-workflow, Plugin:github, Plugin:workflow-multibranch, Plugin:junit, Plugin:ssh-credentials, Plugin:nodelabelparameter, Plugin:credentials, Plugin:authentication-tokens, Plugin:script-security, Plugin:jquery-detached, Plugin:pipeline-input-step, Plugin:jquery, Plugin:pipeline-model-api, Plugin:pipeline-model-extensions, Plugin:mapdb-api, Plugin:display-url-api, Plugin:pipeline-graph-analysis, Plugin:plain-credentials, Plugin:git-client, Plugin:pipeline-stage-step, Plugin:git-server, Plugin:build-with-parameters, Plugin:mailer, Plugin:timestamper, Plugin:git, Plugin:pipeline-utility-steps, Plugin:scm-api, Plugin:subversion, Plugin:pipeline-model-declarative-agent, Plugin:workflow-step-api]
            oleg_nenashev Oleg Nenashev added a comment -

            Which plugins do you use to define local and global variables? Please provide configuration screenshots if you are not sure.

            I would assume it is EnvInject, but it is not installed

            oleg_nenashev Oleg Nenashev added a comment - Which plugins do you use to define local and global variables? Please provide configuration screenshots if you are not sure. I would assume it is EnvInject, but it is not installed

            Not really sure, therefore attached the picture. These are just the local parameters. There is a smiliar view on the global parameters (which override the local ones).

            The link for the parameterized build documentation is here

            fhajredini fisnik hajredini added a comment - Not really sure, therefore attached the picture. These are just the local parameters. There is a smiliar view on the global parameters (which override the local ones). The link for the parameterized build documentation is here

            Any update on this issue? Any information i can provide?

            fhajredini fisnik hajredini added a comment - Any update on this issue? Any information i can provide?

            Increased the priority to Critical, as on this point we are only stuck with building one set of variants/branches automatically.

            fhajredini fisnik hajredini added a comment - Increased the priority to Critical, as on this point we are only stuck with building one set of variants/branches automatically.
            oleg_nenashev Oleg Nenashev added a comment -

            I have no time to investigate it this week, sorry

             

            oleg_nenashev Oleg Nenashev added a comment - I have no time to investigate it this week, sorry  

            Can somebody be assigned to this story please?

            fhajredini fisnik hajredini added a comment - Can somebody be assigned to this story please?

            oleg_nenashev Can you please take a look at this issue?

            fhajredini fisnik hajredini added a comment - oleg_nenashev Can you please take a look at this issue?

            Here is one more screenshots of the global variables on the Jenkins system configuration:

            fhajredini fisnik hajredini added a comment - Here is one more screenshots of the global variables on the Jenkins system configuration:
            oleg_nenashev Oleg Nenashev added a comment -

            fhajredini sorry, I am busy with other personal topics. I cannot provide any ETA for my response in this ticket, see https://groups.google.com/d/msg/jenkinsci-dev/XToix3QpL_k/j2k0xeXvCQAJ . You can use other community channels, like IRC or user/developer mailing lists

            oleg_nenashev Oleg Nenashev added a comment - fhajredini sorry, I am busy with other personal topics. I cannot provide any ETA for my response in this ticket, see https://groups.google.com/d/msg/jenkinsci-dev/XToix3QpL_k/j2k0xeXvCQAJ . You can use other community channels, like IRC or user/developer mailing lists
            wreggyl Jan Bottek added a comment -

            we have the same problem that our global env variables from jenkins configuration will overwrite our job parameters, but only in Pipeline jobs - freestyle jobs are not affected. EnvInject Plugin is not installed

            wreggyl Jan Bottek added a comment - we have the same problem that our global env variables from jenkins configuration will overwrite our job parameters, but only in Pipeline jobs - freestyle jobs are not affected. EnvInject Plugin is not installed
            wreggyl Jan Bottek added a comment - - edited

            after downgrading the 3 plugins it was working again

             

            name from to
            Pipeline: Declarative 1.3.4 1.3.2
            Pipeline: Declarative Extension Points API 1.3.4 1.3.2
            Pipeline: Job  2.31  2.25

            so it seems it only belongs to the plugins and not to Jenkins core. So we are not using depclarative pipeline, i assume it is related to Pipeline: Job, but we downgraded the other two due to dependencies

            wreggyl Jan Bottek added a comment - - edited after downgrading the 3 plugins it was working again   name from to Pipeline: Declarative 1.3.4 1.3.2 Pipeline: Declarative Extension Points API 1.3.4 1.3.2 Pipeline: Job  2.31  2.25 so it seems it only belongs to the plugins and not to Jenkins core. So we are not using depclarative pipeline, i assume it is related to Pipeline: Job, but we downgraded the other two due to dependencies

            wreggyl Thanks for you reply. We are currently following a different approach to fixing this, because of some other issues the pipeline job might cause. We decided to include the variables in the Jenkinsfile script as a temporary approach until this issue is resolved.

            fhajredini fisnik hajredini added a comment - wreggyl Thanks for you reply. We are currently following a different approach to fixing this, because of some other issues the pipeline job might cause. We decided to include the variables in the Jenkinsfile script as a temporary approach until this issue is resolved.
            wreggyl Jan Bottek added a comment -

            is there any progress on this issue, or something which can be done from my site to help solving this issue?

            wreggyl Jan Bottek added a comment - is there any progress on this issue, or something which can be done from my site to help solving this issue?

            We have added a helper function where we get the environment data. You can check our Jenkins CI/CD on https://github.com/pelagicore/pelux-manifests.git

            fhajredini fisnik hajredini added a comment - We have added a helper function where we get the environment data. You can check our Jenkins CI/CD on https://github.com/pelagicore/pelux-manifests.git
            wreggyl Jan Bottek added a comment - - edited

            fhajredini thx for the fast replay. sorry for my question, but how can i see now in which version of the plugin this issue is solved? because issue is still open and on your mentioned CI i didn't see the code for the plugin itself, or what i overlook?

             

            => ahh, now i understood

            wreggyl Jan Bottek added a comment - - edited fhajredini thx for the fast replay. sorry for my question, but how can i see now in which version of the plugin this issue is solved? because issue is still open and on your mentioned CI i didn't see the code for the plugin itself, or what i overlook?   => ahh, now i understood
            wreggyl Jan Bottek added a comment -

            Hi, i tested it again with Jenkins 2.164.2 and the plugins

             

            PlugIn from
            Pipeline: Declarative 1.3.7
            Pipeline: Declarative Extension Points API 1.3.7
            Pipeline: Job  2.32

            We have a global environment variable in Jenkins and a Job with a parameter with the same name and we try to overwrite the resulting env variable in the job

             

            node()

            {     echo env.custom_env_var     echo params.custom_env_var }

            In FreeStyle Job this is still working, only in pipeline we get this error.

            wreggyl Jan Bottek added a comment - Hi, i tested it again with Jenkins 2.164.2 and the plugins   PlugIn from Pipeline: Declarative 1.3.7 Pipeline: Declarative Extension Points API 1.3.7 Pipeline: Job  2.32 We have a global environment variable in Jenkins and a Job with a parameter with the same name and we try to overwrite the resulting env variable in the job   node() {     echo env.custom_env_var     echo params.custom_env_var } In FreeStyle Job this is still working, only in pipeline we get this error.
            heiko_nardmann Heiko Nardmann added a comment - - edited

            To me it looks like this issue is still unresolved in 2021.

            And I see it in a freestyle job where I redefine an environment variable (using "Prepare an environment for the run") that is initially defined globally. Only the global value is seen in my "Execute shell" step.

             

            Jenkins v2.204.6

            heiko_nardmann Heiko Nardmann added a comment - - edited To me it looks like this issue is still unresolved in 2021. And I see it in a freestyle job where I redefine an environment variable (using "Prepare an environment for the run") that is initially defined globally. Only the global value is seen in my "Execute shell" step.   Jenkins v2.204.6

            People

              Unassigned Unassigned
              fhajredini fisnik hajredini
              Votes:
              7 Vote for this issue
              Watchers:
              11 Start watching this issue

              Dates

                Created:
                Updated: