public AbstractProject getBuildingUpstream() {
        Set<Task> unblockedTasks = Jenkins.getInstance().getQueue().getUnblockedTasks();

        for (AbstractProject tup : getTransitiveUpstreamProjects()) {
			if (tup!=this && (tup.isBuilding() || unblockedTasks.contains(tup)))
                return tup;
        }
        return null;
    }
public AbstractProject getBuildingUpstream ( ) { Set < Task > unblockedTasks = Jenkins . getInstance ( ) . getQueue ( ) . getUnblockedTasks ( ) ; for ( AbstractProject tup : getTransitiveUpstreamProjects ( ) ) { if ( tup != this && ( tup . isBuilding ( ) || unblockedTasks . contains ( tup ) ) ) return tup ; } return null ; }
Returns the project if any of the upstream project is either
building or is in the queue.
<p>
This means eventually there will be an automatic triggering of
the given project (provided that all builds went smoothly.)