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

Global variables not set when manually triggering parameterized freestyle jobs

XMLWordPrintable

      Global variables are not being set correctly when manually triggering parameterized freestyle jobs. However, the behavior is correct when the job is triggered by a timer.

      Steps to reproduce:

      1. Set a global variable (e.g., VAR1) in Jenkins configuration. ( "Manage Jenkins" -> "System" -> "Global Properties" -> "Environment variables" -> Add VAR1)
      2. Create a freestyle job with a String or Global variable parameter named VAR1 (the same name as the global variable).
      3. Set the default value of the parameter VAR1 to ${VAR1}.
      4. Optionally create a "Execute shell" build step and log the value: echo VAR1 = ${VAR1}
      5. Run the job manually.
      6. Set up a timer trigger for the same job and let it run automatically.
      7. Check the parameters of the build/console log

      Expected behavior:
      The job should use the global variable value if the parameter is not changed, or the user-provided value if changed, regardless of how the job is triggered (manually or by timer).

      Actual behavior:

      • When triggered manually: The variable is not set correctly, resulting in an incorrect value ("${VAR1}" in the example).
      • When triggered by timer: The global variable parameter is replaced with the correct global variable content.

      This inconsistency in behavior between manual and timed triggers began after updating Jenkins from version 2.462.3 to 2.479.1. Although all plugins were updated later, the issue does not appear to be related to the plugins.

      The issue started on November 4, 2024. Before this date, both trigger methods worked correctly.

      Additional Information:

      • No changes were made to job configurations or global settings around the time this issue started occurring (but we do not know when it started because we usually not run jobs manually).
      • The discrepancy between manual and timed triggers suggests a potential issue with how parameters are processed in different triggering scenarios.

            Unassigned Unassigned
            ral_openbravo Rafa
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: