Skip to main content
Version: 10 - TBD

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 using the "files_path" argument.

metadata: Only get the metadata of the specified reference.

Input Schema

  • repository_url

    The remote URL of the repository. The url can contain HTTP basic auth credentials.

    Type: string

  • username

    The username to be used for authentication. Can be None. Alternatively, SSH keys can be used.

    Type: anyOf

  • password

    The password to be used for authentication. Can be None. Alternatively, SSH keys can be used.

    Type: anyOf

  • ssh_key

    The content of the ssh private keyfile associated with the repository, currently only works with non-password protected keyfiles and PEM format.

    Type: anyOf

  • ssh_hostkey

    The 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.

    Type: anyOf

  • httpCookie

    Authentication for some git repositories is possible via http cookie.

    Type: anyOf

  • command

    The command to execute.

    Type: anyOf

  • files_path

    Save the files of the repository in Cloudomation Engine, 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 content of the files will be returned in the files output.

    Type: anyOf

  • ref

    A commit reference, e.g. the commit you want to get. Can be a branch, tag, or git commit SHA.

    Type: string

    Default: develop

Output Schema

  • status_code

    The status code returned by the git command

    Type: integer

  • output

    The stdout of the last git command.

    Type: string

  • error

    The stderr of the last git command.

    Type: string

  • files

    The files which were fetched.

    Type: array

  • author_name

    The name of the author of the specified reference.

    Type: string

  • author_email

    The email of the author of the specified reference.

    Type: string

  • date

    The date and time of the commit as POSIX timestamp.

    Type: integer

  • date_str

    The date and time in iso8601 date and time, with zone info.

    Type: string

  • commit_message

    The commit message of the reference.

    Type: string

  • commit_sha

    The SHA of the commit.

    Type: string

  • short_sha

    The short SHA of the commit.

    Type: string

Constants

ssl_context_inputs = ['check_hostname', 'client_cert', 'client_key', 'server_ca']

Example

import flow_api

def handler(system: flow_api.System, this: flow_api.Execution, inputs: dict):
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 Engine:
for file_ in system.files(
filter_={
'field': 'name',
'op': 'like',
'value': 'path/to/files/%',
},
):
this.log(file_)
return this.success('all done')