CumulusCI
CumulusCI copied to clipboard
Track actions taken against orgs
This pull request introduces a new framework for tracking individual org related actions. The goal is to provide both better observability and auditability to the dynamic decisions made by CumulusCI and hopefully to be able to replay all actions run against the previous scratch org on refresh.
I first realized the need for this while working on the OrgSnapshots functionality I'm building. I needed to know the resolved dependencies from the flow run by a previous GitHub Actions step. CumulusCI currently doesn't store that info anywhere. Also, update_dependencies doesn't store the resolved dependencies in return_values, which is also included in this branch :)
I'll be working on docs and test cases as well as using and improving this framework before bringing the PR out of draft.
For now...
- New
track_historyproperty onorgs -> scratch -> <org_name>to enable history tracking. No history tracking is recorded on any orgs by default - New Pydantic models for
OrgHistoryandOrgActionwith base classes and implementations for a common set of actions against orgs:- OrgCreate
- OrgConnect
- OrgDelete
- OrgImport
- Task
- Flow
- If
track_historyis enabled for the org, recording of each action with full hashed details are stored inorg_config.history.actions - New
cci historycommand group with subcommands:list: List and filter actions for a given org for display or jsoninfo <action_hash>: Get the details for an action for display or jsonclear: Select and filter specific actions from the org's historyenable|disable: Enable/disable tracking on the org
I also need to go through all the built in task classes and make sure they're recording their actions:
ActionFileReference: Path and hash of file contentsActionScratchDefReference: Extension ofActionFileReferencethat adds parsing the json into a Python dict in thescratchdeffield and using that for the hash, reducing risk of whitespace and other formatting differences impacting the hashActionDirectoryReference: Path and hash of all recursive contentsActionMetadataDeployment: Path and hash of the metadata that was deployed. Stub for future optimization of hashingActionCommandExecution: Any external command executed withcommand,return_code,output, andstderr