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

Plugin Finds Files Only in Master Workspaces?

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • content-replace-plugin
    • None
    • Jenkins (Windows) - versions 2.138.3 and 2.150.3
      Content Replace Plugin 1.0.4
      Nodes = Win2016

      The script below works to  find and update a file if the file exists in the workspace on the Jenkins master.  When updating the label to run on a node, and ensuring the file does in fact exist in the workspace of the node, the script fails stating that that the file does not exist. 

      In case it matters, the jobs are managed in a Jenkins folder.

      java.io.FileNotFoundException: File 'C:\jenkins\workspace\Pipeline-Tests\Content-Replace-Test\here.txt' does not exist
       at org.apache.commons.io.FileUtils.openInputStream(FileUtils.java:299)
       at org.apache.commons.io.FileUtils.readFileToString(FileUtils.java:1711)
      

      Pipeline with Sequential Steps

      pipeline{    
          agent none    
          stages {
              stage ("Do Stuff") {
                  agent { label 'master' }           
                  
                  stages {
                      stage ("Test") {
                          steps {
                              echo 'Replace...'
                              
                              contentReplace(configs: [fileContentReplaceConfig(configs:      
                                  [fileContentReplaceItemConfig(matchCount: 1, 
                                  replace: "versionName-replace", 
                                  search: 'versionName.*')], 
                                  fileEncoding: 'ASCII', 
                                  filePath: 'here.txt')])                    }
                      }    
                  }
              }
          }        
      }

            moxun mo xun
            jedavis Jason Davis
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: