Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ALM Accelerator - BUG]: Update Deployment settings failing with GitRepositoryNotFoundException #6034

Closed
kaat03 opened this issue Jul 11, 2023 · 4 comments
Assignees
Labels
alm-accelerator ALM Accelerator Components and Apps bug Something isn't working

Comments

@kaat03
Copy link

kaat03 commented Jul 11, 2023

Describe the issue

Update Deployment Settings step in export-solution-to-git pipeline fails with GitRepositoryNotFound exception. New repository and deployment profile were created for committing and deploying a solution. Previous deployments of other solutions to their own repositories never encountered this issue.

Full error message:

Creating deployment settings
Creating custom deployment settings
https://***.visualstudio.com/***/_apis/build/definitions/21?api-version=6.0
Invoke-RestMethod : {"$id":"1","innerException":null,"message":"TF401019: The Git repository with name or identifier 
****-****-****-***-*** 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}
At D:\a\1\PipelineUtils\PowerShell\update-deployment-settings.ps1:467 char:9
+         Invoke-RestMethod $buildDefinitionResourceUrl -Method 'PUT' - ...
+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebExc 
   eption
    + FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand

Let's call the correct, new repository, repository A, and the second one, which identifier is referenced in the error, repository B.

The very first deployment of the solution was done without any Deployment Settings and completed successfully. Upon further investigation, we found out that in this first successful run, a build originally created 4 months ago for repository B was connected to this new solution. After configuring deployment settings, committing the solution started failing with the above error, each time with the build details being from a build done for another solution and repository B. DevOps pipelines were still correctly created in repository A.

Repository B is the very first repository used for committing the first solution with ALM Accelerator. Committing newer solution with the same deployment profile completed without any issues, so I'm unsure if we're overlooking something.

Expected Behavior

Update Deployment Settings completes without issues, with new build created for a new solution, linking to the correct git repository.

What component are you experiencing the issue with?

ALM Accelerator Canvas App

What solution version are you using?

1.0.20230404.2

Steps To Reproduce

  1. Create new repository.
  2. Create new deployment profile with that repository.
  3. Commit solution in the canvas app, with the Create new branch option.

Anything else?

Similar issue was reported over a year ago: 1865

Excerpt from the build definition:

"repository":{"id":"**repository-B-id**","type":"TfsGit","name":"**repository-B-name**,"url":"https://***.visualstudio.com/***/_git/**repository-B-name**","defaultBranch":"refs/heads/**newSolutionName**","clean":null,"checkoutSubmodules":false

@kaat03 kaat03 added alm-accelerator ALM Accelerator Components and Apps bug Something isn't working labels Jul 11, 2023
@mikefactorial
Copy link
Collaborator

@kaat03 the July release includes an update that may resolve this issue if I understand it correctly. The update we made was to prefix the builds with the repository name to avoid conflicts when generating deployment pipelines in different repos in the same project. Take a look here. #5335

@mikefactorial mikefactorial self-assigned this Jul 11, 2023
@mikefactorial
Copy link
Collaborator

Closing this out for now as there's nothing more to do here.

@kaat03
Copy link
Author

kaat03 commented Jul 25, 2023

@mikefactorial I've only noticed now that my comment didn't go through last time. Thank you for pointing that out. Updating to the July release did solve our problem.

@CoEStarterKitBot
Copy link
Collaborator

@kaat03 This has been fixed in the latest release. Please install the latest version of the toolkit following the instructions for installing updates. Note that if you do not remove the unmanaged layers as described there you will not receive updates from us.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
alm-accelerator ALM Accelerator Components and Apps bug Something isn't working
Projects
Status: Done
Development

No branches or pull requests

3 participants