You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
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`
The text was updated successfully, but these errors were encountered:
You should not send in your pat token as the continuation token. They are two different things. The first call to list_pipelines should not supply a continuation_token at all. Use the order_by parameter to return the most recent pipelines, so the data set includes your pipeline you just created.
In the response there is a header called x-ms-continuationtoken, which should be sent in to subsequent calls, to get further pipelines from the query set. Unfortunately we are not providing access to that header yet through the list_pipelines return value, and that is being tracked by issue: #152, which should be fixed soon.
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`
The text was updated successfully, but these errors were encountered: