ConnectorTypeGIT
class connector_types.connector_type_git.ConnectorTypeGIT
Run git commands on a repository.
Note that the git connector type allows you to interact with your git repository, but does not automatically synchronise the flow scripts in your git repository with your Cloudomation Engine account. To synchronise flow scripts and settings from git into your Cloudomation Engine account, use the Git Integration.
Two commands are available:
- get
- metadata
get: fetch the specified reference and return the files. The files can either be returned in the outputs of the connection or placed in Cloudomation Engine.
metadata: get the metadata of the specified reference.
Input Schema
-
schema_versionType:
string -
authenticationType:
anyOfOptions: -
repository_urlThe remote URL of the repository. Should be in the format git@<host>:<path>/<repo>.git or https://<host>/<path>/<repo>.git.
Type:
string -
modeType:
anyOfOptions:
Output Schema
-
filesThe files which were fetched.
Type:
arrayItems: -
author_nameThe name of the author of the specified reference.
Type:
string -
author_emailThe email of the author of the specified reference.
Type:
string -
commit_date_isoThe date and time in iso8601 date and time, with zone info.
Type:
string -
commit_date_unixThe date and time in POSIX timestamp.
Type:
integer -
commit_messageThe commit message of the reference.
Type:
string -
commit_shaThe SHA of the commit.
Type:
string -
short_shaThe short SHA of the commit.
Type:
string
Example
import flow_api
def handler(system: flow_api.System, this: flow_api.Execution, inputs: dict):
child_execution = this.connect(
connector_type='GIT',
mode={
'mode_name': 'get_files',
'ref': 'develop',
'files_filter': '*',
'destination': {
'destination_type': 'output_value',
},
},
# The url to a repository
repository_url='https://example.com/path/to/repo.git',
# Get the reference develop, I could also specify a sha, another branch or a tag
ref='develop',
)
outputs = child_execution.get('output_value')
# Note that both the name and content of every file is part of the output
this.log(outputs)
child_execution2 = this.connect(
connector_type='GIT',
mode={
'mode_name': 'get_files',
'ref': 'develop',
'files_filter': '*',
'destination': {
'destination_type': 'file',
'file_prefix': 'repo_files_',
'destination_location': {
'location_mode': 'project',
'project_id': '...',
},
},
},
repository_url='https://example.com/path/to/repo.git',
)
)
outputs = child_execution2.get('output_value')
# Here there are no files in the output
this.log(outputs)
# But they are saved to Cloudomation Engine:
for file_ in system.files(
filter_={
'field': 'name',
'op': 'like',
'value': 'repo_files_%',
},
):
this.log(file_)
return this.success('all done')
Get metadata of a commit
import flow_api
def handler(system: flow_api.System, this: flow_api.Execution, inputs: dict):
commit_metadata = this.connect(
connector_type='GIT',
mode={
'mode_name': 'get_metadata',
'ref': 'develop',
},
).get('output_value')
this.log(commit_metadata=commit_metadata)
return this.success('all done')