File: artifact_manager.py

package info (click to toggle)
azure-functions-devops-build 0.0.22-6
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 556 kB
  • sloc: python: 2,422; sh: 12; makefile: 8
file content (27 lines) | stat: -rw-r--r-- 1,157 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------

from ..base.base_manager import BaseManager
from vsts.exceptions import VstsClientRequestError

class ArtifactManager(BaseManager):
    """ Manage DevOps Artifacts

    Attributes:
        See BaseManager
    """

    def __init__(self, organization_name="", project_name="", creds=None):
        """Inits ArtifactManager as per BaseManager and includes relevant clients"""
        super(ArtifactManager, self).__init__(creds, organization_name=organization_name, project_name=project_name)

    def list_artifacts(self, build_id):
        """Lists artifacts from a build"""
        project = self._get_project_by_name(self._project_name)
        try:
            result = self._build_client.get_artifacts(build_id, project.id)
        except VstsClientRequestError:
            return []
        return result