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

Git Pull on Stack Deploy fails with valid URL #1926

Closed
turbo opened this issue May 23, 2018 · 28 comments · Fixed by #5070
Closed

Git Pull on Stack Deploy fails with valid URL #1926

turbo opened this issue May 23, 2018 · 28 comments · Fixed by #5070

Comments

@turbo
Copy link

turbo commented May 23, 2018

Bug description

VSTS Git URLs look like this:

https://user:password@example.visualstudio.com/TeamName/_git/repo

where repo is the name of the repository. The bug is that portainer fails to pull a valid repo with the following error message:

Deployment error
unexpected client error: unexpected requesting "https://turbo:***@***.visualstudio.com/***Cloud/_git/azure/git-upload-pack" status code: 400

Expected behavior

The same as git clone, which doesn't fail:

$ git clone https://turbo:***@***.visualstudio.com/***Cloud/_git/azure
Cloning into 'azure'...

Clones the repo just fine.

Technical details:

  • Portainer version: 1.17.1
  • Docker version (managed by Portainer): 18.03ce
  • Platform (windows/linux): linux
  • Command used to start Portainer (docker run -p 9000:9000 portainer/portainer): stack
  • Browser: Chrome
@turbo
Copy link
Author

turbo commented May 23, 2018

Portainer send an invalid git request to the server (it appends git-upload-pack the the URL). This causes a GitProtocolException, with the following error message:

TF401041: The Git protocol sent is not as expected (Unable to read the 4-byte length header of the message.).

@turbo
Copy link
Author

turbo commented May 23, 2018

This is likely a pretty major bug (missing multi_ack support) in go-git that has been unfixed for quite a while: src-d/go-git#335 (comment)

This is a real deal-breaker for us.

@turbo
Copy link
Author

turbo commented May 25, 2018

Out of curiosity, are bug fixed prioritized for businesses with a support subscription?

@ncresswell
Copy link
Member

ncresswell commented May 25, 2018 via email

@olljanat
Copy link
Contributor

@turbo FYI I have implemented alternative method for VSTS users: https://marketplace.visualstudio.com/items?itemName=OlliJanatuinen.portainer-deploy

@turbo
Copy link
Author

turbo commented Sep 17, 2018

@olljanat I saw that, but we don't use any Windows agents. Since there is a discussion about pulling from git in #1752, I'd prefer a first-party solution.

@GrumpyMeow
Copy link

I work for a Microsoft oriented company which is trying to adopt Docker.
For us the ability to clone from VSTS would make the adoption much user friendlier.
In this thread someone described that the issue is already resolved in Go-Git a while ago.
Is resolving this issue not as easy as using a later version of Go-Git?

@deviantony
Copy link
Member

Hi @GrumpyMeow

Based on #1926 (comment)

This is likely a pretty major bug (missing multi_ack support) in go-git that has been unfixed for quite a while: src-d/go-git#335 (comment)

It has not been resolved, unfortunately no activity on go-git for this one. One solution here would be to use another library than go-git as our git service implementation.

@olljanat
Copy link
Contributor

@turbo / @GrumpyMeow It is nice to see that more VSTS users are joining to Portainer users. But in same time it feels that you are are thinking this bit weird way.

On fully adopted implementation VSTS is much more than just Git repository, it also owns whole CI/CD pipeline(s), test automation, all approval chains, work item management, etc.

That why IMO VSTS must push services to Portainer rather than Portainer would pull them.

But I created another feature request about it to #2448 so please share your though about it on there.

@turbo
Copy link
Author

turbo commented Nov 11, 2018

@olljanat We're using VSTS as a code hosting platform, not as a build platform. Our issue is exactly what I described here and not more.

This is a bug in the git pull done by Portainer, it doesn't really matter what service is on the other end. We are paying Portainer customers and would like to see this resolved. VSTS (now called Azure DevOps btw.) integration beyond that might be relevant to other users, but not to us.

@olljanat
Copy link
Contributor

@turbo OK. I understand that this one is bug from users point of view but from code point of view issue is that any of authentication methods which are supported by VSTS have not been implemented to libraries which Portainer currently uses so it is bit more tricky to fix than normal bug fixes.

But as VSTS also supports connecting Git repos with SSH , I understood from your comment that options works for you I think that best options would be then finalize PR #2294 and add comment to documentation that with VSTS you need use SSH authentication.

Works for you?

@olljanat olljanat mentioned this issue Nov 11, 2018
@turbo
Copy link
Author

turbo commented Nov 11, 2018

Yes, SSH would be the preferred way to connect to Azure DevOps for us.

@filipvaleriu
Copy link

filipvaleriu commented Dec 10, 2018

I have found that calling
git commit -m "Init"
and afterwards
git push -u origin --all
works ok

