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

Cannot connect to Azure DevOps git repo #15

Open
mikemowgli opened this issue Oct 19, 2020 · 2 comments
Open

Cannot connect to Azure DevOps git repo #15

mikemowgli opened this issue Oct 19, 2020 · 2 comments

Comments

@mikemowgli
Copy link

my git repo is on Azure DevOps. I tried both ssh and http, and both cli config and terraform backend config, always with the same result:

[terraform-backend-git]: empty git-upload-pack given
[terraform-backend-git]: empty git-upload-pack given
[terraform-backend-git]: empty git-upload-pack given

Error: Error loading state:
    Failed to get state: GET http://localhost:6061/?type=git&repository=git@ssh.dev.azure.com:v3/REDACTED/infra-analytics/tooling-tf&ref=state&state=tfstate.json giving up after 3 attempts

Just to make sure, I already created the branch, and the tfstate.json file, but got the same result.

Here's my config:

terraform {
  backend "http" {
    address        = "http://localhost:6061/?type=git&repository=git@ssh.dev.azure.com:v3/REDACTED/infra-analytics/tooling-tf&ref=state&state=tfstate.json"
    lock_address   = "http://localhost:6061/?type=git&repository=git@ssh.dev.azure.com:v3/REDACTED/infra-analytics/tooling-tf&ref=state&state=tfstate.json"
    unlock_address = "http://localhost:6061/?type=git&repository=git@ssh.dev.azure.com:v3/REDACTED/infra-analytics/tooling-tf&ref=state&state=tfstate.json"
  }
}

I also have the TF_BACKEND_HTTP_ENCRYPTION_PASSPHRASE env var set.

When enabling the access logs, I get

[terraform-backend-git]: ssh: handshake failed: EOF
127.0.0.1 - - [19/Oct/2020:11:24:48 +0200] "GET /?type=git&repository=git@ssh.dev.azure.com:v3/REDACTED/infra-analytics/tooling-tf&ref=state&state=tfstate.json HTTP/1.1" 500 27
[terraform-backend-git]: empty git-upload-pack given
127.0.0.1 - - [19/Oct/2020:11:25:10 +0200] "GET /?type=git&repository=git@ssh.dev.azure.com:v3/REDACTED/infra-analytics/tooling-tf&ref=state&state=tfstate.json HTTP/1.1" 500 27
[terraform-backend-git]: empty git-upload-pack given
127.0.0.1 - - [19/Oct/2020:11:25:13 +0200] "GET /?type=git&repository=git@ssh.dev.azure.com:v3/REDACTED/infra-analytics/tooling-tf&ref=state&state=tfstate.json HTTP/1.1" 500 27
@dee-kryvenko
Copy link
Member

dee-kryvenko commented Oct 20, 2020

Thanks for your interest in this project @mikemowgli.

Briefly looking into this issue, it looks like the error comes from go-git. After a little bit of research it looks like this is due to the fact go-git does not support multi-ack (so as many other git client implementations). Azure DevOps (as well as VSTS) in turn does not support older non-multi-ack protocols. All the major competitors like GitHub/GitLab/Bitbucket does support it.

There's a number of issues being reported both in go-git as well as it's consumers, just to list the few:

It goes on and on to as early as 2017. Together with the fact that Azure DevOps/VSTS seems to be the only one who requires multi-ack, I wouldn't hope for a prompt resolution in go-git. It seems like even Go itself struggle with that: golang/go#28236

That said, Microsoft seems to be firmly refusing to relax protocol requirements: fluxcd/source-controller#104 (comment)

Theoretically it should be possible to swap out go-git by delegating to git command, but that would significantly increase complexity, introduce external dependencies as well as cause potential portability issues - so I am not sure I want to go down that route. This backend design allows for external storage implementations though, so maybe someone else will want to go for it. I'm gonna leave this issue open to not to forget to update go-git once they solve this issue. Other than that there's not much I can help with at this time. Sorry.

@dee-kryvenko
Copy link
Member

Fun fact: looking into the GitHub repo stats you seems to be the first one who's trying to use this backend. And you happen to use Azure DevOps which this backend turns out to have compatibility issues with. What a shame.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants