code: public static AbstractBuild<?, ?> getRootBuild(AbstractBuild<?, ?> currentBuild) {
          AbstractBuild<?, ?> rootBuild = null;
          AbstractBuild<?, ?> parentBuild = getUpstreamBuild(currentBuild);
          while (parentBuild != null) {
              if (isPassIdentifiedDownstream(parentBuild)) {
                  rootBuild = parentBuild;
              }
              parentBuild = getUpstreamBuild(parentBuild);
          }
          if (rootBuild == null && isPassIdentifiedDownstream(currentBuild)) {
              return currentBuild;
          }
          return rootBuild;
      }
docs: Get the root build which triggered the current build. The build root is considered to be the one furthest one
  away from the current build which has the isPassIdentifiedDownstream active, if no parent build exists, check
  that the current build needs an upstream identifier, if it does return it.
  
  @param currentBuild The current build.
  @return The root build with isPassIdentifiedDownstream active. Null if no upstream or non is found.