Package hudson.model

Examples of hudson.model.Run


    projectB.updateNextBuildNumber(3);

    int expectedBuildNumber = projectB.getNextBuildNumber();
    projectA.scheduleBuild2(0, new UserCause()).get();

    Run buildB1 = projectB.getBuildByNumber(expectedBuildNumber);
    EnvVars envVars = builder.getEnvVars();
    //System.out.println("envVars: " + envVars);

    assertThat(envVars, notNullValue());
    assertThat(envVars, hasEntry("LAST_TRIGGERED_JOB_NAME", "projectB"));
    assertThat(envVars, hasEntry("TRIGGERED_BUILD_NUMBER_projectB", Integer.toString(expectedBuildNumber)));
    assertThat(envVars, hasEntry("TRIGGERED_BUILD_RESULT_projectB", buildB1.getResult().toString()));
    assertThat(envVars, hasEntry("TRIGGERED_BUILD_RESULT_projectB_RUN_" + Integer.toString(expectedBuildNumber), buildB1.getResult().toString()));
    assertThat(envVars, hasEntry("TRIGGERED_BUILD_RUN_COUNT_projectB", "1"));
    assertThat(envVars, hasEntry("TRIGGERED_JOB_NAMES", "projectB"));

    // The below test for expectedBuildNumber is meaningless if the
    // value doesn't update, though it should always update.
View Full Code Here


    int expectedBuildNumber = projectB.getNextBuildNumber();
    int expectedBuildNumberC = projectC.getNextBuildNumber();
    projectA.scheduleBuild2(0, new UserCause()).get();
    waitUntilNoActivity();

    Run buildB1 = projectB.getBuildByNumber(expectedBuildNumber);
    Run buildC1 = projectC.getBuildByNumber(expectedBuildNumberC);
    EnvVars envVars = builder.getEnvVars();
    //System.out.println("envVars: " + envVars);

    assertThat(envVars, notNullValue());
    assertThat(envVars, hasEntry("LAST_TRIGGERED_JOB_NAME", "projectB"));
    assertThat(envVars, hasEntry("TRIGGERED_BUILD_NUMBER_projectB", Integer.toString(expectedBuildNumber)));
    assertThat(envVars, hasEntry("TRIGGERED_BUILD_RESULT_projectB", buildB1.getResult().toString()));
    assertThat(envVars, hasEntry("TRIGGERED_BUILD_RESULT_projectB_RUN_" + Integer.toString(expectedBuildNumber), buildB1.getResult().toString()));
    assertThat(envVars, hasEntry("TRIGGERED_BUILD_RUN_COUNT_projectB", "1"));
    assertThat(envVars, hasEntry("TRIGGERED_JOB_NAMES", "projectB"));
    // check that we don't see entries for projectC
    assertThat(envVars, not(hasEntry("TRIGGERED_BUILD_NUMBER_projectC", Integer.toString(expectedBuildNumberC))));
    assertThat(envVars, not(hasEntry("TRIGGERED_BUILD_RESULT_projectC_RUN_" + Integer.toString(expectedBuildNumberC), buildC1.getResult().toString())));

  }
View Full Code Here

        projectA.getPublishersList().add(new BuildTrigger(
                new BuildTriggerConfig("projectB", ResultCondition.SUCCESS,
                    new CurrentBuildParameters(),
                    new PredefinedBuildParameters("BAZ=moo\nHOHO=blah"))));
        hudson.rebuildDependencyGraph();
        Run r = (Run)projectA.scheduleBuild2(0, new UserCause(), new ParametersAction(
                new StringParameterValue("BAR", "foo"),
                new StringParameterValue("BAZ", "override-me"))).get();
        Queue.Item q = hudson.getQueue().getItem(projectB);
        assertNotNull("projectB should be triggered: " + getLog(r), q);
        r = (Run)q.getFuture().get();
        assertEquals("should be exactly one ParametersAction", 1,
                     r.getActions(ParametersAction.class).size());
        EnvVars envVars = builder.getEnvVars();
        assertNotNull("builder should record environment", envVars);
        assertEquals("FOO", "bar", envVars.get("FOO"));
        assertEquals("BAR", "foo", envVars.get("BAR"));
        assertEquals("BAZ", "moo", envVars.get("BAZ"));
