-
Notifications
You must be signed in to change notification settings - Fork 271
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(resource_git_repository): add support for importing private repos #402
feat(resource_git_repository): add support for importing private repos #402
Conversation
Hi @dmccaffery Thanks for PR.
There is a PR #181 working on generic git service endpoint, but no update for a long time. @paulbehrisch any update on PR #181 ? |
I'm happy to implement this on top of an existing service connection once it is available. Re: deleting the service connection afterwards, there is a flag sent to the import request that causes the server to delete the service connection automatically after the import completes, so this doesn't need to be handled by us in terraform (other than setting the flag). We, of course, would not want to set this flag if passing in an existing service connection id instead of creating one within this resource. It should be noted that I created this PR by reverse engineering the network traffic performed when doing an import via the UI, which always creates a new randomly named service connection and then passes in We can put this PR on hold until the generic service connection is available. I can also look at taking over #181 if the original author and/or maintainers agree. |
8ac1522
to
ec768f0
Compare
@xuzhang3: I took the liberty to reimplementing this on top of a new Let me know if there is anything else I can do! |
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.
@dmccaffery Thanks for your PR, a few changes requested.
azuredevops_serviceendpoint_generic
andazuredevops_serviceendpoint_generic_git
document should indicate that user can use username/password or username/personal access token to create the service. Especially for GitHub user with 2-factor-auth enabled, they should create the service connection withusername/personal access token
notusername/password
, otherwise the authorization will failed.azuredevops_git_repository
can remove theusername/password
now, the import authorization can use the service connection.
azuredevops/internal/service/serviceendpoint/resource_serviceendpoint_generic.go
Outdated
Show resolved
Hide resolved
azuredevops/internal/service/serviceendpoint/resource_serviceendpoint_generic_git.go
Outdated
Show resolved
Hide resolved
azuredevops/internal/service/serviceendpoint/resource_serviceendpoint_generic_git.go
Show resolved
Hide resolved
* add build tags on `resource_repositorypolicy_author_email_patterns_test` * add build tags on `resource_serviceendpoint_azuredevops_test` * add build tags on `resource_serviceendpoint_ssh_test`
* add `serviceendpoint_generic` resource to enable creation of a completely generic authentication service endpoint for any server * add acceptance tests for the resource * add documentation for the resource
ec768f0
to
07f5f0a
Compare
@xuzhang3 all requested changes have been made; also rebased on top of master. |
* add `serviceendpoint_generic_git` resource to enable creation of a completely authentication service endpoint for any git repository url * add acceptance tests for the resource * add documentation for the resource
…sitories * add support for specifying a `service_connection_id` for importing private repositories using the `serviceendpoint_generic_git` resource * add acceptance test that imports a repository from azure devops via the `serviceendpoint_generic_git` resource * fix an issue where errors in the import / initialization process could leave behind the uninitialized repository without being recorded in state Closes: microsoft#236 Supersedes: microsoft#181
07f5f0a
to
e5d5d8d
Compare
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.
serviceendpoint_generic.html.markdown
and serviceendpoint_generic_git.html.markdown
document link need to be add to azuredevops.erb
@dmccaffery I have add the document link |
Thank you! I've been super busy (moving home) and haven't had a chance to circle back on this. Much appreciated! |
Acceptance test result: Git Repository
Generic service connection
Generic Git service connection
|
LGTM |
feat(resource_git_repository): add support for importing private repos
service_connection_id
for importingprivate repositories using the
serviceendpoint_generic_git
resourcethe
serviceendpoint_generic_git
resourceleave behind the uninitialized repository without being recorded in
state
Closes: #236
Supersedes: #181
feat: add generic git service endpoint resource
serviceendpoint_generic_git
resource to enable creation of acompletely authentication service endpoint for any git repository url
feat: add generic service endpoint resource
serviceendpoint_generic
resource to enable creation of acompletely generic authentication service endpoint for any server
fix: add missing build tags on acceptance tests
resource_repositorypolicy_author_email_patterns_test
resource_serviceendpoint_azuredevops_test
resource_serviceendpoint_ssh_test
All Submissions:
What about the current behavior has changed?
Issue Number: #236
Does this introduce a change to
go.mod
,go.sum
orvendor/
?Does this introduce a breaking change?
Any relevant logs, error output, etc?
(If it’s long, please paste to https://ghostbin.com/ and insert the link here.)
Other information