@olljanat
Copy link
Contributor

@filipvaleriu sorry but I did not understood that how that is related to this issue which talks about git pull issue (not push)?

@filipvaleriu
Copy link

Yes, i see now, you are corect about that.
Still i ended up on this forum post, after i was stuck in that same error message for not beeing able to make an initial push for my newly created local git repository; after reading the post and finding also somewhere else some clues, not seeing anymore that was about pull instead of push, i thought might be helpfull for others to see a solution.

@GrumpyMeow
Copy link

@olljanat We're trying to go all-in on VSTS: build agents, CI/CD, Pull Requests, GIT, scrumb board, etc.
I want to give all developers from my department the option to run Portainer locally on their development machines to manage Docker in a more user-friendly manner.
For now i don't feel comfortable to start using webhooks.

@olljanat
Copy link
Contributor

@GrumpyMeow OK. Would #1752 work for your use cases?

We have about 90% ready solution for it on #2294 which just would need to be finalized.

Then what comes to CI/CD into real production envs please comment about it to #2448

@deviantony deviantony moved this from Confirmation required - Low priority to Need triage in Bug triage Mar 4, 2019
@ghost ghost removed this from Need triage in Bug triage Mar 11, 2019
@ghost
Copy link

ghost commented Mar 11, 2019

This issue has been marked as stale as it has not had recent activity, it will be closed if no further activity occurs in the next 7 days. If you are able to reproduce this issue on the latest version of Portainer, feel free to leave a comment and we can pick up this issue again.

@ghost
Copy link

ghost commented Mar 24, 2019

Since no further activity has appeared on this issue I will close it for now. If you are able to reproduce this issue on the latest version of Portainer, feel free to leave a comment and we can pick up this issue again.

@mateuszdrab
Copy link

@deviantony Hey Tony. Sorry to dig this out from the dead. I've been affected by the impossibility to deploy a stack from VSTS as well. Considering that the underlying issue in is still not resolved in the go-git package and it's been 3 years since that issue was created. Wouldn't it be possible to use the git executable instead?

@deviantony
Copy link
Member

deviantony commented Apr 5, 2020

@mateuszdrab yeah that could be an approach, I'm always reluctant to use binaries against libraries for the following main reasons:

  • Multi-platform setup requirements
  • Error/standard output handling of a binary

That underlying issue in the go-git library seems to be a major one, as such I would not see any problem switching to the usage of the binary (it's just about implementing the GitService interface inside the exec package).

If we start relaying on more git features in Portainer, I can see this as a direction where we would want to go. In the meantime, any contribution to the discussion/implementation of using the git binary is welcome.

cc @ncresswell

NOTE: interesting link on the source of golang which is actually doing this behind the scenes here

@deviantony deviantony reopened this Apr 5, 2020
@stale stale bot removed the status/stale label Apr 5, 2020
@deviantony
Copy link
Member

Also re-opening this issue.

@ghost
Copy link

ghost commented Apr 6, 2020

Since the opening of this issue, VSTS became Azure DevOps. So to test this I went and set up an Azure repo and tried to deploy a stack from it, but I keep getting Deployment error {"message":"Unable to clone git repository","details":"authentication required"}.
@mateuszdrab is this the error you are receiving or am I doing something wrong?

Additional Info:

  • I created git credentials including a PAT using the Azure repo GUI and have entered this in Portainer.
  • My HTTPS clone url is https://****@dev.azure.com/****/Portainer-testing/_git/Portainer-testing where **** is the name of my Azure organization.
  • Cloning with the same url and credentials from the CLI works fine.

@ghost
Copy link

ghost commented Apr 6, 2020

@deviantony have you reproduced?

@ghost ghost added the bug/need-confirmation label Apr 6, 2020
@deviantony
Copy link
Member

I did not reproduce as I do not have any VSTS related environment. Re-opening for the binary usage consideration.

@mateuszdrab
Copy link

mateuszdrab commented Apr 6, 2020

@itsconquest I think you neeed to take out the credentials from the URL and put it in the authentication section within portainer. Then you should see error 400 - the issue I'm experiencing also. When using the PAT, you can put anything for the username, and the PAT for the password.

@ghost
Copy link

ghost commented Apr 6, 2020

Ah yes it seems that I can indeed reproduce this including the appending of /git-upload-pack to the url in 1.23.2. Thanks for the tip!

@deviantony
Copy link
Member

Closed via #5070

xAt0mZ pushed a commit that referenced this issue Aug 25, 2022
)

* merge capabilities changes from Chaim

* refactor(docker/switch/component): implement new design [EE=3688]

* code review issues

* merge code

* feat(ui): UI improvements node details screen EE-3468 (#1926)

* merge code

* fix encode secret toggle bug on adding secret page

* fixed a bug for service webhook toggle
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants