How to create folder and text file in Jenkins common location How to create folder and text file in Jenkins common location jenkins jenkins

How to create folder and text file in Jenkins common location


We are facing the same requirements, and we realized it by using a path to the file server.

Here some examples of our code:

// create new project filenew File("//<PATH_TO_YOUR_FILE_SERVER>/JenkinsCommon/${JOB_NAME}.txt").createNewFile()new File("//<PATH_TO_YOUR_FILE_SERVER>/JenkinsCommon/${JOB_NAME}.txt").write("${ContentOfYourVariable}")    // read content from project fileString ProjectFileContent  = new File("//<PATH_TO_YOUR_FILE_SERVER>/JenkinsCommon/${JOB_NAME}.txt").text

Does this help you or is it necessary to create the folder directly on your master?


I think for this requirement someone developed the External Workspace Manager Plugin

=> This plugin provides an external workspace management system. It facilitates workspace share and reuse across multiple Jenkins jobs. It eliminates the need to copy, archive or move files.