Skip to content

ProjectPipeline from .list(as_list=False) has fewer information than the one from .get(id) #1138

Closed
@MrMino

Description

@MrMino

Description of the problem, including code/CLI snippet

project = gl.projects.get('...')
all_pipelines = project.pipelines.list(as_list=False)
pipelines = itertools.islice(all_pipelines, search_limit)
print(pipelines[0].duration)

Expected Behavior

Duration of the pipeline is returned.

Actual Behavior

AttributeError is raised. Same happens with many other attributes. Only when using refresh() on a pipeline, the object has all of the expected information.

Objects fetched via project.pipelines.get(id) do not suffer from this problem.

KeyError                                  Traceback (most recent call last)
~/.virtualenvs/taf/lib/python3.7/site-packages/gitlab/base.py in __getattr__(self, name)
     55         try:
---> 56             return self.__dict__['_updated_attrs'][name]
     57         except KeyError:

KeyError: 'duration'

During handling of the above exception, another exception occurred:

KeyError                                  Traceback (most recent call last)
~/.virtualenvs/taf/lib/python3.7/site-packages/gitlab/base.py in __getattr__(self, name)
     58             try:
---> 59                 value = self.__dict__['_attrs'][name]
     60

KeyError: 'duration'

During handling of the above exception, another exception occurred:

KeyError                                  Traceback (most recent call last)
~/.virtualenvs/taf/lib/python3.7/site-packages/gitlab/base.py in __getattr__(self, name)
     78                 try:
---> 79                     return self.__dict__['_parent_attrs'][name]
     80                 except KeyError:

KeyError: 'duration'

During handling of the above exception, another exception occurred:

AttributeError                            Traceback (most recent call last)
<ipython-input-25-919ee3634190> in <module>
----> 1 gather_data(proj, 200, branch_name='master')

~/taf/taf.tools.pipeline_duration/app.py in gather_data(project, search_limit, branch_name, passed_only)
     40     return durations

~/.virtualenvs/taf/lib/python3.7/site-packages/gitlab/base.py in __getattr__(self, name)
     79                     return self.__dict__['_parent_attrs'][name]
     80                 except KeyError:
---> 81                     raise AttributeError(name)
     82
     83     def __setattr__(self, name, value):

AttributeError: duration

Specifications

  • python-gitlab version: 1.8.0
  • API version you are using (v3/v4): v4
  • Gitlab server version (or gitlab.com): 12.7.6

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions