def deploy()

in google_cloud_automlops/AutoMLOps.py [0:0]


def deploy(
    hide_warnings: Optional[bool] = True,
    precheck: Optional[bool] = False):
    """Builds and pushes the component_base image, compiles the pipeline, and submits a message to
    the queueing service to execute a PipelineJob. The specifics of the deploy step are dependent on
    the defaults set during the generate() step, particularly:
        - use_ci: if use_ci is False, the deploy step will use scripts/run_all.sh, which will submit
            the build job, compile the pipeline, and submit the PipelineJob all from the local machine.
        - artifact_repo_type: Determines which type of artifact repo the image is pushed to.
        - deployment_framework: Determines which build tool to use for building.
        - source_repo_type: Determines which source repo to use for versioning code and triggering
            the build.
    Defaults are stored in config/defaults.yaml.

    Args:
        hide_warnings: Boolean that specifies whether to show permissions warnings before deploying.
        precheck: Boolean that specifies whether to check if the infra exists before deploying.
    """
    defaults = read_yaml_file(GENERATED_DEFAULTS_FILE)
    use_ci = defaults['tooling']['use_ci']

    if precheck:
        if not hide_warnings:
            account_permissions_warning(operation='deploy_with_precheck', defaults=defaults)
        precheck_deployment_requirements(defaults)
    else:
        if not hide_warnings:
            account_permissions_warning(operation='deploy_without_precheck', defaults=defaults)

    # Build, compile, and submit pipeline job
    if use_ci:
        git_workflow()
    else:
        os.chdir(BASE_DIR)
        try:
            subprocess.run(['./scripts/run_all.sh'], shell=True,
                           check=True, stderr=subprocess.STDOUT)
        except subprocess.CalledProcessError as e:
            logging.info(e) # graceful error exit to allow for cd-ing back
        os.chdir('../')

    # Log generated resources
    resources_generation_manifest(defaults)