-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
feat: Add Azure DevOps SCM Provider Generator; add branchNormalized to SCM Generator template fields. #9283
feat: Add Azure DevOps SCM Provider Generator; add branchNormalized to SCM Generator template fields. #9283
Conversation
Signed-off-by: Christer Brinchmann <christer.brinchmann@gmail.com>
Signed-off-by: Christer Brinchmann <christer.brinchmann@gmail.com>
Signed-off-by: Christer Brinchmann <christer.brinchmann@gmail.com>
Signed-off-by: Christer Brinchmann <christer.brinchmann@gmail.com>
Codecov Report
@@ Coverage Diff @@
## master #9283 +/- ##
==========================================
+ Coverage 45.76% 45.85% +0.08%
==========================================
Files 225 226 +1
Lines 26565 26675 +110
==========================================
+ Hits 12157 12231 +74
- Misses 12751 12783 +32
- Partials 1657 1661 +4
Continue to review full report at Codecov.
|
Thanks for the PR @brinchm! Will review ASAP. |
hasPath, err := provider.RepoHasPath(ctx, repo, path) | ||
|
||
if testCase.returnError { | ||
assert.Error(t, err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
curious! why we have this as a check? both the scenario error or noerror as passing test case?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried covering the cases where azure devops returns an error signaling that the requested path doesn't exist (which is fine; maybe the path isn't there in the specified branch, so the return is false, nil
), and also where azure devops returns other errors. In that latter case, I expect RepoHasPath
to actually return an error
.
But if the intent of the test cases is not clear I can try rewriting the test cases or possibly doing a new "Azure Devops Failed" test.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably we should segregate it with two names, one positive and other negative
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is awesome! Most of the comments are style nits. There are a couple comments that are more impactful.
Signed-off-by: Christer Brinchmann <christer.brinchmann@gmail.com>
Signed-off-by: Christer Brinchmann <christer.brinchmann@gmail.com>
Signed-off-by: Christer Brinchmann <christer.brinchmann@gmail.com>
…getting default branch. Signed-off-by: Christer Brinchmann <christer.brinchmann@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a few more tiny nitpicks. @rishabh625 can you give this one a final look?
if err != nil { | ||
if wrappedError, isWrappedError := err.(azuredevops.WrappedError); isWrappedError && wrappedError.TypeKey != nil { | ||
if *wrappedError.TypeKey == AzureDevOpsErrorsTypeKeyValues.GitRepositoryNotFound { | ||
return repos, nil |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if this error should be bubbled up. Is this ignored because it applies to disabled repos? If it applies to more than than, should we log a warning?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The GitRepository
returned from the Azure DevOps Golang library doesn't include info indicating if a repo is disabled, but the REST API it calls, does.
When retrieving branches for a disabled repo, the WrappedError
contains the GitRepositoryNotFoundException
text. For this situation, I chose to ignore the error and just return an empty slice.
I'll need to give this some thought; The GetRepositories
call is quite simple, so a GET could be issued directly to the REST API... Might work, but it seems like a suboptimal solution.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, reinventing the wheel there would stink. I'm okay merging as-is. I don't think this will catch transient errors and accidentally delete Apps or anything nefarious like that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks :)
The feature branch has one conflict in go.mod
and some 129 commits behind master. I'll do a merge and push asap.
Signed-off-by: Christer Brinchmann <christer.brinchmann@gmail.com>
Signed-off-by: Christer Brinchmann <christer.brinchmann@gmail.com>
Signed-off-by: Christer Brinchmann <christer.brinchmann@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for seeing this through!
Thank you, likewise! Happy to contribute :) |
Adds Azure DevOps SCM provider generator. For organizations that use Azure DevOps as their SCM, this will enable ApplicationSets to deploy applications based on repos and branches while in the development phase.
The pull request also contains an enhancement to
SCMProviderGenerator.GenerateParams
:branchNormalized
. This aids in generating applications with unique names:Closes #9280
Signed-off-by: brinchm christer.brinchmann@gmail.com
Note on DCO:
If the DCO action in the integration test fails, one or more of your commits are not signed off. Please click on the Details link next to the DCO action for instructions on how to resolve this.
Checklist: