Skip to content
This repository was archived by the owner on Nov 7, 2023. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,6 @@ public RemoteBuildConfiguration(String remoteJenkinsName, boolean shouldNotFailB
this.loadParamsFromFile = true;
this.parameterFile = loadParamsFromFile.getString("parameterFile");
this.parameters = "";
//manually add a leading-slash if we don't have one
if( this.parameterFile.charAt(0) != '/' ){
this.parameterFile = "/" + this.parameterFile;
}
} else {
this.loadParamsFromFile = false;
this.parameters = parameters;
Expand Down Expand Up @@ -159,14 +155,25 @@ public RemoteBuildConfiguration(String remoteJenkinsName, boolean shouldNotFailB
* @param build
* @return List<String> of build parameters
*/
private List<String> loadExternalParameterFile(AbstractBuild<?, ?> build) {
private List<String> loadExternalParameterFile(AbstractBuild<?, ?> build, BuildListener listener) {

FilePath workspace = build.getWorkspace();
BufferedReader br = null;
List<String> ParameterList = new ArrayList<String>();
try {
// If parameterFile is token, we need convert it.
// Doesn't modify this.parameterFile because that will modify job configuration string concurrently
String tokenizeParameterFile = replaceToken(build, listener, this.parameterFile);
if( tokenizeParameterFile.charAt(0) != '/' && !tokenizeParameterFile.startsWith("\\")){
tokenizeParameterFile = "/" + tokenizeParameterFile;
}

String filePath = workspace + tokenizeParameterFile;
// If file path is NFS, we should use original path
if(tokenizeParameterFile.startsWith("\\")){
filePath = tokenizeParameterFile;
}

String filePath = workspace + this.getParameterFile();
String sCurrentLine;
String fileContent = "";

Expand Down Expand Up @@ -474,7 +481,7 @@ public boolean perform(AbstractBuild build, Launcher launcher, BuildListener lis
List<String> cleanedParams = null;

if (this.getLoadParamsFromFile()) {
cleanedParams = loadExternalParameterFile(build);
cleanedParams = loadExternalParameterFile(build, listener);
} else {
// tokenize all variables and encode all variables, then build the fully-qualified trigger URL
cleanedParams = getCleanedParameters();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
</f:entry>

<f:optionalBlock title="Load parameters from external file (this will cause the job to ignore the text field above)" field="loadParamsFromFile">
<f:entry title="Parameter file path + name (all paths are relative to the current workspace)" field="parameterFile">
<f:entry title="Parameter file path + name (paths are relative to the current workspace or absolute NFS path)" field="parameterFile">
<f:textbox />
</f:entry>
</f:optionalBlock>
Expand Down