tasks/agent.py
def upload_integration_to_cache(ctx, python, bucket, branch, integrations_dir, build_dir, integration, awscli="aws"):
    """
    Upload a built integration wheel for given integration.
    python: Python version the integration is built for
    bucket: S3 bucket to upload the integration wheel to
    branch: namespace in the bucket to upload the integration wheels to
    integrations_dir: directory with Git repository of integrations
    build_dir: directory containing the built integration wheel
    integration: name of the integration being cached
    awscli: AWS CLI executable to call
    """
    matching_glob = os.path.join(build_dir, CACHED_WHEEL_FILENAME_PATTERN.format(integration=integration))
    files_matched = glob.glob(matching_glob)
    if len(files_matched) == 0:
        raise Exit(f"No wheel for integration {integration} found in {build_dir}")
    elif len(files_matched) > 1:
        raise Exit(f"More than 1 wheel for integration {integration} matched by {matching_glob}: {files_matched}")

    wheel_path = files_matched[0]

    last_commit = ctx.run(
        LAST_DIRECTORY_COMMIT_PATTERN.format(integrations_dir=integrations_dir, integration=integration),
        hide="both",
        echo=False,
    )
    hash = last_commit.stdout.strip()

    target_name = CACHED_WHEEL_DIRECTORY_PATTERN.format(
        hash=hash, python_version=python, branch=branch
    ) + os.path.basename(wheel_path)
    print(f"Caching wheel {target_name}")
    # NOTE: on Windows, the awscli is usually in program files, so we have the executable
    ctx.run(f"\"{awscli}\" s3 cp {wheel_path} s3://{bucket}/{target_name} --acl public-read")

    Upload a built integration wheel for given integration.
    python: Python version the integration is built for
    bucket: S3 bucket to upload the integration wheel to
    branch: namespace in the bucket to upload the integration wheels to
    integrations_dir: directory with Git repository of integrations
    build_dir: directory containing the built integration wheel
    integration: name of the integration being cached
    awscli: AWS CLI executable to call
    
Upload a built integration wheel for given integration.
Upload a built integration wheel for given integration .
def upload_integration_to_cache(ctx, python, bucket, branch, integrations_dir, build_dir, integration, awscli="aws"):
    matching_glob = os.path.join(build_dir, CACHED_WHEEL_FILENAME_PATTERN.format(integration=integration))
    files_matched = glob.glob(matching_glob)
    if len(files_matched) == 0:
        raise Exit(f"No wheel for integration {integration} found in {build_dir}")
    elif len(files_matched) > 1:
        raise Exit(f"More than 1 wheel for integration {integration} matched by {matching_glob}: {files_matched}")
    wheel_path = files_matched[0]
    last_commit = ctx.run(
        LAST_DIRECTORY_COMMIT_PATTERN.format(integrations_dir=integrations_dir, integration=integration),
        hide="both",
        echo=False,
    )
    hash = last_commit.stdout.strip()
    target_name = CACHED_WHEEL_DIRECTORY_PATTERN.format(
        hash=hash, python_version=python, branch=branch
    ) + os.path.basename(wheel_path)
    print(f"Caching wheel {target_name}")
    ctx.run(f"\"{awscli}\" s3 cp {wheel_path} s3://{bucket}/{target_name} --acl public-read")
def upload_integration_to_cache ( ctx , python , bucket , branch , integrations_dir , build_dir , integration , awscli = "aws" ) : matching_glob = os . path . join ( build_dir , CACHED_WHEEL_FILENAME_PATTERN . format ( integration = integration ) ) files_matched = glob . glob ( matching_glob ) if len ( files_matched ) == 0 : raise Exit ( f"No wheel for integration {integration} found in {build_dir}" ) elif len ( files_matched ) > 1 : raise Exit ( f"More than 1 wheel for integration {integration} matched by {matching_glob}: {files_matched}" ) wheel_path = files_matched [ 0 ] last_commit = ctx . run ( LAST_DIRECTORY_COMMIT_PATTERN . format ( integrations_dir = integrations_dir , integration = integration ) , hide = "both" , echo = False , ) hash = last_commit . stdout . strip ( ) target_name = CACHED_WHEEL_DIRECTORY_PATTERN . format ( hash = hash , python_version = python , branch = branch ) + os . path . basename ( wheel_path ) print ( f"Caching wheel {target_name}" ) ctx . run ( f"\"{awscli}\" s3 cp {wheel_path} s3://{bucket}/{target_name} --acl public-read" )
Upload a built integration wheel for given integration.
Upload a built integration wheel for given integration .
"""
    Upload a built integration wheel for given integration.
    python: Python version the integration is built for
    bucket: S3 bucket to upload the integration wheel to
    branch: namespace in the bucket to upload the integration wheels to
    integrations_dir: directory with Git repository of integrations
    build_dir: directory containing the built integration wheel
    integration: name of the integration being cached
    awscli: AWS CLI executable to call
    """ # NOTE: on Windows, the awscli is usually in program files, so we have the executable
ctx
python
bucket
branch
integrations_dir
build_dir
integration
awscli