Git Integration
Using the git integration it is possible to synchronize the content of a git repository with Cloudomation.
Use Cases
Generally it is recommended to store all your Cloudomation resources in git. There are plenty of benefits:
- Use of your favourite offline editor
- Version history of all changes to your automation logic
- Collaboration between users easily possible
- An additional backup of your automation logic
- Branching, merging, rollback, ...
Concept
The git integration currently operates read-only. Meaning, no changes are made to the repository by Cloudomation.
When a user manually modifies a resource which is synced to Cloudomation via the git integration, the changes will be overwritten with the next synchronization interval.
Flows, schedulers, settings, and files can be imported directly into the flow, scheduler, setting, and file resource. All other resource types can be imported using a Cloudomation export yaml.
Configuration
Please see the table below for the different git_config fields and their meanings:
Field | Description | Example |
---|---|---|
Remote URL | The URL to the git repository. Supports HTTPS and SSH protocols. | ssh://git@example.com/path/to/repo.git or https://example.com/path/to/repo.git |
Enabled | If unset, Cloudomation will not sync anything | |
Priority | When using multiple git_configs the one with the lower priority will win when there are conflicts | 10 |
Git ref | The git ref to sync. Can be a branch name, a tag, or a commit SHA | develop |
Username | When using a HTTPS remote URL this username will be used for basic auth | |
Password | When using a HTTPS remote URL this password will be used for basic auth | |
SSH key | When using a SSH remote URL this key will be used to authenticate. Must be in PEM format. | -----BEGIN RSA PRIVATE KEY-----... |
SSH hostkey | When using a SSH remote URL this will be used to verify the identity of the remote | example.com ssh-rsa AA... |
Path mapping | A mapping of record types to globs. All files in the repo matching a glob will be loaded to the specified record type. | See [Path mapping] |
Path mapping
The path mapping spcifies which files from the repository are loaded to which resource types.
flow:- flows/*.pyfile:- templates/**/*- script.shimport:- resources/*.yaml
The example above will
- Load all
*.py
files in theflows
folder to the flow resource.The file extension `.py` is removed from the resource name - Load all files in any folder below
templates
into the file resource - Load
script.sh
into the file resource - Import all
*.yaml
files in theresources
folder
Please refer to Import / Export for details on export YAML files.
Metadata docstring block in flows
Cloudomation will parse the content of files which are loaded to the flows resource to detect additional attributes.
All additional attributes can be specified in the docstring. Two formats are recognized:
"""The content of this docstring is used for the "description" field of the flow"""""" # Cloudomation metadata:project_id_project:name: my-project"""import flow_apidef handler(system: flow_api.System, this: flow_api.Execution):return this.success('all done')
The parsing is done line-by-line. The first non-empty line which is not a docstring will stop the parsing.
A normal docstring will be used in the description
field of the flow.
A docstring which is started by the line """ # Cloudomation metadata:
will be parsed as a YAML
document and can specify all fields of the flow & related resources similar to the export
file format.