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_history property on orgs -> scratch -> <org_name> to enable history tracking. No history tracking is recorded on any orgs by default
New Pydantic models for OrgHistory and OrgAction with base classes and implementations for a common set of actions against orgs:
OrgCreate
OrgConnect
OrgDelete
OrgImport
Task
Flow
If track_history is enabled for the org, recording of each action with full hashed details are stored in org_config.history.actions
New cci history command group with subcommands:
list: List and filter actions for a given org for display or json
info <action_hash>: Get the details for an action for display or json
clear: Select and filter specific actions from the org's history
enable|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 contents
ActionScratchDefReference: Extension of ActionFileReference that adds parsing the json into a Python dict in the scratchdef field and using that for the hash, reducing risk of whitespace and other formatting differences impacting the hash
ActionDirectoryReference: Path and hash of all recursive contents
ActionMetadataDeployment: Path and hash of the metadata that was deployed. Stub for future optimization of hashing
ActionCommandExecution: Any external command executed with command, return_code, output, and stderr
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 inreturn_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...
track_history
property onorgs -> scratch -> <org_name>
to enable history tracking. No history tracking is recorded on any orgs by defaultOrgHistory
andOrgAction
with base classes and implementations for a common set of actions against orgs:track_history
is enabled for the org, recording of each action with full hashed details are stored inorg_config.history.actions
cci history
command 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 orgI 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 ofActionFileReference
that adds parsing the json into a Python dict in thescratchdef
field 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