How to use cumulusci - 10 common examples

To help you get started, we’ve selected a few cumulusci examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github SFDO-Tooling / CumulusCI / cumulusci / tasks / apex / testrunner.py View on Github external
self.options["json_output"] = self.options.get(
            "json_output", "test_results.json"
        )

        self.options["managed"] = process_bool_arg(self.options.get("managed", False))

        self.options["retry_failures"] = process_list_arg(
            self.options.get("retry_failures", [])
        )
        compiled_res = []
        for regex in self.options["retry_failures"]:
            try:
                compiled_res.append(re.compile(regex))
            except re.error as e:
                raise TaskOptionsError(
                    "An invalid regular expression ({}) was provided ({})".format(
                        regex, e
                    )
                )
        self.options["retry_failures"] = compiled_res
        self.options["retry_always"] = process_bool_arg(
            self.options.get("retry_always", False)
        )

        self.counts = {}
github SFDO-Tooling / CumulusCI / cumulusci / tasks / apex / testrunner.py View on Github external
def _get_namespace_filter(self):
        if self.options["managed"]:
            namespace = self.options.get("namespace")
            if not namespace:
                raise TaskOptionsError(
                    "Running tests in managed mode but no namespace available."
                )
            namespace = "'{}'".format(namespace)
        else:
            namespace = "null"
        return namespace
github SFDO-Tooling / CumulusCI / cumulusci / tasks / bulkdata.py View on Github external
def _init_options(self, kwargs):
        super(DeleteData, self)._init_options(kwargs)

        # Split and trim objects string into a list if not already a list
        if not isinstance(self.options["objects"], list):
            self.options["objects"] = [
                obj.strip() for obj in self.options["objects"].split(",")
            ]

        self.options["hardDelete"] = process_bool_arg(self.options.get("hardDelete"))
github SFDO-Tooling / CumulusCI / cumulusci / core / flows.py View on Github external
def _get_task(self, stepnum, step_config):
        task_config = copy.deepcopy(step_config["task_config"].config)
        task_config = TaskConfig(task_config)

        task_name = step_config["step_config"]["task"]

        if "options" not in task_config.config:
            task_config.config["options"] = {}
        task_config.config["options"].update(
            step_config["step_config"].get("options", {})
        )
        # If there were task option overrides passed in, merge them
        if task_name in self.task_options:
            task_config.config["options"].update(self.task_options[task_name])

        # Handle dynamic value lookups in the format ^^task_name.attr1.attr2
        for option, value in list(task_config.options.items()):
            if str(value).startswith("^^"):
                value_parts = value[2:].split(".")
github SFDO-Tooling / CumulusCI / cumulusci / tasks / apex / batch.py View on Github external
""" a task for waiting on a Batch Apex job to complete """

import datetime
from cumulusci.utils import parse_api_datetime
from cumulusci.tasks.salesforce import BaseSalesforceApiTask
from cumulusci.core.exceptions import SalesforceException

COMPLETED_STATUSES = ["Completed"]


class BatchApexWait(BaseSalesforceApiTask):
    """ BatchApexWait polls an org until the latest batch job
        for an apex class completes or fails """

    name = "BatchApexWait"
    batch = object()

    task_options = {
        "class_name": {
            "description": "Name of the Apex class to wait for.",
            "required": True,
        },
        "poll_interval": {
            "description": "Seconds to wait before polling for batch job completion. "
            "Defaults to 10 seconds."
        },
    }
github SFDO-Tooling / CumulusCI / cumulusci / tasks / salesforce / UninstallPackagedIncremental.py View on Github external
def _init_options(self, kwargs):
        super(UninstallPackagedIncremental, self)._init_options(kwargs)
        if "path" not in self.options:
            self.options["path"] = "src"
        self.options["purge_on_delete"] = process_bool_arg(
            self.options.get("purge_on_delete", True)
        )
        self.options["ignore"] = self.options.get("ignore") or {}
github SFDO-Tooling / CumulusCI / cumulusci / tasks / salesforce / Deploy.py View on Github external
def _process_meta_xml(self, zipf):
        if not process_bool_arg(self.options.get("clean_meta_xml", True)):
            return zipf

        self.logger.info(
            "Cleaning meta.xml files of packageVersion elements for deploy"
        )
        zipf = zip_clean_metaxml(zipf, logger=self.logger)
        return zipf
github SFDO-Tooling / CumulusCI / cumulusci / tasks / salesforce / Deploy.py View on Github external
self.logger.info(
                    "Replacing namespace tokens from metadata with namespace prefix {}__".format(
                        self.options["namespace_inject"]
                    )
                )
            else:
                self.logger.info(
                    "Stripping namespace tokens from metadata for unmanaged deployment"
                )
            zipf = process_text_in_zipfile(
                zipf,
                functools.partial(
                    inject_namespace,
                    namespace=self.options["namespace_inject"],
                    managed=managed,
                    namespaced_org=process_bool_arg(
                        self.options.get("namespaced_org", False)
                    ),
                    logger=self.logger,
                ),
            )
        if self.options.get("namespace_strip"):
            zipf = process_text_in_zipfile(
                zipf,
                functools.partial(
                    strip_namespace,
                    namespace=self.options["namespace_strip"],
                    logger=self.logger,
                ),
            )
        return zipf
github SFDO-Tooling / CumulusCI / cumulusci / tasks / salesforce.py View on Github external
def _init_options(self, kwargs):
        super(BaseUninstallMetadata, self)._init_options(kwargs)
        self.options['purge_on_delete'] = process_bool_arg(self.options.get(
            'purge_on_delete',
            True,
        ))
github SFDO-Tooling / CumulusCI / cumulusci / tasks / salesforce.py View on Github external
def _process_namespace(self, src_zip):
        if self.options.get('namespace_tokenize'):
            src_zip = zip_tokenize_namespace(src_zip, self.options['namespace_tokenize'], logger=self.logger)
        if self.options.get('namespace_inject'):
            kwargs = {}
            kwargs['unmanaged'] = process_bool_arg(self.options.get('unmanaged', True))
            kwargs['namespaced_org'] = process_bool_arg(self.options.get('namespaced_org', False))
            kwargs['logger'] = self.logger
            src_zip = zip_inject_namespace(src_zip, self.options['namespace_inject'], **kwargs)
        if self.options.get('namespace_strip'):
            src_zip = zip_strip_namespace(src_zip, self.options['namespace_strip'], logger=self.logger)
        return src_zip