GitClient

GitClient(host: str, username: str, password: str, email: str = None)

Parameters:

  • host (str) –

    Git instance URL

  • username (str) –

    User used in auth request

  • password (str) –

    Token used in auth request

  • email (str, default: None ) –

    Email used when committing changes using client

clone

clone(repo_path: str, branch: str, temp_path: str)

commit_and_push

commit_and_push(commit_message: str)

get_file_content_utf8

get_file_content_utf8(relative_path: str)

set_file_content_utf8

set_file_content_utf8(relative_path: str, content: str)

delete_by_path

delete_by_path(relative_path: str)

GitlabClient

GitlabClient(host: str, username: str, password: str, email: str = None, **kwargs)

Parameters:

  • host (str) –

    Gitlab instance URL

  • username (str) –

    User used in auth request, might be empty string if no auth is required

  • password (str) –

    Token used in auth request

  • email (str, default: None ) –

    Email used when committing changes using API

  • **kwargs (Any, default: {} ) –

    will be passed into Gitlab API constructor

get_file_content

get_file_content(project_id: str, ref: str, file_path: str)

create_file

create_file(project_id: str, file_path: str, content: str, ref: str, commit_message: str)

update_file

update_file(project_id: str, file_path: str, content: str, ref: str, commit_message: str, create_if_not_exists: bool = False)

delete_file

delete_file(project_id: str, file_path: str, ref: str, commit_message: str)

get_latest_commit_id

get_latest_commit_id(project_id: str, ref: str)

get_file_commit_info

get_file_commit_info(project_id: str, ref: str, file_path: str)

Returns dict with 'commit_id' and 'last_commit_id' from Gitlab API

trigger_pipeline

trigger_pipeline(project_id: str, pipeline_params: dict)

cancel_pipeline_execution

cancel_pipeline_execution(execution: ExecutionInfo, timeout: float = 1.0)

get_pipeline_status

get_pipeline_status(execution: ExecutionInfo)

wait_pipeline_execution

wait_pipeline_execution(execution: ExecutionInfo, timeout_seconds: float = 10.0, break_status_list: list = None, wait_seconds: float = 1.0)

get_repo_branch_path staticmethod

get_repo_branch_path(url: str, branch: str = 'main')

Extracts 'repo', 'branch' and 'path' parts from possible Gitlab URLs. Needs to know branch beforehand


JenkinsClient

JenkinsClient(host: str, user: str, password: str)

Parameters:

  • host (str) –

    Jenkins host URL

  • user (str) –

    User used in auth request

  • password (str) –

    Token used in auth request

run_pipeline

run_pipeline(job_name: str, job_params: dict, timeout_seconds: float = 180.0, wait_seconds: float = 1.0)

get_pipeline_execution_status

get_pipeline_execution_status(execution: ExecutionInfo, timeout_seconds: float = 30.0, wait_seconds: float = 1.0)

wait_pipeline_execution

wait_pipeline_execution(execution: ExecutionInfo, timeout_seconds: float, wait_seconds: float = 1.0)

cancel_pipeline_execution

cancel_pipeline_execution(execution: ExecutionInfo, timeout_seconds: float = 30.0, wait_seconds: float = 1.0)

get_pipeline_execution_artifacts

get_pipeline_execution_artifacts(execution: ExecutionInfo, timeout_seconds: float = 30.0, wait_seconds: float = 1.0)

Returns list of artifact relative paths

save_pipeline_execution_artifact_to_file

save_pipeline_execution_artifact_to_file(execution: ExecutionInfo, artifact_path: str, file_path: str)

KubeClient

KubeClient(endpoint: str = None, token: str = None, kubeconfig_path: str = None)

Needs either of endpoint and token or kubeconfig_path

Parameters:

  • endpoint (str, default: None ) –

    Kubernetes API server URL

  • token (str, default: None ) –

    Token used for cluster access

  • kubeconfig_path (str, default: None ) –

    Path to local .kubeconfig file

list_namespaces

list_namespaces()

namespace_exists

namespace_exists(namespace: str)

deployments_exist

deployments_exist(namespace: str)

is_namespace_scaled_to_zero

is_namespace_scaled_to_zero(namespace: str)

list_not_ready_resources

list_not_ready_resources(namespace)

create_namespace

create_namespace(namespace: str)

delete_namespaces

delete_namespaces(namespaces: list[str], ignore_not_found: bool = False)

list_config_map_names

list_config_map_names(namespace: str)

read_config_map

read_config_map(namespace: str, config_map_name: str)

create_config_map

create_config_map(namespace: str, config_map_name: str, config_map_data: dict)

