def pull_container_needed(ctx):
    """Returns whether or not pulling a container is needed.

    Args:
      ctx: the Bazel context object.

    Returns:
        Returns true if its necesary to pull a container to generate configs.
    """

    # We don't pull a container if we have found a config_version to use
    # and there was no tag and no request to detect java home
    if ctx.attr.config_version and not ctx.attr.detect_java_home and not ctx.attr.tag:
        return False

    # No need to pull if no cc configs or custom repos were requested and
    # java_home is set
    if not ctx.attr.create_cc_configs and ctx.attr.java_home and not ctx.attr.config_repos:
        return False
    return True