We have a number of "in_container" scripts written in Bash, They are doing a number of houseekeeping stuff but since we already have Python 3.7+ inside the CI image, we could modularise them more and make them run from external and simplify entrypoint_ci (for example separate script for tests).
use_airflow_version: str,
    use_packages_from_dist: bool,
) -> InstallationSpec:
    if use_packages_from_dist:
        console.print("[bright_blue]Using packages from dist folder")
    else:
        console.print("[bright_blue]Not using packages from dist folder - only install from remote sources")
    if use_packages_from_dist and package_format not in ["wheel", "sdist"]:
        console.print(f"[red]PACKAGE_FORMAT must be one of 'wheel' or 'sdist' and not {package_format}")
        sys.exit(1)
    extension = "whl" if package_format == "wheel" else "tar.gz"
    if airflow_extras:
        console.print(f"[bright_blue]Using airflow extras: {airflow_extras}")
        airflow_extras = f"[{airflow_extras}]"
    else:
        console.print("[bright_blue]No airflow extras specified.")
    if use_airflow_version and (AIRFLOW_SOURCE_DIR / "airflow").exists():
        console.print(
            f"[red]The airflow source folder exists in {AIRFLOW_SOURCE_DIR}, but you are "
            f"removing it and installing airflow from {use_airflow_version}."
        )
        console.print("[red]This is not supported. Please use --mount-sources=remove flag in breeze.")
        sys.exit(1)
    if use_airflow_version in ["wheel", "sdist"] and use_packages_from_dist:
        airflow_package_spec = find_airflow_package(extension)
        if use_airflow_version != package_format:
            console.print(
                "[red]USE_AIRFLOW_VERSION must be the same as PACKAGE_FORMAT cannot have "
                "wheel and sdist values set at the same time"
            )