@Override public FilePath getBaseDirectory(final AbstractBuild<?, ?> build) { return Hudson.getInstance().getRootPath(); }
/** * Handles installation onto the master node. */ public void consume(final EventObject event) throws Exception { if (event instanceof ReadyEvent) { ReadyEvent target = (ReadyEvent)event; FilePath root = target.getHudson().getRootPath(); if (install(root, null)) { log.info("Maven slave bundle installed"); } } }
/** * Binds /userContent/... to $HUDSON_HOME/userContent. */ public DirectoryBrowserSupport doUserContent() { return new DirectoryBrowserSupport(this, getRootPath().child("userContent"), "User content", "folder.gif", true); }
public static FormValidation validateFileOnMaster(final String value) { // this check prevents a NPE when called from global configuration - if not global, use validatePath directly if (JenkinsCapabilities.missing(JenkinsCapabilities.VALIDATE_FILE_ON_MASTER_FROM_GLOBAL_CFG)) return FormValidation.ok(); try { return Hudson.getInstance().getRootPath().validateRelativePath(value, true, true); } catch (IOException ioe) { return FormValidation.error(ioe, ""); } }
/** * Binds /userContent/... to $HUDSON_HOME/userContent. */ public DirectoryBrowserSupport doUserContent() { return new DirectoryBrowserSupport(this, getRootPath().child("userContent"), "User content", "folder.gif", true); }
/** * Binds /userContent/... to $HUDSON_HOME/userContent. */ public DirectoryBrowserSupport doUserContent() { return new DirectoryBrowserSupport(this, getRootPath().child("userContent"), "User content", "folder.png", true); }
/** * Binds /userContent/... to $HUDSON_HOME/userContent. */ public DirectoryBrowserSupport doUserContent() { return new DirectoryBrowserSupport(this, getRootPath().child("userContent"), "User content", "folder.png", true); }
@Override public FilePath getBaseDirectory(final AbstractBuild<?, ?> build) { return new FilePath(Hudson.getInstance().getRootPath(), build.getArtifactsDir().getAbsolutePath()); }
@Override public void onAddedTo(final AbstractBuild build) { final XTriggerCauseAction causeAction = build.getAction(XTriggerCauseAction.class); if (causeAction != null) { try { Hudson.getInstance().getRootPath().act(new Callable<Void, XTriggerException>() { @Override public Void call() throws XTriggerException { causeAction.setBuild(build); File triggerLogFile = causeAction.getLogFile(); String logContent = causeAction.getLogMessage(); try { FileUtils.writeStringToFile(triggerLogFile, logContent); } catch (IOException ioe) { throw new XTriggerException(ioe); } return null; } }); } catch (IOException ioe) { LOGGER.log(Level.SEVERE, "Problem to attach cause object to build object.", ioe); } catch (InterruptedException ie) { LOGGER.log(Level.SEVERE, "Problem to attach cause object to build object.", ie); } catch (XTriggerException xe) { LOGGER.log(Level.SEVERE, "Problem to attach cause object to build object.", xe); } } }
/** * Extracts Ant and configures it. */ protected Ant.AntInstallation configureDefaultAnt() throws Exception { Ant.AntInstallation antInstallation; if (System.getenv("ANT_HOME") != null) { antInstallation = new AntInstallation("default", System.getenv("ANT_HOME"), NO_PROPERTIES); } else { LOGGER.warning("Extracting a copy of Ant bundled in the test harness. " + "To avoid a performance hit, set the environment variable ANT_HOME to point to an Ant installation."); FilePath ant = hudson.getRootPath().createTempFile("ant", "zip"); ant.copyFrom(HudsonTestCase.class.getClassLoader().getResource("apache-ant-1.8.1-bin.zip")); File antHome = createTmpDir(); ant.unzip(new FilePath(antHome)); // TODO: switch to tar that preserves file permissions more easily if(!Functions.isWindows()) GNUCLibrary.LIBC.chmod(new File(antHome,"apache-ant-1.8.1/bin/ant").getPath(),0755); antInstallation = new AntInstallation("default", new File(antHome,"apache-ant-1.8.1").getAbsolutePath(),NO_PROPERTIES); } hudson.getDescriptorByType(Ant.DescriptorImpl.class).setInstallations(antInstallation); return antInstallation; }
/** * Extracts Ant and configures it. */ protected Ant.AntInstallation configureDefaultAnt() throws Exception { Ant.AntInstallation antInstallation; if (System.getenv("ANT_HOME") != null) { antInstallation = new AntInstallation("default", System.getenv("ANT_HOME"), NO_PROPERTIES); } else { LOGGER.warning("Extracting a copy of Ant bundled in the test harness. " + "To avoid a performance hit, set the environment variable ANT_HOME to point to an Ant installation."); FilePath ant = hudson.getRootPath().createTempFile("ant", "zip"); ant.copyFrom(HudsonTestCase.class.getClassLoader().getResource("apache-ant-1.8.1-bin.zip")); File antHome = createTmpDir(); ant.unzip(new FilePath(antHome)); // TODO: switch to tar that preserves file permissions more easily if(!Functions.isWindows()) GNUCLibrary.LIBC.chmod(new File(antHome,"apache-ant-1.8.1/bin/ant").getPath(),0755); antInstallation = new AntInstallation("default", new File(antHome,"apache-ant-1.8.1").getAbsolutePath(),NO_PROPERTIES); } hudson.getDescriptorByType(Ant.DescriptorImpl.class).setInstallations(antInstallation); return antInstallation; }
/** * Extracts Ant and configures it. */ protected Ant.AntInstallation configureDefaultAnt() throws Exception { Ant.AntInstallation antInstallation; if (System.getenv("ANT_HOME") != null) { antInstallation = new AntInstallation("default", System.getenv("ANT_HOME"), NO_PROPERTIES); } else { LOGGER.warning("Extracting a copy of Ant bundled in the test harness. " + "To avoid a performance hit, set the environment variable ANT_HOME to point to an Ant installation."); FilePath ant = hudson.getRootPath().createTempFile("ant", "zip"); ant.copyFrom(HudsonTestCase.class.getClassLoader().getResource("apache-ant-1.8.1-bin.zip")); File antHome = createTmpDir(); ant.unzip(new FilePath(antHome)); // TODO: switch to tar that preserves file permissions more easily if (!Functions.isWindows()) { Util.chmod(new File(antHome, "apache-ant-1.8.1/bin/ant"), 0755); } antInstallation = new AntInstallation("default", new File(antHome, "apache-ant-1.8.1").getAbsolutePath(), NO_PROPERTIES); } hudson.getDescriptorByType(Ant.DescriptorImpl.class).setInstallations(antInstallation); return antInstallation; }
FilePath mvn = hudson.getRootPath().createTempFile("maven", "zip"); mvn.copyFrom(HudsonTestCase.class.getClassLoader().getResource(mavenVersion + "-bin.zip")); File mvnHome = new File(buildDirectory);//createTmpDir();
FilePath mvn = hudson.getRootPath().createTempFile("maven", "zip"); mvn.copyFrom(HudsonTestCase.class.getClassLoader().getResource(mavenVersion + "-bin.zip")); File mvnHome = new File(buildDirectory);//createTmpDir();
FilePath mvn = hudson.getRootPath().createTempFile("maven", "zip"); mvn.copyFrom(HudsonTestCase.class.getClassLoader().getResource(mavenVersion + "-bin.zip")); File mvnHome = new File(buildDirectory);//createTmpDir();
@Override public boolean perform(final AbstractBuild<?, ?> build, final Launcher launcher, final BuildListener listener) throws InterruptedException, IOException { final PrintStream console = listener.getLogger(); if (!isBuildGoodEnoughToRun(build, console)) return true; final BPBuildEnv currentBuildEnv = new BPBuildEnv(getEnvironmentVariables(build, listener), build.getWorkspace(), build.getTimestamp()); BPBuildEnv targetBuildEnv = null; if (PROMOTION_CLASS_NAME.equals(build.getClass().getCanonicalName())) { AbstractBuild<?, ?> promoted; try { final Method getTarget = build.getClass().getMethod("getTarget", (Class<?>[]) null); promoted = (AbstractBuild) getTarget.invoke(build, (Object[]) null); } catch (Exception e) { throw new RuntimeException(Messages.exception_failedToGetPromotedBuild(), e); } targetBuildEnv = new BPBuildEnv(getEnvironmentVariables(promoted, listener), new FilePath(promoted.getArtifactsDir()), promoted.getTimestamp()); } final BPBuildInfo buildInfo = new BPBuildInfo(listener, consolePrefix, Hudson.getInstance().getRootPath(), currentBuildEnv, targetBuildEnv); fixup(build, buildInfo); final Result result = delegate.perform(buildInfo); if (build.getResult() == null) build.setResult(result); else build.setResult(result.combine(build.getResult())); return result.isBetterOrEqualTo(Result.UNSTABLE); }
rootFilePathOnMaster = Hudson.getInstance().getRootPath(); rootFilePathOnMaster = Hudson.getInstance().getRootPath().child("userContent");