Examples of FilePath


Examples of hudson.FilePath

        project.getBuildersList().add(new TestBuilder() {
            @Override
            public boolean perform(AbstractBuild<?, ?> abstractBuild, Launcher launcher, BuildListener buildListener) throws InterruptedException, IOException {
                final URL failedTestReport = OnlyRegressionsTest.class.getClassLoader().getResource("hudson/plugins/emailext/testreports/failed_test.xml");
                FilePath workspace = abstractBuild.getWorkspace();

                FilePath testDir = workspace.child("target").child("testreports");
                testDir.mkdirs();
                FilePath reportFile = testDir.child("failed_test.xml");
                reportFile.copyFrom(failedTestReport);

                return true;
            }
        });
        TaskListener listener = StreamTaskListener.fromStdout();
View Full Code Here

Examples of hudson.FilePath

                String extension = ".html";
                if (messageContentType.startsWith("text/plain")) {
                    extension = ".txt";
                }

                FilePath savedOutput = new FilePath(context.getBuild().getWorkspace(),
                        String.format("%s-%s%d%s", context.getTrigger().getDescriptor().getDisplayName(), context.getBuild().getId(), random.nextInt(), extension));
                savedOutput.write(text, charset);
            }
        } catch (IOException e) {
            context.getListener().getLogger().println("Error trying to save email output to file. " + e.getMessage());
        } catch (InterruptedException e) {
            context.getListener().getLogger().println("Error trying to save email output to file. " + e.getMessage());
View Full Code Here

Examples of hudson.FilePath

    }

    private List<MimeBodyPart> getAttachments(final ExtendedEmailPublisherContext context)
            throws MessagingException, InterruptedException, IOException {
        List<MimeBodyPart> attachments = null;
        FilePath ws = context.getBuild().getWorkspace();
        long totalAttachmentSize = 0;
        long maxAttachmentSize = context.getPublisher().getDescriptor().getMaxAttachmentSize();
        if (ws == null) {
            context.getListener().error("Error: No workspace found!");
        } else if (!StringUtils.isBlank(attachmentsPattern)) {
            attachments = new ArrayList<MimeBodyPart>();

            FilePath[] files = ws.list(ContentBuilder.transformText(attachmentsPattern, context, null));

            for (FilePath file : files) {
                if (maxAttachmentSize > 0
                        && (totalAttachmentSize + file.length()) >= maxAttachmentSize) {
                    context.getListener().getLogger().println("Skipping `" + file.getName()
View Full Code Here

Examples of hudson.FilePath

                    continue;   // looks like this is already archived
                if (build.isArchivingDisabled()) {
                    listener.getLogger().println("[JENKINS] Archiving disabled - not archiving " + assembly);
                }
                else {
                    FilePath target = build.getArtifactsDir().child(assembly.getName());
                    listener.getLogger().println("[JENKINS] Archiving "+ assembly+" to "+target);
                    new FilePath(assembly).copyTo(target);
                    // TODO: fingerprint
                }
            }
        }
View Full Code Here

Examples of hudson.FilePath

        if(f==null || files.contains(f) || !f.isFile())
            return;

        // new file
        files.add(f);
        String digest = new FilePath(f).digest();
        record.put(fileNamePrefix+':'+f.getName(),digest);
    }
View Full Code Here

Examples of hudson.FilePath

        if(destDir.exists()) {
            // try to get the storage location if this is a multi-module project.
            final String moduleName = getModuleName(build, pom);
            // store at MavenModuleSet level and moduleName
            final FilePath target = build.getModuleSetRootDir().child("site").child(moduleName);
            try {
                listener.getLogger().printf("[JENKINS] Archiving site from %s to %s\n", destDir, target);
                new FilePath(destDir).copyRecursiveTo("**/*",target);
            } catch (IOException e) {
                Util.displayIOException(e,listener);
                e.printStackTrace(listener.fatalError("Unable to copy site from %s to %s",destDir,target));
                build.setResult(Result.FAILURE);
            }
View Full Code Here

Examples of hudson.FilePath

        MavenInstallation m=null;
        File settingsLoc = null, remoteGlobalSettingsFromConfig = null;
        String profiles = null;
        Properties systemProperties = null;
        String privateRepository = null;
        FilePath remoteSettingsFromConfig = null;
       
        File tmpSettings = File.createTempFile( "jenkins", "temp-settings.xml" );
        try {
            AbstractProject project = build.getProject();
           
            if (project instanceof MavenModuleSet) {
                MavenModuleSet mavenModuleSet = ((MavenModuleSet) project);
                profiles = mavenModuleSet.getProfiles();
                systemProperties = mavenModuleSet.getMavenProperties();
               
                // olamy see 
                // we have to take about the settings use for the project
                // order tru configuration
                // TODO maybe in goals with -s,--settings last wins but not done in during pom parsing
                // or -Dmaven.repo.local
                // if not we must get ~/.m2/settings.xml then $M2_HOME/conf/settings.xml
               
                // TODO check if the remoteSettings has a localRepository configured and disabled it

                String settingsConfigId = mavenModuleSet.getSettingConfigId();
                String altSettingsPath = null;

                if (!StringUtils.isBlank(settingsConfigId)) {
                    SettingConfig config = SettingsProviderUtils.findSettings(settingsConfigId);
                    if (config == null) {
                        listener.getLogger().println(
                            " your Apache Maven build is setup to use a config with id " + settingsConfigId
                                + " but cannot find the config" );
                    } else {
                        listener.getLogger().println( "redeploy publisher using settings config with name " + config.name );
                        if (config.content != null ) {
                            remoteSettingsFromConfig = SettingsProviderUtils.copyConfigContentToFilePath( config, build.getWorkspace() );
                            altSettingsPath = remoteSettingsFromConfig.getRemote();
                        }
                    }
                }

                if (mavenModuleSet.getAlternateSettings() != null ) {
                    altSettingsPath = mavenModuleSet.getAlternateSettings();
                }

                String globalSettingsConfigId = mavenModuleSet.getGlobalSettingConfigId();
                if (!StringUtils.isBlank(globalSettingsConfigId)) {
                    SettingConfig config = SettingsProviderUtils.findSettings(globalSettingsConfigId);
                    if (config == null) {
                        listener.getLogger().println(
                            " your Apache Maven build is setup to use a global settings config with id "
                                + globalSettingsConfigId + " but cannot find the config" );
                    } else {
                        listener.getLogger().println( "redeploy publisher using global settings config with name " + config.name );
                        if (config.content != null ) {
                            remoteGlobalSettingsFromConfig = SettingsProviderUtils.copyConfigContentToFile( config );
                        }
                    }
                }
                Node buildNode = build.getBuiltOn();
               
                if(buildNode == null) {
                    // assume that build was made on master
                    buildNode = Jenkins.getInstance();
                }

                if (StringUtils.isBlank( altSettingsPath ) ) {
                    // get userHome from the node where job has been executed
                    String remoteUserHome = build.getWorkspace().act( new GetUserHome() );
                    altSettingsPath = remoteUserHome + "/.m2/settings.xml";
                }
               
                // we copy this file in the master in a  temporary file
                FilePath filePath = new FilePath( tmpSettings );
                FilePath remoteSettings = build.getWorkspace().child( altSettingsPath );
                if (!remoteSettings.exists()) {
                    // JENKINS-9084 we finally use $M2_HOME/conf/settings.xml as maven do
                   
                    String mavenHome =
                        ((MavenModuleSet) project).getMaven().forNode(buildNode, listener ).getHome();
                    String settingsPath = mavenHome + "/conf/settings.xml";
                    remoteSettings = build.getWorkspace().child( settingsPath);
                }
                listener.getLogger().println( "Maven RedeployPublished use remote " + (buildNode != null ? buildNode.getNodeName() : "local"
                                              + " maven settings from : " + remoteSettings.getRemote() );
                remoteSettings.copyTo( filePath );
                settingsLoc = tmpSettings;
               
            }

            MavenEmbedderRequest mavenEmbedderRequest = new MavenEmbedderRequest(listener,
View Full Code Here

Examples of hudson.FilePath

        // otherwise extract the copy we have.
        // this happens when a test is invoked from an IDE, for example.
        LOGGER.warning("Extracting a copy of Maven bundled in the test harness. " +
                "To avoid a performance hit, set the system property 'maven.home' to point to a Maven2 installation.");
        FilePath mvn = hudson.getRootPath().createTempFile("maven", "zip");
        mvn.copyFrom(HudsonTestCase.class.getClassLoader().getResource(mavenVersion + "-bin.zip"));
        File mvnHome =  new File(buildDirectory);
        mvn.unzip(new FilePath(mvnHome));
        // TODO: switch to tar that preserves file permissions more easily
        if(!Functions.isWindows())
            GNUCLibrary.LIBC.chmod(new File(mvnHome,mavenVersion+"/bin/mvn").getPath(),0755);

        MavenInstallation mavenInstallation = new MavenInstallation("default",
View Full Code Here

Examples of hudson.FilePath

        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);
View Full Code Here

Examples of hudson.FilePath

        /**
         * Serves the site.
         */
        public DirectoryBrowserSupport doDynamic() {
            return new DirectoryBrowserSupport(this,new FilePath(getSiteDir(project)), project.getDisplayName()+" site", "help.gif", false);
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.