-
Notifications
You must be signed in to change notification settings - Fork 34
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
Azure devops #216
base: main
Are you sure you want to change the base?
Azure devops #216
Conversation
@@ -15,6 +15,7 @@ require ( | |||
github.com/hashicorp/go-multierror v1.1.1 | |||
github.com/hashicorp/go-retryablehttp v0.7.2 | |||
github.com/ktrysmt/go-bitbucket v0.9.48 | |||
github.com/microsoft/azure-devops-go-api/azuredevops/v6 v6.0.1 |
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.
latest release is v7 https://github.com/microsoft/azure-devops-go-api/releases/tag/azuredevops%2Fv7.1.0
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.
we can't use V7 until they fix ContinuationToken
field type. It is unconsistent depending on which struct you use.
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.
@souleb is it related to this issue? microsoft/azure-devops-go-api#97 did you find it in a different struct?
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've mentioned this to the relevant team and will let you know when it gets resolved
Co-authored-by: souleb <[email protected]> Signed-off-by: Nelly Kiboi <[email protected]>
Co-authored-by: souleb <[email protected]> Signed-off-by: Nelly Kiboi <[email protected]>
Signed-off-by: Soule BA <[email protected]> Signed-off-by: nellyk <[email protected]>
Signed-off-by: nellyk <[email protected]>
Signed-off-by: nellyk <[email protected]>
Signed-off-by: nellyk <[email protected]>
Signed-off-by: nellyk <[email protected]>
Co-authored-by: souleb <[email protected]> Signed-off-by: Nelly Kiboi <[email protected]> Signed-off-by: nellyk <[email protected]>
Co-authored-by: souleb <[email protected]> Signed-off-by: Nelly Kiboi <[email protected]> Signed-off-by: nellyk <[email protected]>
Signed-off-by: nellyk <[email protected]>
Signed-off-by: nellyk <[email protected]>
Co-authored-by: souleb <[email protected]> Signed-off-by: Nelly Kiboi <[email protected]> Signed-off-by: nellyk <[email protected]>
Co-authored-by: souleb <[email protected]> Signed-off-by: Nelly Kiboi <[email protected]> Signed-off-by: nellyk <[email protected]>
Signed-off-by: nellyk <[email protected]>
Signed-off-by: nellyk <[email protected]>
Signed-off-by: nellyk <[email protected]>
Signed-off-by: nellyk <[email protected]>
Signed-off-by: Soule BA <[email protected]>
Signed-off-by: Soule BA <[email protected]>
Also cleaning up and refactoring where needed. Signed-off-by: Soule BA <[email protected]>
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## main #216 +/- ##
==========================================
- Coverage 59.48% 59.00% -0.49%
==========================================
Files 44 88 +44
Lines 3019 6891 +3872
==========================================
+ Hits 1796 4066 +2270
- Misses 1038 2251 +1213
- Partials 185 574 +389
☔ View full report in Codecov by Sentry. |
@@ -86,6 +86,18 @@ make test-e2e-stash | |||
| Test organization | go-git-provider-testing | `GIT_PROVIDER_ORGANIZATION` | | |||
| Test team | fluxcd-test-team | `STASH_TEST_TEAM_NAME` | | |||
|
|||
|
|||
### Azure DevOps |
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.
### Azure DevOps | |
#### Azure DevOps |
// No default value at POST-time. | ||
// Added for Azure devops compatibility since it allows updating the name | ||
// +optional | ||
Name *string `json:"name"` |
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 type is also returned by e.g. UserRepository.Get
. We should adapt the other implementations to properly fill this field. Otherwise it will be nil which feels strange, esp. since the information is available from the API types.
|
||
const ( | ||
azureTokenFile = "/tmp/azure.token" | ||
defaultDescription = "Foo description" |
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 variable is only ever consumed once and it's not very important to declare it here (as opposed to the variable above). We should just inline it. Alternatively give it a name that make it easier to determine its intended use.
) | ||
|
||
const ( | ||
azureTokenFile = "/tmp/azure.token" |
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.
Optional: inline this value.
testing.Init() | ||
rand.Seed(time.Now().UnixNano()) |
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.
Is it really necessary to do this in an init
func as opposed to TestProvider
or in the azure Provider
spec? I personally avoid init
wherever possible as it's really hard to control or discover when navigating the code.
// Create if not found | ||
if errors.Is(err, gitprovider.ErrNotFound) { | ||
resp, err := c.Create(ctx, ref, req, toCreateOpts(opts...)...) | ||
return resp, true, 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.
return resp, true, err | |
return resp, true, fmt.Errof("failed creating repository %q: %w", ref, err) |
) | ||
|
||
const ( | ||
emptyObjectPlaceholder = "0000000000000000000000000000000000000000" |
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 definitely needs an explanatory comment. What is it used for and why do we need it?
gitRefPrefix = "refs/heads/" | ||
) | ||
|
||
// BranchClient implements the gitprovider.BranchClient interface. |
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.
// BranchClient implements the gitprovider.BranchClient interface. |
I think this is self-explanatory to a Go programmer.
repositoryId := c.ref.GetRepository() | ||
projectId := c.ref.GetIdentity() | ||
ref := gitRefPrefix + branch | ||
all := make([]any, 0, len(files)) |
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.
all := make([]any, 0, len(files)) | |
allFiles := make([]any, 0, len(files)) |
?
requests := make([]gitprovider.PullRequest, len(*prs)) | ||
|
||
for idx, pr := range *prs { | ||
requests[idx] = newPullRequest(c.clientContext, &pr) |
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.
requests[idx] = newPullRequest(c.clientContext, &pr) | |
pr := pr | |
requests[idx] = newPullRequest(c.clientContext, &pr) |
This is needed because Go reuses variables. You may end up with requests
pointing to the same address for all items in the slice.
Description
New azure devops implementation.
It can effectively reconcile azuredevops repositories using the azure zsk. It uses a
PAT
asssh keys
are not supported.Commits
andPull requests
are supported butteams
permissions are still to be implemented.cc @nellyk
Test results
https://github.com/fluxcd/go-git-providers/actions/runs/4832004149/jobs/8610205652