def METHOD_NAME(self) -> tuple[str, ...]:
    """Return all base image tags, prefix with the stage alias or index.
    In case the base image is entirely made up of a build arg, use that with a `build-arg:`
    prefix.
    Example:
        FROM base:1.0 AS build
        ...
        FROM interim
        FROM $argname as dynamic
        ...
        FROM final as out
    Gives:
        build 1.0
        stage1 latest
        dynamic build-arg:argname
        out latest
    """
    def _get_tag(image_ref: str) -> str | None:
        """The image ref is in the form `registry/repo/name[/...][:tag][@digest]` and where
        `digest` is `sha256:hex value`, or a build arg reference with $ARG."""
        if image_ref.startswith("$"):
            build_arg = self._get_image_ref_build_arg(image_ref)
            if build_arg:
                return f"build-arg:{build_arg}"
        parsed = re.match(_image_ref_regexp, image_ref)
        if not parsed:
            return None
        tag = parsed.group("tag")
        if tag:
            return tag
        if not parsed.group("digest"):
            return "latest"
        return None
    return tuple(
        f"{stage} {tag}"
        for stage, name_parts in self.from_baseimages()
        for tag in [_get_tag(name_parts[-1])]
        if tag
    )