Package hudson.triggers

Examples of hudson.triggers.SCMTrigger$BuildAction


     * Makes sure that annotations in the polling output is handled correctly.
     */
    public void testPollingOutput() throws Exception {
        FreeStyleProject p = createFreeStyleProject();
        p.setScm(new PollingSCM());
        SCMTrigger t = new SCMTrigger("@daily");
        t.start(p,true);
        p.addTrigger(t);

        buildAndAssertSuccess(p);

        // poll now
View Full Code Here


    /**
     * Schedules a polling of this project.
     */
    public boolean schedulePolling() {
        if(isDisabled())    return false;
        SCMTrigger scmt = getTrigger(SCMTrigger.class);
        if(scmt==null)      return false;
        scmt.run();
        return true;
    }
View Full Code Here

        // request parameters
        hudson.setCrumbIssuer(null);

        FreeStyleProject p = createFreeStyleProject();
        String url = "https://svn.jenkins-ci.org/trunk/hudson/test-projects/trivial-ant";
        SCMTrigger trigger = new SCMTrigger("0 */6 * * *");

        p.setScm(new SubversionSCM(url));
        p.addTrigger(trigger);
        trigger.start(p, true);

        return p;
    }
View Full Code Here

        String[] urls = new String[] {"https://svn.jenkins-ci.org/trunk/hudson/test-projects/trivial-ant",
                "https://svn.jenkins-ci.org/trunk/hudson/test-projects/trivial-maven/"};

        p.setScm(new SubversionSCM(urls, new String[] {"", ""}));
       
        SCMTrigger trigger = new SCMTrigger("0 */6 * * *");
        p.addTrigger(trigger);
        trigger.start(p, true);

        return p;
    }
View Full Code Here

                }
                try {
                    SCMS: for (SCM scm : scmTriggerItem.getSCMs()) {
                    if (scm instanceof SubversionSCM) scmFound = true; else continue;

                    SCMTrigger trigger = scmTriggerItem.getSCMTrigger();
                    if (trigger!=null && !doesIgnorePostCommitHooks(trigger)) triggerFound = true; else continue;

                    SubversionSCM sscm = (SubversionSCM) scm;

                    List<SvnInfo> infos = new ArrayList<SvnInfo>();

                    boolean projectMatches = false;
                    for (ModuleLocation loc : sscm.getProjectLocations(p)) {
                        //LOGGER.fine("Checking uuid for module location + " + loc + " of job "+ p);
                        String url = loc.getURL();
   
                        String repositoryRootPath = null;

                        UUID remoteUUID = null;
                        for (Map.Entry<String, UUID> e : remoteUUIDCache.entrySet()) {
                            if (url.startsWith(e.getKey())) {
                                remoteUUID = e.getValue();
                                repositoryRootPath = SVNURL.parseURIDecoded(e.getKey()).getPath();
                                LOGGER.finer("Using cached uuid for module location " + url + " of job "+ p);
                                break;
                            }
                        }
   
                        if (remoteUUID == null) {
                            if (LOGGER.isLoggable(FINER)) {
                                LOGGER.finer("Could not find " + loc.getURL() + " in " + remoteUUIDCache.keySet().toString());
                            }
                            remoteUUID = loc.getUUID(p, scm);
                            SVNURL repositoryRoot = loc.getRepositoryRoot(p, scm);
                            repositoryRootPath = repositoryRoot.getPath();
                            remoteUUIDCache.put(repositoryRoot.toString(), remoteUUID);
                        }
   
                        if (remoteUUID.equals(uuid)) uuidFound = true; else continue;
   
                        String m = loc.getSVNURL().getPath();
                        String n = repositoryRootPath;
                        if(!m.startsWith(n))    continue;   // repository root should be a subpath of the module path, but be defensive

                        String remaining = m.substring(n.length());
                        if(remaining.startsWith("/"))   remaining=remaining.substring(1);
                        String remainingSlash = remaining + '/';

                        if ( rev != -1 ) {
                            infos.add(new SvnInfo(loc.getURL(), rev));
                        }

                        for (String path : affectedPath) {
                            if(path.equals(remaining) /*for files*/ || path.startsWith(remainingSlash) /*for dirs*/
                            || remaining.length()==0/*when someone is checking out the whole repo (that is, m==n)*/) {
                                // this project is possibly changed. poll now.
                                // if any of the data we used was bogus, the trigger will not detect a change
                                projectMatches = true;
                                pathFound = true;
                            }
                        }
                    }

                    if (projectMatches) {
                        LOGGER.fine("Scheduling the immediate polling of "+p);

                        final RevisionParameterAction[] actions;
                        if (infos.isEmpty()) {
                            actions = new RevisionParameterAction[0];
                        } else {
                            actions = new RevisionParameterAction[] {
                                    new RevisionParameterAction(infos)};
                        }

                        trigger.run(actions);
                        break SCMS;
                    }
                    }

                } catch (SVNException e) {
View Full Code Here

        hg(otherRepo, "init");
        FileUtils.touch(new File(otherRepo, "otherfile"));
        hg(otherRepo, "add", "otherfile");
        hg(otherRepo, "commit", "--message=init");
        WorkflowJob p = r.jenkins.createProject(WorkflowJob.class, "demo");
        p.addTrigger(new SCMTrigger(""));
        p.setQuietPeriod(3); // so it only does one build
        p.setDefinition(new CpsFlowDefinition(
            "node {\n" +
            "    ws {\n" +
            "        dir('main') {\n" +
View Full Code Here

        r.assertLogContains("PRESENT: nextfile", b);
    }

    @Test public void changelogAndPolling() throws Exception {
        WorkflowJob p = r.jenkins.createProject(WorkflowJob.class, "demo");
        p.addTrigger(new SCMTrigger("")); // no schedule, use notifyCommit only
        r.createOnlineSlave(Label.get("remote"));
        p.setDefinition(new CpsFlowDefinition(
            "node('remote') {\n" +
            "    ws {\n" +
            "        git(url: '" + sampleRepo + "')\n" +
View Full Code Here

        git(otherRepo, "init");
        FileUtils.touch(new File(otherRepo, "otherfile"));
        git(otherRepo, "add", "otherfile");
        git(otherRepo, "commit", "--message=init");
        WorkflowJob p = r.jenkins.createProject(WorkflowJob.class, "demo");
        p.addTrigger(new SCMTrigger(""));
        p.setQuietPeriod(3); // so it only does one build
        p.setDefinition(new CpsFlowDefinition(
            "node {\n" +
            "    ws {\n" +
            "        dir('main') {\n" +
View Full Code Here

        run(otherWc, "svn", "co", otherRepoU, ".");
        FileUtils.touch(new File(otherWc, "otherfile"));
        run(otherWc, "svn", "add", "otherfile");
        run(otherWc, "svn", "commit", "--message=init");
        WorkflowJob p = r.jenkins.createProject(WorkflowJob.class, "demo");
        p.addTrigger(new SCMTrigger(""));
        p.setQuietPeriod(3); // so it only does one build
        p.setDefinition(new CpsFlowDefinition(
            "node {\n" +
            "    ws {\n" +
            "        dir('main') {\n" +
View Full Code Here

    /**
     * Schedules a polling of this project.
     */
    public boolean schedulePolling() {
        if(isDisabled())    return false;
        SCMTrigger scmt = getTrigger(SCMTrigger.class);
        if(scmt==null)      return false;
        scmt.run();
        return true;
    }
View Full Code Here

TOP

Related Classes of hudson.triggers.SCMTrigger$BuildAction

Copyright © 2018 www.massapicom. 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.