in deploy-runner-agent-smb/src/main/java/jetbrains/buildServer/deployer/agent/smb/SMBBuildProcessAdapter.java [62:105]
public BuildFinishedStatus runProcess() {
String targetWithProtocol;
if (myTarget.startsWith("\\\\")) {
targetWithProtocol = SMB + myTarget.substring(2);
} else if (!myTarget.startsWith(SMB)) {
targetWithProtocol = SMB + myTarget;
} else {
targetWithProtocol = myTarget;
}
// Share and directories names require trailing /
if (!targetWithProtocol.endsWith("/")) {
targetWithProtocol = targetWithProtocol + "/";
}
targetWithProtocol = targetWithProtocol.replaceAll("\\\\", "/");
NtlmPasswordAuthentication auth = new NtlmPasswordAuthentication(myDomain == null ? "" : myDomain,
myUsername, myPassword);
final String settingsString = "Trying to connect with following parameters:\n" +
"username=[" + myUsername + "]\n" +
"domain=[" + (myDomain == null ? "" : myDomain) + "]\n" +
"target=[" + targetWithProtocol + "]";
try {
Loggers.AGENT.debug(settingsString);
myLogger.message("Starting upload via SMB to " + myTarget);
SmbFile destinationDir = new SmbFile(targetWithProtocol, auth);
for (ArtifactsCollection artifactsCollection : myArtifactsCollections) {
final int numOfUploadedFiles = upload(artifactsCollection.getFilePathMap(), destinationDir);
myLogger.message("Uploaded [" + numOfUploadedFiles + "] files for [" + artifactsCollection.getSourcePath() + "] pattern");
}
return BuildFinishedStatus.FINISHED_SUCCESS;
} catch (UploadInterruptedException e) {
myLogger.warning("SMB upload interrupted.");
return BuildFinishedStatus.FINISHED_FAILED;
} catch (IOException e) {
DeployerAgentUtils.logBuildProblem(myLogger, e.getMessage());
LOG.warnAndDebugDetails("Error executing SMB command", e);
return BuildFinishedStatus.FINISHED_FAILED;
}
}