Esempio n. 1
0
def download_package(feed,
                     name,
                     version,
                     path,
                     file_filter=None,
                     organization=None,
                     detect=None):
    """Download a package.
    :param feed: Name or ID of the feed.
    :type feed: str
    :param name: Name of the package, e.g. 'foo-package'.
    :type name: str
    :param version: Version of the package, e.g. 1.0.0.
    :type version: str
    :param path: Directory to place the package contents.
    :type path: str
    :param file_filter: Wildcard filter for file download.
    :type file_filter: str
    """
    colorama.init()  # Needed for humanfriendly spinner to display correctly
    organization = resolve_instance(detect=detect, organization=organization)
    artifact_tool = ArtifactToolInvoker(ProgressReportingExternalToolInvoker(),
                                        ArtifactToolUpdater())
    return artifact_tool.download_universal(organization, feed, name, version,
                                            path, file_filter)
Esempio n. 2
0
def publish_package(feed,
                    name,
                    version,
                    path,
                    description=None,
                    organization=None,
                    detect=None):
    """Publish a package to a feed.
    :param feed: Name or ID of the feed.
    :type feed: str
    :param name: Name of the package, e.g. 'foo-package'.
    :type name: str
    :param version: Version of the package, e.g. '1.0.0'.
    :type version: str
    :param description: Description of the package.
    :type description: str
    :param path: Directory containing the package contents.
    :type path: str
    """
    colorama.init()  # Needed for humanfriendly spinner to display correctly
    organization = resolve_instance(detect=detect, organization=organization)
    artifact_tool = ArtifactToolInvoker(ProgressReportingExternalToolInvoker(),
                                        ArtifactToolUpdater())
    return artifact_tool.publish_universal(organization, feed, name, version,
                                           description, path)
Esempio n. 3
0
def run_artifact_upload(run_id, artifact_name, path, organization=None, project=None, detect=None):
    """ Upload a pipeline artifact.
    :param run_id: ID of the run that the artifact is associated to.
    :type run_id: int
    :param artifact_name: Name of the artifact to upload.
    :type artifact_name: string
    :param path: Path to upload the artifact from.
    :type path: string
    """
    organization, project = resolve_instance_and_project(detect=detect, organization=organization, project=project)
    artifact_tool = ArtifactToolInvoker(ProgressReportingExternalToolInvoker(), ArtifactToolUpdater())
    return artifact_tool.upload_pipeline_artifact(
        organization=organization, project=project, run_id=run_id, artifact_name=artifact_name, path=path)
Esempio n. 4
0
def download_package(feed,
                     name,
                     version,
                     path,
                     file_filter=None,
                     scope='organization',
                     organization=None,
                     project=None,
                     detect=None):
    """Download a package.
    :param scope: Scope of the feed: 'project' if the feed was created in a project, and 'organization' otherwise.
    :type scope: str
    :param feed: Name or ID of the feed.
    :type feed: str
    :param name: Name of the package, e.g. 'foo-package'.
    :type name: str
    :param version: Version of the package, e.g. 1.0.0.
    :type version: str
    :param path: Directory to place the package contents.
    :type path: str
    :param file_filter: Wildcard filter for file download.
    :type file_filter: str
    """
    colorama.init()  # Needed for humanfriendly spinner to display correctly

    if scope == 'project':
        organization, project = resolve_instance_and_project(
            detect=detect, organization=organization, project=project)
    else:
        if project is not None:
            raise CLIError(
                '--scope \'project\' is required when specifying a value in --project'
            )

        organization = resolve_instance(detect=detect,
                                        organization=organization)

    artifact_tool = ArtifactToolInvoker(ProgressReportingExternalToolInvoker(),
                                        ArtifactToolUpdater())
    return artifact_tool.download_universal(organization, project, feed, name,
                                            version, path, file_filter)