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

Job Environment Variables Not Passed to Smudge

XMLWordPrintable

    • Icon: New Feature New Feature
    • Resolution: Won't Fix
    • Icon: Minor Minor
    • git-plugin
    • None
    • Jenkins 2.516.1
      Git plugin Version 5.7.0
      Windows 11

      My git repository utilizes a smudge script (written in Perl) that checks the values of some environment variables.

       

      When using the checkout command, the smudge script does not receive the environment variable set earlier in the job.  If I replace the checkout command with the raw git commands the environment variable is seen.

      Basic example of what my job is doing:

       

      env.Who_Is_Awesome = "Jenkins_And_Git_Team"
      
      checkout([$class: 'GitSCM',
                branches: [[name: "main"]],		   
                doGenerateSubmoduleConfigurations: false,
                extensions: [
                     [$class: 'CheckoutOption', timeout: 60],
                     [$class: 'CloneOption', depth: 1, noTags: false],
                     [$class: 'SubmoduleOption',
                     disableSubmodules: false,
                     parentCredentials: true,
                     recursiveSubmodules: true,
                     reference: '',
                     trackingSubmodules:false]],
                     submoduleCfg: [],
                     userRemoteConfigs: [[url: "https://my_git_reference.git", credentialsId: 'myGitCreds']]
               ])

       
       

      In my smudge script I check the env var "Who_Is_Awesome" and get nothing.  If I replace the checkout command with raw git commands then the smudge sees the environment variable.

       

            Unassigned Unassigned
            scokee Scott McKee
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: