/** * Checks if the remote path is Unix. */ boolean isUnix() { // if the path represents a local path, there' no need to guess. if(!isRemote()) return File.pathSeparatorChar!=';'; // note that we can't use the usual File.pathSeparator and etc., as the OS of // the machine where this code runs and the OS that this FilePath refers to may be different. // Windows absolute path is 'X:\...', so this is usually a good indication of Windows path if(remote.length()>3 && remote.charAt(1)==':' && remote.charAt(2)=='\\') return false; // Windows can handle '/' as a path separator but Unix can't, // so err on Unix side return remote.indexOf("\\")==-1; }
@Override public Void invoke(File dir, VirtualChannel channel) throws IOException, InterruptedException { assert !FilePath.this.isRemote(); // this.channel==target.channel above unzip(dir, reading(new File(FilePath.this.getRemote()))); // shortcut to local file return null; } private static final long serialVersionUID = 1L;
listener.getLogger().println(message); if (isRemote()) {
public boolean onMaster() { return !configDir.isRemote(); }
/** * Checks if the remote path is Unix. */ boolean isUnix() { // if the path represents a local path, there' no need to guess. if(!isRemote()) return File.pathSeparatorChar!=';'; // note that we can't use the usual File.pathSeparator and etc., as the OS of // the machine where this code runs and the OS that this FilePath refers to may be different. // Windows absolute path is 'X:\...', so this is usually a good indication of Windows path if(remote.length()>3 && remote.charAt(1)==':' && remote.charAt(2)=='\\') return false; // Windows can handle '/' as a path separator but Unix can't, // so err on Unix side return remote.indexOf("\\")==-1; }
/** * Checks if the remote path is Unix. */ private boolean isUnix() { // if the path represents a local path, there' no need to guess. if(!isRemote()) return File.pathSeparatorChar!=';'; // note that we can't use the usual File.pathSeparator and etc., as the OS of // the machine where this code runs and the OS that this FilePath refers to may be different. // Windows absolute path is 'X:\...', so this is usually a good indication of Windows path if(remote.length()>3 && remote.charAt(1)==':' && remote.charAt(2)=='\\') return false; // Windows can handle '/' as a path separator but Unix can't, // so err on Unix side return remote.indexOf("\\")==-1; }
/** * Checks if the remote path is Unix. */ private boolean isUnix() { // if the path represents a local path, there' no need to guess. if(!isRemote()) return File.pathSeparatorChar!=';'; // note that we can't use the usual File.pathSeparator and etc., as the OS of // the machine where this code runs and the OS that this FilePath refers to may be different. // Windows absolute path is 'X:\...', so this is usually a good indication of Windows path if(remote.length()>3 && remote.charAt(1)==':' && remote.charAt(2)=='\\') return false; // Windows can handle '/' as a path separator but Unix can't, // so err on Unix side return remote.indexOf("\\")==-1; }
/** * Checks if the remote path is Unix. */ private boolean isUnix() { // if the path represents a local path, there' no need to guess. if(!isRemote()) return File.pathSeparatorChar!=';'; // note that we can't use the usual File.pathSeparator and etc., as the OS of // the machine where this code runs and the OS that this FilePath refers to may be different. // Windows absolute path is 'X:\...', so this is usually a good indication of Windows path if(remote.length()>3 && remote.charAt(1)==':' && remote.charAt(2)=='\\') return false; // Windows can handle '/' as a path separator but Unix can't, // so err on Unix side return remote.indexOf("\\")==-1; }
public Void invoke(File dir, VirtualChannel channel) throws IOException, InterruptedException { assert !FilePath.this.isRemote(); // this.channel==target.channel above unzip(dir, reading(new File(FilePath.this.getRemote()))); // shortcut to local file return null; }
/** * Checks if the remote path is Unix. */ private boolean isUnix() { // if the path represents a local path, there' no need to guess. if (!isRemote()) { return File.pathSeparatorChar != ';'; } // note that we can't use the usual File.pathSeparator and etc., as the OS of // the machine where this code runs and the OS that this FilePath refers to may be different. // Windows absolute path is 'X:\...', so this is usually a good indication of Windows path if (remote.length() > 3 && remote.charAt(1) == ':' && remote.charAt(2) == '\\') { return false; } // Windows can handle '/' as a path separator but Unix can't, // so err on Unix side return remote.indexOf("\\") == -1; }
/** * Create the workspace from its home folder. * * @param home * The home folder * @return The workspace */ public static Workspace fromHome(FilePath home) { return home.isRemote() ? new SlaveWorkspace(home) : new MasterWorkspace(home); }
@Override public Boolean invoke(File parent, VirtualChannel channel) throws IOException, InterruptedException { if (potentialChild.isRemote()) { //Not on the same machine so can't be a child of the local file return false; } FilePath test = potentialChild.getParent(); FilePath target = new FilePath(parent); while(test != null && !target.equals(test)) { test = test.getParent(); } return target.equals(test); } }
public static Node workspaceToNode(FilePath workspace) { // TODO https://trello.com/c/doFFMdUm/46-filepath-getcomputer Jenkins j = Jenkins.getActiveInstance(); if (workspace != null && workspace.isRemote()) { for (Computer c : j.getComputers()) { if (c.getChannel() == workspace.getChannel()) { Node n = c.getNode(); if (n != null) { return n; } } } } return j; }
if (file.isRemote()) { deleteLocalFile = true; localFile = File.createTempFile("s3plugin", ".bin");
@CheckForNull private static Node workspaceToNode(FilePath workspace) { // TODO https://trello.com/c/doFFMdUm/46-filepath-getcomputer Jenkins j = Jenkins.getInstance(); if (j != null && workspace.isRemote()) { for (Computer c : j.getComputers()) { if (c.getChannel() == workspace.getChannel()) { Node n = c.getNode(); if (n != null) { return n; } } } } return j; }
private List<ParserResult> parseConsoleLog(final Run<?, ?> run, final FilePath workspace, final PluginLogger logger) throws IOException, InterruptedException { List<ParserResult> results = Lists.newArrayList(); for (ConsoleParser parser : getConsoleParsers()) { String parserName = parser.getParserName(); logger.log("Parsing warnings in console log with parser " + parserName); Collection<FileAnnotation> warnings = new ParserRegistry(ParserRegistry.getParsers(parserName), getDefaultEncoding()).parse(run.getLogFile()); if (!workspace.isRemote()) { guessModuleNames(workspace, warnings); } ParserResult project = new ParserResult(workspace, canResolveRelativePaths()); project.addAnnotations(warnings); results.add(annotate(run, workspace, filterWarnings(project, logger), parserName)); } return results; }
FilePath docker = bin.child("docker"); if (install.isRemote()) {
private List<ParserResult> parseConsoleLog(final AbstractBuild<?, ?> build, final PluginLogger logger) throws IOException, InterruptedException { List<ParserResult> results = Lists.newArrayList(); for (ConsoleParser parser : getConsoleParsers()) { String parserName = parser.getParserName(); logger.log("Parsing warnings in console log with parser " + parserName); Collection<FileAnnotation> warnings = new ParserRegistry( ParserRegistry.getParsers(parserName), getDefaultEncoding(), getIncludePattern(), getExcludePattern()).parse(build .getLogFile()); if (!build.getWorkspace().isRemote()) { guessModuleNames(build, warnings); } ParserResult project; if (canResolveRelativePaths()) { project = new ParserResult(build.getWorkspace()); } else { project = new ParserResult(); } project.addAnnotations(warnings); results.add(annotate(build, project, parserName)); } return results; }
public void registerHook(FilePath repo) throws Exception { assert !repo.isRemote() : "TODO not currently supported for remote repositories since the callback URL would not be accessible from the Docker container unless we do some more exotic network configuration"; FilePath hgDir = repo.child(".hg"); FilePath hook = hgDir.child("hook.py"); hook.write( "import urllib\n" + "import urllib2\n" + "\n" + "def commit(ui, repo, node, **kwargs):\n" + " data = {\n" + " 'url': '" + repo.toURI().toString() + "',\n" + " 'branch': repo[node].branch(),\n" + " 'changesetId': node,\n" + " }\n" + " req = urllib2.Request('" + j.getURL() + "mercurial/notifyCommit')\n" + " rsp = urllib2.urlopen(req, urllib.urlencode(data))\n" + " ui.warn('Notify Commit hook response: %s\\n' % rsp.read())\n" + " pass\n", null); hgDir.child("hgrc").write( "[hooks]\n" + "commit.jenkins = python:" + hook.getRemote() + ":commit", null); }
getDefaultEncoding(), getIncludePattern(), getExcludePattern()); Collection<FileAnnotation> warnings = registry.parse(logFile, logger); if (!build.getWorkspace().isRemote()) { String workspace = build.getWorkspace().getRemote(); ModuleDetector detector = new ModuleDetector(new File(workspace));