Some of the downstream builds might be configured for All, lastCompleted, lastSuccessful and others for lastStable. Multiple downstream builds might have different requirements. It would be better to have this config in one place, the downstream jobs, and not have to work around this change and require additional logic in the upstream build to determine what RunParameter to pass to the downstream job.

It worked as expected when the Run#getLastStableBuild used to be like:

public RunT getLastStableBuild() {
        RunT r = getLastBuild();
        while (r != null
                && (r.isBuilding() || r.getResult().isWorseThan(Result.SUCCESS)))
            r = r.getPreviousBuild();
        return r;
    }

It no longer works after it was changed to use the Permalink

public RunT getLastStableBuild() {
        return (RunT)Permalink.LAST_STABLE_BUILD.resolve(this);
    }

The State.POST_PRODUCTION seems to be for this very scenario, where the build result is now final and it is now ok to trigger other builds as described in JENKINS-980

private static enum State {
    /**
     * Build is completed now, and the status is determined,
     * but log files are still being updated.
     *
     * The significance of this state is that Jenkins
     * will now see this build as completed. Things like
     * "triggering other builds" requires this as pre-condition.
     * See JENKINS-980.
     */
    POST_PRODUCTION,

In the Run#execute method, I think we should update the PeepholePermalinks as soon as we change state and before we trigger fireCompleted on the listeners????
Currently the Permalinks are updated in a fireCompleted event on a listener, the same as triggering downstream jobs. But they seem to be updated after the other builds are triggered.

// advance the state.
    // the significance of doing this is that Jenkins
    // will now see this build as completed.
    // things like triggering other builds requires this as pre-condition.
    // see issue #980.
    //
    state = State.POST_PRODUCTION;

    if (listener != null) {
        try {
            job.cleanUp(listener);
        } catch (Exception e) {
            handleFatalBuildProblem(listener,e);
            // too late to update the result now
        }
        RunListener.fireCompleted(this,listener);
        listener.finished(result);
        listener.closeQuietly();
    }
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators.
For more information on JIRA, see: http://www.atlassian.com/software/jira

--
You received this message because you are subscribed to the Google Groups "Jenkins Issues" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to