public static Optional<String> finishUpdateCheck(Future<Optional<String>> updateMessageFuture) {
    if (updateMessageFuture.isDone()) {
      try {
        return updateMessageFuture.get();
      } catch (InterruptedException | ExecutionException ex) {
        // No need to restore the interrupted status. The intention here is to silently consume any
        // kind of error
      }
    }
    updateMessageFuture.cancel(true);
    return Optional.empty();
  }
Returns the latest Jib version available if the check succeeded and the current version is
outdated, or returns {@code Optional.empty()} if the check was interrupted or did not determine
that a later version was available.

@param updateMessageFuture the {@link Future} returned by {@link UpdateChecker#checkForUpdate}
@return the latest version, if found, else {@code Optional.empty()}.
jib-plugins-common/src/main/java/com/google/cloud/tools/jib/plugins/common/UpdateChecker.java