def get_git_sha_from_dockerurl(docker_url: str, long: bool = False) -> str:
    """ We encode the sha of the code that built a docker image *in* the docker
    url. This function takes that url as input and outputs the sha.
    """
    parts = docker_url.split("/")
    parts = parts[-1].split("-")
    sha = parts[-1]
    return sha if long else sha[:8]