-
Notifications
You must be signed in to change notification settings - Fork 257
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
Support import private repository #236
Comments
@ak58588 Azure DevOps will create a repo with the same as the project name by default. You can reuse the default repository with data source |
@xuzhang3 thanks for your reply. What still I need is to create a new repo by importing some other existing one...and I wonder what makes terraform apply to fail every time |
@ak58588 I tested your script and it worked for me, I cannot reproduce your error(both of github repo and azure git repo works). Can you share more error logs or reproduce steps? Is the repo you want to import is an existed one or created along with this repo. |
@xuzhang3 thanks for your response. I have tried to deploy a project with a repo only (the one with import). I have examined the debug logs and found there
So it complains about the id expandGitRepository: ID is empty (not set) |
@xuzhang3 https://gist.github.com/ak58588/85c1a3bc6ade720a7af0039821b63944 this is the gist with the logs |
@xuzhang3 I think I got what my problem in my case is - I am referring another Azure DevOps git repo from the same organisation. I have just tried importing some github.com/.git and it worked. |
@ak58588 I'm experiencing this issue also, with the same I'm trying to import an existing repo from the same project and organisation. When I do this via the UI, I have to provide authentication. @xuzhang3 is this supported by the updated provider? Our use case is that when we create these new repos (there will be many), we want to use the another repo as the template which we will then add code to. |
Hi @ChrisF987 @ak58588 The root issue here is current import function only support public repo link, if you want import a private repo, you need the pass the credentials. Potential Terraform Configuration resource "azuredevops_git_repository" "repo" {
project_id = id
name = "Project name"
initialization {
init_type = "Import"
source_type = "Git"
source_url = "repo_link"
username =""
password=""
personal_access_token=""
}
} |
Thanks, @xuzhang3 ! I have just tried adding the credentials and I am getting the error "unsupported argument" on these three parameters like this:
|
Hi @ak58588 This is not supported yet, this is new feature we need to implement. |
@xuzhang3 thanks for the information |
Any information about a roadmap for this feature? Digged a bit deeper in the source code and traced the function calls. Seems like the repository is created and afterwards the import is requested (which we can verify as the repo gets created in azure devops but in state uninitialized). Line 580 in abee538
(Note the [Preview] in the comment line above)
When running terraform we get the same error as @ak58588 : On line 599 onwards it says:
So as we are not getting any additional error message besides to nil there might be a problem with the actual API call? Might this be related to microsoft/azure-devops-go-api#93 ? EDIT 1: Can someone explain what location does and why it is hardcoded?: Line 598 in abee538
Here we have Line 599 in abee538
which is no longer available at the official API documentation EDIT 2: Another finding: The Line 1057 in 4a33afe
whereas the latter one uses 5.1-preview.1
So for me there are 2 different things that could be the root cause:
|
@xuzhang3 any roadmap update on this? Is there any point where we can assist? |
Hi @wernerfred In portal, when you try to import a repository with authorization, you will find 4 HTTP requests before the repository created. |
@wernerfred This issue is in our backlog, but not the highest priority. If you interest in this issue, you can create a PR for it. |
…sitories * add support for username and password authentication with import initialization of the `resource_git_repository` resource * create `UsernamePassword` service connection when credentials are specified, which is used by the import request * fix an issue where errors in the import / initialization process could leave behind the uninitialized repository without being recorded in state Closes: microsoft#236
…sitories * add support for username and password authentication with import initialization of the `resource_git_repository` resource * create `UsernamePassword` service connection when credentials are specified, which is used by the import request * fix an issue where errors in the import / initialization process could leave behind the uninitialized repository without being recorded in state Closes: microsoft#236
…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
…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
…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
Community Note
Terraform (and Azure DevOps Provider) Version
Terraform v0.13.5
azurerm v2.36.0
random v3.0.0
azuredevops v0.1.0
Affected Resource(s)
azuredevops_git_repository
Terraform Configuration Files
Debug Output
Panic Output
Expected Behavior
The apply proceeds successfully, the repository is created and there is no error.
Actual Behavior
What actually happens:
Steps to Reproduce
terraform apply
The text was updated successfully, but these errors were encountered: