def release_eq(release, config, env, volumes):
    """
    Given a release, see if its config, env, and volumes match those
    passed in.

    Note that this function does *not* check whether the app and version are
    the same.  You should do that in SQL to narrow the list of relevant
    releases before using this function to check the equality of the
    YAML-formatted fields.
    """
    r_config = release.config_yaml or {}
    if r_config != config:
        return False
    r_env = release.env_yaml or {}
    if r_env != env:
        return False
    r_volumes = release.volumes or []
    volumes = volumes or []
    if r_volumes != volumes:
        return False
    return True
