Skip to content

m_blueprints

write_blueprints(m_dir, *, m_tag, cache_from_pr, update_makefile=False, update_workflow=False)

Write a file with the M environment variables.

Parameters:

Name Type Description Default
m_dir str

The directory with the m configuration.

required
m_tag str

The unique identifier for the build.

required
cache_from_pr str

The pr number to attempt to pull cache from.

required
update_makefile bool

If true, updates the Makefile.

False
update_workflow bool

If true, updates the github workflow.

False

Returns:

Type Description
Res[None]

An issue or the m environment instance.

Source code in m/ci/m_blueprints.py
def write_blueprints(
    m_dir: str,
    *,
    m_tag: str,
    cache_from_pr: str,
    update_makefile: bool = False,
    update_workflow: bool = False,
) -> Res[None]:
    """Write a file with the M environment variables.

    Args:
        m_dir: The directory with the m configuration.
        m_tag: The unique identifier for the build.
        cache_from_pr: The pr number to attempt to pull cache from.
        update_makefile: If true, updates the `Makefile`.
        update_workflow: If true, updates the github workflow.

    Returns:
        An issue or the m environment instance.
    """
    blueprints_dir = Path(f'{m_dir}/.m/blueprints')
    if not blueprints_dir.exists():
        Path(f'{m_dir}/.m/blueprints/local').mkdir(parents=True)
        Path(f'{m_dir}/.m/blueprints/ci').mkdir(parents=True)
    return one_of(lambda: [
        None
        for config in read_config(m_dir)
        for _ in _write_blueprints(
            config,
            m_tag=m_tag,
            cache_from_pr=cache_from_pr,
            update_makefile=update_makefile,
            update_workflow=update_workflow,
        )
    ])