patch_config_map

patch_config_map(namespace: str, config_map_name: str, config_map_data: dict)

Patching allows adding/removing only specified keys in config map. Removes key-value pair when value is None

replace_config_map

replace_config_map(namespace: str, config_map_name: str, config_map_data: dict)

Replaces all data inside existing config map with value of 'config_map_data' argument

create_or_replace_config_map

create_or_replace_config_map(namespace: str, config_map_name: str, config_map_data: dict)

Creates map if it doesn't exist, replaces it otherwise

delete_config_map

delete_config_map(namespace: str, config_map_name: str)

scale_namespace

scale_namespace(namespace: str, scale_mode: ScaleMode, use_config_map: bool = True, replicas: int = 0)

scale_namespace_down

scale_namespace_down(namespace: str)

scale_namespace_up

scale_namespace_up(namespace: str, use_config_map: bool, replicas: int = 0)

MinioClient

MinioClient(endpoint: str, access_key: str, secret_key: str, secure: bool = True, cert_check: bool = True)

Parameters:

  • endpoint (str) –

    MiniO host URL

  • access_key (str) –

    Access key used in auth request

  • secret_key (str) –

    Secret key used in auth request

  • secure (bool, default: True ) –

    Which protocol to use (in case it's not present in endpoint)

  • cert_check (bool, default: True ) –

    Whether to verify certificate

list_objects

list_objects(bucket_name: str, path: str = None)

No leading slash in path - newer versions of MiniO don't support it, Trailing slash in path must be present

e.g. don't do this: path="/folder1/folder2"

do this: path="folder/folder2/"

get_folder_names

get_folder_names(bucket_name: str, path: str = None)

get_file_names

get_file_names(bucket_name: str, path: str = None)

get_last_modified_file

get_last_modified_file(bucket_name: str, path: str = None)

get_last_modified_text_file_content

get_last_modified_text_file_content(bucket_name: str, path: str = None)

get_file

get_file(bucket_name: str, file_path: str, local_path: str)

put_file

put_file(bucket_name: str, path: str, local_path: str)

get_text_file_content

get_text_file_content(bucket_name: str, file_path: str)

WebexClient

WebexClient(bot_token: str, proxies: dict = None)

proxies dict for different protocols is passed to requests session. e.g. proxies = { 'https' : 'https://user:password@ip:port' }

Parameters:

  • bot_token (str) –

    bot's auth token

  • proxies (dict, default: None ) –

    dict with proxy connections for different protocols

send_message

send_message(room_id: str, msg: str = None, attachment_path: str = None, parent_id: str = None, to_person_id: str = None, to_person_email: str = None, markdown: str = None, **request_parameters)

Post a message to a room.

Parameters:

  • room_id(str)

    The room ID.

  • to_person_id(str)

    The ID of the recipient when sending a private 1:1 message.

  • to_person_email(str)

    The email address of the recipient when sending a private 1:1 message.

  • msg(str)

    The message, in plain text. If markdown is specified this parameter may be optionally used to provide alternate text for UI clients that do not support rich text.

  • markdown(str)

    The message, in Markdown format.

  • attachment_path(str)

    Path to file that will be attached to a message

  • parent_id(str)

    The parent message to reply to. This will start or reply to a thread.

  • **request_parameters

    Additional request parameters (provides support for parameters that may be added in the future).


GithubClient

GithubClient(token: str = None, api_url: str = None, **kwargs)

Parameters:

  • token (str, default: None ) –

    Token used in auth request

  • api_url (str, default: None ) –

    Optional Github Enterprise API URL, leave empty if using github.com

  • **kwargs (Any, default: {} ) –

    will be passed into Github API constructor

trigger_workflow

trigger_workflow(owner: str, repo_name: str, workflow_file_name: str, branch: str, pipeline_params: dict, timeout_seconds: float = 30.0, wait_seconds: float = 3.0)

There's currently no reliable way to get ID of triggered workflow, dispatch is async and doesn't return anything As a workaround - we start looking for newly created runs of that workflow, filtering them as much as possible

get_workflow_run_status

get_workflow_run_status(execution: ExecutionInfo)

wait_workflow_run_execution

wait_workflow_run_execution(execution: ExecutionInfo, timeout_seconds: float = 60.0, break_status_list: list = None, wait_seconds: float = 10.0)

cancel_workflow_run_execution

cancel_workflow_run_execution(execution: ExecutionInfo, timeout: float = 1.0)

download_workflow_run_artifacts

download_workflow_run_artifacts(execution: ExecutionInfo, local_dir: str)