Skip to content

list_pipelines not returning the full list #257

Closed
@JerryValentine

Description

@JerryValentine

Hi,

I am creating a script that will automatically create repositories and set up all of the governance for me, but I have run into a problem. One of the things that I want is to have a build policy on both the develop and master branches of my repository. In order to do this I need to get the pipeline's id. When I create a new repository I then run the code below to add the yml pipeline file and add the develop branch and then try to get the pipelines id from that.

My problem is every time I try to run list_pipelines sometimes it will provide the list including the pipeline that was just made and other times it does not and no mater how many times I call it.

I have found no way to constantly get this problem to happen, but it seems like the more repositories in a project the more likely it is to happen.

`azurePipelineFile = git_client.get_item(repository_id='ado-template-repository',path='/azure-pipelines.yml',project="CloudServices",scope_path=None,recursion_level=None,include_content_metadata=None,latest_processed_change=None,download=False,version_descriptor=None,include_content=True,resolve_lfs=None)
bumpversionFile = git_client.get_item(repository_id='ado-template-repository',path='/.bumpversion.cfg',project="CloudServices",scope_path=None,recursion_level=None,include_content_metadata=None,latest_processed_change=None,download=False,version_descriptor=None,include_content=True,resolve_lfs=None)

refUpdateMaster = GitRefUpdate(is_locked=None, name="refs/heads/master",new_object_id=None,old_object_id="0000000000000000000000000000000000000000")
refUpdateDevelop = GitRefUpdate(is_locked=None, name="refs/heads/develop",new_object_id=None,old_object_id="0000000000000000000000000000000000000000")
commit = GitCommitRef(_links=None,author=None,change_counts=None,changes=[
{
"changeType": "add",
"item": {
"path": "/azure-pipelines.yml"
},
"newContent": {
"content": azurePipelineFile.content,
"contentType": "rawtext"
}
},
{
"changeType": "add",
"item": {
"path": "/.bumpversion.cfg"
},
"newContent": {
"content": bumpversionFile.content,
"contentType": "rawtext"
}
}
],comment="Initial commit",comment_truncated=None,commit_id=None,committer=None,parents=None,push=None,remote_url=None,statuses=None,url=None,work_items=None)

Push the files to the master branch

push = GitPush(_links=None, date=None, push_correlation_id=None, pushed_by=None, push_id=None, url=None, commits=[commit], ref_updates=[refUpdateMaster], repository=None)
git_client.create_push(push=push,repository_id=newRepo.id,project=projectName)

Push the files to the develop branch

push = GitPush(_links=None, date=None, push_correlation_id=None, pushed_by=None, push_id=None, url=None, commits=[commit], ref_updates=[refUpdateDevelop], repository=None)
git_client.create_push(push=push,repository_id=newRepo.id,project=projectName)
#endregion

time.sleep(5)

Find pipeline id

found = False
while not found:
for pipeline in pipeline_client.list_pipelines(project=projectName, order_by=None, top=None, continuation_token=personal_access_token):
if(pipeline.name == (newRepoName + " CI")):
repoPipeline = pipeline
found = True`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions