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

Environment variable not replaced in config file

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      I'm trying  to  replace JENKINS_URL value inside .npmrc

      sass_binary_site=$JENKINS_URL/userContent/node-sass-binaries-master/

       

      But the environment variable never gets replaced into file contents, tested with:

      •   $ or ${}
      • Predefined or global configration declared variables
      • npmrc, maven settings and custom file

       

      pipeline{
          agent any
          stages{
              stage('test'){
              
                  steps{
                      configFileProvider( [configFile(fileId: "test-replace-set", variable: 'file')]){
                      script{
                          def text = readFile "${file}"
                          echo text
                      }
                      }
                      
                  }
              }    
                  
          }
      }

       

      Thanks,

      Nico

        Attachments

          Issue Links

            Activity

            Hide
            michaelpporter Michael Porter added a comment -

            It seems you are missing replaceTokens

             
            configFileProvider( [configFile(
            fileId: "test-replace-set",
            replaceTokens: true,
            variable: 'file')]){
                            script{
                                def text = readFile "${file}"
                                echo text
                            }
                            }
             

            Show
            michaelpporter Michael Porter added a comment - It seems you are missing replaceTokens   configFileProvider( [configFile( fileId: "test-replace-set", replaceTokens: true, variable: 'file')]){                 script{                     def text = readFile "${file}"                     echo text                 }                 }  

              People

              • Assignee:
                domi Dominik Bartholdi
                Reporter:
                nicolasus Nico Navarrete
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: