Skip to main content
Version: 6 - Palatschinke

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 account. To synchronise flow scripts and settings from git into your Cloudomation 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 using the "files_path" argument.

metadata: Only get the metadata of the specified reference.

Inputs

NameTypeDefaultDescription
commandstrThe command you want to execute. Supports "get" and "metadata"
files_pathstrNoneSave the files of the repository in cloudomation, this is the target directory. In the case of a get command, the contents of the remote repository will be stored here. If not specified or None the output files will exist.
httpCookiestrNoneAuthentication for some private git repositories is possible via http cookie
passwordstrNoneThe password to be used for authentication. Can be None. Alternatively, SSH keys can be used.
refstrdevelopA commit reference, e.g. the commit you want to get. Can be a branch, tag, or git commit SHA
repository_urlstrThe remote URL of the repository. The url can contain HTTP basic auth credentials
ssh_hostkeystrNoneThe content of the ssh known hosts file, formatted as [host] [type] [key] - or [type] [key], a [comment] may be present after the [key]. Can be False to disable host key checking
ssh_keystrNoneThe content of the ssh private keyfile associated with the repository, currently only works with non-password protected keyfiles and PEM format
usernamestrNoneThe username to be used for authentication. Can be None. Alternatively, SSH keys can be used.

Outputs

NameTypeDefaultDescription
author_emailstrThe email of the commiter of the specified reference
author_namestrThe name of the commiter of the specified reference
commit_messagestrThe commit message of the reference
commit_shastrThe sha of the commit
datefloatThe date and time of the commit as POSIX timestamp
date_strstrThe date and time in iso8601 date and time, with zone info
errorstrThe stderr of the last successful git command
execution_idintThe ID of the connection execution
fileslistA list of dictionaries with two keys: name and content
messagestrThe ended message for the connection. If the connection ended with an error, the message will contain information about what went wrong
outputstrThe stdout of the last successful git command
short_shastrThe short sha of the commit
statusstrThe ended status for the connection. Either "success" or "error".
status_codeintThe status code returned by the git command

Constants

input_list = ['command', 'files_path', 'httpCookie', 'password', 'ref', 'repository_url', 'ssh_hostkey', 'ssh_key', 'username'] output_list = ['author_email', 'author_name', 'commit_message', 'commit_sha', 'date', 'date_str', 'error', 'files', 'output', 'short_sha', 'status_code'] ssl_context_inputs = ['check_hostname', 'client_cert', 'client_key', 'server_ca'] version = 1

Methods

Example

import flow_api

def handler(system: flow_api.System, this: flow_api.Execution):
child_execution = this.connect(
connector_type='GIT',
command='get',
# The url to a public 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',
command='get',
repository_url='https://example.com/path/to/repo.git',
files_path='path/to/files',
ref='develop',
)
outputs = child_execution2.get('output_value')
# Here there are no files in the output
this.log(outputs)
# But they are saved to cloudomation:
for file_ in system.files(
filter_={
'field': 'name',
'op': 'like',
'value': 'path/to/files/%',
},
):
this.log(file_)
return this.success('all done')