View Full Code Here

                trigger = false;
            }
            else {
                AbstractBuild<?,?> dlb = down.getLastBuild(); // can be null.
                for (AbstractIvyProject up : Util.filter(down.getUpstreamProjects(),AbstractIvyProject.class)) {
                    Run ulb;
                    if(up==getParent()) {
                        // the current build itself is not registered as lastSuccessfulBuild
                        // at this point, so we have to take that into account. ugly.
                        if(getResult()==null || !getResult().isWorseThan(Result.UNSTABLE))
                            ulb = this;
                        else
                            ulb = up.getLastSuccessfulBuild();
                    } else
                        ulb = up.getLastSuccessfulBuild();
                    if(ulb==null) {
                        // if no usable build is available from the upstream,
                        // then we have to wait at least until this build is ready
                        if(debug)
                            listener.getLogger().println(" -> No, because another upstream "+up+" for "+down+" has no successful build");
                        trigger = false;
                        break;
                    }
                   
                    // if no record of the relationship in the last build
                    // is available, we'll just have to assume that the condition
                    // for the new build is met, or else no build will be fired forever.
                    if(dlb==null)   continue;
                    int n = dlb.getUpstreamRelationship(up);
                    if(n==-1)   continue;
                   
                    assert ulb.getNumber()>=n;
                }
            }
           
            if(trigger) {
                listener.getLogger().println(Messages.IvyBuild_Triggering(down.getName()));
View Full Code Here

        story.addStep(new Statement() {
                          @Override
                          public void evaluate() throws Throwable {
                              story.j.waitUntilNoActivity();
                              FreeStyleProject p1 = story.j.jenkins.getItemByFullName("test1", FreeStyleProject.class);
                              Run r = p1.getLastBuild();
                              assertNotNull(r);
                              assertEquals(1, r.number);
                              assertEquals(Result.SUCCESS, r.getResult());
                              assertEquals(0, story.j.jenkins.getQueue().getItems().length);
                          }
                      }
        );
    }
View Full Code Here

    private transient ArtifactUnarchiverStep step;

    @Override
    protected List<FilePath> run() throws Exception {
        // where to copy artifacts from?
        Run r = build; // TODO consider an option to override this (but in what format?)

        ArtifactManager am = r.getArtifactManager();

        List<FilePath> files = new ArrayList<FilePath>();

        if (step.mapping == null)
            throw new AbortException("'mapping' has not been defined for this 'unarchive' step");
View Full Code Here

            String parentJobName = (String)bpObj;
            int buildNum = ((Integer)bnObj).intValue();
            TopLevelItem it = Jenkins.getInstance().getItem(parentJobName);
            if (it instanceof Project){
              parentProj = (Project)it;
              Run build = parentProj.getLastBuild();
              if (build != null){
                if (build.getNumber() == buildNum){
                  buildNum = buildNum;
                  log = BuildLoggerMap.get(parentJobName,buildNum);
                }
              }
            }
View Full Code Here

    public Collection<Run> getCoverageRuns() {
        LinkedList<Run> allResults = new LinkedList<Run>();

        for (Job job : getDashboard().getJobs()) {
            // Find the latest successful coverage data
            Run run = job.getLastSuccessfulBuild();
            if (run == null) {
                continue;
            }

            CoberturaBuildAction rbb = run
                    .getAction(CoberturaBuildAction.class);

            if (rbb != null) {
                allResults.add(run);
            }
View Full Code Here

    public HashMap<CoverageMetric, Ratio> getTotalCoverageRatio() {
        HashMap<CoverageMetric, Ratio> totalRatioMap = new HashMap<CoverageMetric, Ratio>();
        for (Job job : getDashboard().getJobs()) {
            // Find the latest successful coverage data
            Run run = job.getLastSuccessfulBuild();
            if (run == null) {
                continue;
            }

            CoberturaBuildAction rbb = run
                    .getAction(CoberturaBuildAction.class);

            if (rbb == null) {
                continue;
            }
View Full Code Here

    /**
     * Performs an installation.
     */
    private int install(ToolInstallation t, BuildIDs id, AbstractProject p) throws IOException, InterruptedException {

        Run b = p.getBuildByNumber(Integer.parseInt(id.number));
        if (b==null)
            throw new AbortException("No such build: "+id.number);

        Executor exec = b.getExecutor();
        if (exec==null)
            throw new AbortException(b.getFullDisplayName()+" is not building");

        Node node = exec.getOwner().getNode();

        if (t instanceof NodeSpecific) {
            NodeSpecific n = (NodeSpecific) t;
View Full Code Here

TOP

Related Classes of hudson.model.Run

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.