ArtifactoryClient

ArtifactoryClient(params: dict)

params is a dictionary with following mandatory params:

Parameters:

  • url (str) –

    Artifactory host url

  • username (str) –

    User used in auth request

  • password (str) –

    Token used in auth request

get_artifact_properties

get_artifact_properties(path_to_artifact: str)

get_folder_files_list

get_folder_files_list(path_to_folder: str)

get_artifact_content_by_url

get_artifact_content_by_url(path_to_file: str)

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, **kwargs)

clone_repo_from_commit_hash

clone_repo_from_commit_hash(repo_path: str, commit_hash: str, temp_path: str)

commit_and_push

commit_and_push(commit_message: str)

commit

commit(commit_message: str)

push

push()

pull

pull(**kwargs)

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)

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, find_via_uuid: bool = False, uuid_param_name: str = DEFAULT_UUID_PARAM_NAME, uuid_artifact_name: str = DEFAULT_UUID_ARTIFACT_NAME, uuid_file_name: str = DEFAULT_UUID_FILE_NAME)

There's currently no reliable way to get ID of triggered workflow, without adding explicit ID as an input parameter to each workflow, dispatch is async and doesn't return anything This method supports two different ways to find and return started workflow: Unreliable - where we start looking for newly created runs of that workflow, filtering them as much as possible (might return wrong run in a concurrent scenario) Reliable: you need to add specific explicit ID param to the workflow you are triggering (e.g. 'workflow_run_uuid'), said workflow should have a step where it will save its input params, and then you run this method with 'find_via_uuid = True'

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)

get_workflow_run_input_params

get_workflow_run_input_params(execution: ExecutionInfo, artifact_name: str = DEFAULT_UUID_ARTIFACT_NAME, file_name: str = DEFAULT_UUID_FILE_NAME)

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)

MavenArtifactSearcher

MavenArtifactSearcher(registry_url: str, params: dict = None, **kwargs)

Allows searching for specific maven artifacts in different repositories without knowing full coordinates (e.g. knowing only artifact_id and version, but not its group_id)

Supports different Maven repository providers: Artifactory, Nexus, AWS, GCP

Start by initializing this client with one of implementations: maven_client = MavenArtifactSearcher(registry_url).with_artifactory(artifactory_user, artifactory_token)

Then find your artifacts using maven_client.find_artifact_urls('art_id', '1.0.0')

Additionally, perform filtering of returned results, and then download necessary artifacts with maven_client.download_artifact(one_of_the_returned_urls, './my_artifact.jar')

find_artifact_urls

find_artifact_urls(artifact_id: str = None, version: str = None, extension: str = 'jar', artifact: Artifact = None) -> list[str]

Finds and returns list of URLs (or resource IDs, for specific providers) to target artifacts. Client should be initialized with one of providers first. Doesn't require group_id to find artifacts. Works with either artifact_id/version or Artifact class as input parameters.

download_artifact

download_artifact(url: str, local_path: str)

Downloads maven artifact from url to a local_path location (you need to provide full path, including filename, since we can't determine it from resource urls for some providers). url should be one of values returned by find_artifact_urls. Client should be initialized with one of providers first.

with_artifactory

with_artifactory(username: str = None, password: str = None)

Initializes this client to work with JFrog Artifactory maven repositories. Requires username and its password or token.

with_nexus

with_nexus(username: str = None, password: str = None)

Initializes this client to work with Sonatype Nexus Repository for maven artifacts. Requires username and its password or token.

with_aws_code_artifact

with_aws_code_artifact(access_key: str, secret_key: str, domain: str, region_name: str, repository: str)

Initializes this client to work with AWS Code Artifact repository. Requires access_key and secret_key of a service account. Also requires domain, region_name and repository of used AWS instance.

with_gcp_artifact_registry

with_gcp_artifact_registry(credential_params: dict, project: str, region_name: str, repository: str)

Initializes this client to work with Google Cloud Artifact Registry repository. Supports different types of authorization in credential_params dict: - service_account_key key -> requires content of key-file (generate key-file for your service account first) - oidc_token_path and audience key -> path to text file ("/path/to/token/file.txt") with your OIDC token and your required audience. Audience should be "//iam.googleapis.com/projects/PROJECT_NUMBER/locations/global/workloadIdentityPools/POOL_ID/providers/PROVIDER_ID"

Also requires project, region_name and repository of used GCP instance.


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