azure-devops-create-pr-task icon indicating copy to clipboard operation
azure-devops-create-pr-task copied to clipboard

Error (404) Not Found for PR when PR-repo not same as source code

Open ivan-luxoft opened this issue 4 years ago • 39 comments

Hello,

I am get error when set parameters:

repositorySelectionMethod: select
projectId: 'CreatePR_FromOneToAnotherRepository'
gitRepositoryId: 'TargetOne'

where gitRepositoryId different from repository with source code for build screenshot (left repo for PR same as source code, right - different) chrome_2lVBrRt6I5

settings task: image

If I change repo for source code, but not change another settings - task successful runs and PR created

ivan-luxoft avatar Jul 07 '21 19:07 ivan-luxoft

Hi, can you run the pipeline with system.debug = true and share here the logs? Did you grant the permissions in the second project & repo?

shayki5 avatar Jul 11 '21 06:07 shayki5

debug log for task attached log.txt

permissions was set for repositories on the project level, all repository in the same project chrome_8719QfYKxs

also I tried to give permissions of all types but it doesn't work chrome_BtfxWcz3SM

ivan-luxoft avatar Jul 12 '21 06:07 ivan-luxoft

Thank you! I can reproduce the issue. Look like my code support only forks repos from the same project, I will add a support also from other projects, I hope I will have time soon :)

shayki5 avatar Jul 12 '21 17:07 shayki5

Wait, is it forked repo or just 2 different repos in 2 projects?

shayki5 avatar Jul 12 '21 17:07 shayki5

it is two different repos, I want copy files from first to second, then commit second and create pullrequest (for purpose update libs or shared files)

I looked code and think that token can usage without call method Get-VstsEndpoint

ivan-luxoft avatar Jul 12 '21 19:07 ivan-luxoft

You can't create a PR for 2 different repos, even in the UI. this is how git works.

shayki5 avatar Jul 13 '21 09:07 shayki5

I know it =) , I want copy files from the source repository to the target (locally on agent), then commit copying files to the target repo and created PR with commit changes in target repo

ivan-luxoft avatar Jul 13 '21 09:07 ivan-luxoft

Who should do the copy & commit? is it in your pipeline?

shayki5 avatar Jul 13 '21 09:07 shayki5

yes, it is task/action/script in the pipeline

ivan-luxoft avatar Jul 13 '21 10:07 ivan-luxoft

can you share your full pipeline?

shayki5 avatar Jul 13 '21 12:07 shayki5

I'm not implemented functional for copy and commit =) In this time I having trouble with creating PR for repository if build run not from him.

ivan-luxoft avatar Jul 13 '21 12:07 ivan-luxoft

I tried in my organization and I succeeded to create the PR for a repo that is different then the "get sources" repo. Can you try to give permissions also to the following groups? image

shayki5 avatar Jul 13 '21 13:07 shayki5

I set all permissions for these groups, also I add build service account in this group, but for me it is not working, I try it for another organization later

ivan-luxoft avatar Jul 13 '21 14:07 ivan-luxoft

Can you give me permissions to your organization? I will try to check it.

shayki5 avatar Jul 19 '21 12:07 shayki5

I add you by email to the organization

ivan-luxoft avatar Jul 19 '21 12:07 ivan-luxoft

Thank you! Please grant permissions also to the user Project Collection Build Service (ivang0848): image

shayki5 avatar Jul 19 '21 13:07 shayki5

I added all permission, but previously I not seen this service account (and now I found it by search)

ivan-luxoft avatar Jul 19 '21 13:07 ivan-luxoft

I see it's still filed, very strange! Can you create a new pipeline and try there? or in another project?

shayki5 avatar Jul 19 '21 13:07 shayki5

Try also to do this: Go to Organization _Settings-->under Security-->Permissions--> Project Collection Build Service Accounts-->Memebers-->Add -->Project Collection Build Service (ivang0848)

shayki5 avatar Jul 19 '21 14:07 shayki5

Have the same issue, have provided access to the Accounts as mentioned, still have 404. Trying to run the pipeline in a different Project 1. Is it possible to merge from Project 2 to Project 3(forked).

AnshumanTripathy avatar Aug 05 '21 15:08 AnshumanTripathy

@AnshumanTripathy When it forked repos it's impossible, I will add it soon! If it is not forked repos, just repo in another project are you success?

shayki5 avatar Aug 06 '21 09:08 shayki5

@ivan-luxoft any news? are you able to create a PR?

shayki5 avatar Feb 28 '22 07:02 shayki5

@shayki5 I have the same issue. I've added all the needed permissions and also have a 404.

##[debug]Invoke-RestMethod : {"$id":"1","innerException":null,"message":"TF401019: The Git repository with name or identifier <GUID> does not exist or you do not have permissions for the operation you are attempting.","typeName":"Microsoft.TeamFoundation.Git.Server.GitRepositoryNotFoundException, Microsoft.TeamFoundation.Git.Server","typeKey":"GitRepositoryNotFoundException","errorCode":0,"eventId":3000}

BGajda13 avatar Apr 05 '22 15:04 BGajda13

@BGajda13 Are the repos in 2 different projects?

shayki5 avatar Apr 05 '22 17:04 shayki5

@shayki5 Repos are in the same project.

BGajda13 avatar Apr 06 '22 08:04 BGajda13

So It should be OK, can you share a screenshot of the permissions you gave?

shayki5 avatar Apr 06 '22 09:04 shayki5

image image

BGajda13 avatar Apr 06 '22 15:04 BGajda13

@BGajda13 Try to give the permissions also to these users: image

shayki5 avatar Apr 07 '22 06:04 shayki5

Hi @shayki5, just following up on this thread as I faced similar issue. I have followed all the necessary steps to grant permission as recommended. But, I still get 404

image

daviegy avatar Nov 17 '22 10:11 daviegy

Hi @daviegy, are the branches in the same repo?

shayki5 avatar Nov 17 '22 11:11 shayki5