Build hanging in 'on_success' during git push
I am trying to push some markdown files to a GitHub wiki. I have successfully cloned the wiki repo, added and committed the new files, but the process seems to hang while pushing to GitHub. I gave all permissions for the token on GitHub. On my local machine, the files are pushed normally and almost immediately. This forum discussion (https://help.appveyor.com/discussions/problems/270-why-is-the-build...) suggests that some prompt may be causing the error, but I am not sure that this is indeed the problem, my machine does not prompt me anything. I have added some
git status through the process to figure out what is going on, but the results are inconclusive to me, everything seems to be normal up to the last line
This is the last failing build, after 1 hour the workflow timeouts marking build as failure.
The following is my yml file on_success section:
on_success: - git config --global credential.helper store - ps: Add-Content "$HOME\.git-credentials" "https://$($env:access_token):firstname.lastname@example.org`n" - git config --global user.email "[email blocked]" - git config --global user.name "Leandro Luciani Tavares" - md C:\projects\wiki - cd C:\projects\wiki - git clone https://github.com/leandroltavares/GreenUtil.wiki.git - cd GreenUtil.wiki - git status - C:\projects\greenutil\Assets\MarkdownGenerator.exe C:\projects\greenutil\GreenUtil\bin\Release\net471\GreenUtil.dll "C:\projects\wiki\GreenUtil.wiki" - git status - git add . - git status - git commit -m "Commiting wiki changes" - git status - git push
What am I missing?
Comments are currently closed for this discussion. You can start a new one.
|?||Show this help|
|ESC||Blurs the current field|
|r||Focus the comment reply box|
|^ + ↩||Submit the comment|
You can use
Command ⌘ instead of
Control ^ on Mac
Support Staff 1 Posted by Owen McDonnell on 29 Jun, 2018 09:58 PM
access_tokenenvironment variable you are using straight from github or has it been encrypted (hopefully the latter)?
If it has been encrypted make sure you're doing so from the same account your building on and syntax should be,
2 Posted by Leandro Tavares on 29 Jun, 2018 11:16 PM
Yes, hopefully, it was encrypted with the same account the build is running. I have made a mistake and forgot to add the
secure:tag before the encrypted token. I have just fixed the YML on build 1.0.61 ( https://ci.appveyor.com/project/leandroltavares/greenutil/build/1.0.61 ) to be as you pointed out
But the hanging issue persists. The full YML file can be seen at https://github.com/leandroltavares/GreenUtil/blob/master/appveyor.yml
Somehow, I think the credentials on my local machine are being cached from somewhere (maybe the GitHub desktop client). And I am not being able to provide them properly to the git CLI on the CI server. Is there an away to check and debug this? And also check if there is any prompt after the
Support Staff 3 Posted by Owen McDonnell on 29 Jun, 2018 11:26 PM
It definitely would be a good idea to RDP to the build worker.That way you'll be able to check if that github credential is being added as you expect.
I would recommend adding this line after adding the git credential in the
You'll also be able to check if there are any prompts blocking progress.
4 Posted by Leandro Tavares on 03 Jul, 2018 03:20 PM
I have accessed the RDP and no prompt window is displayed. I have also checked the
C:\Users\appveyorfolder. And as the print show the token was properly added (I omitted the token data). The build still hangs on the CI server at the
I have tested the script locally, and git CLI sometimes prints some errors on the StdErr that caused the build to fail. I have suppressed the output with the
-qoption. Locally, doing this was enough to solve the problem. The
git pushcommand on my machine returns almost immediately.
The following is the publishing PowerShell script to GitHub wiki:
Support Staff 5 Posted by Owen McDonnell on 03 Jul, 2018 09:09 PM
And you are definitely not using SSH keys to authenticate from your local machine?
Support Staff 6 Posted by Owen McDonnell on 04 Jul, 2018 05:50 AM
Also, can you try to RDP the same way as before (after the git credential is added) and do all of the git cloning, patching, committing and pushing from the RDP session.
7 Posted by Leandro Tavares on 04 Jul, 2018 02:14 PM
I did what you suggested. I have added a sleep to keep the RDP session open and I executed the script manually. It ran to completion with success. All MD files were pushed to GitHub wiki properly with no hanging. You can see the result at (https://github.com/leandroltavares/GreenUtil/wiki). I have attached the output from the PowerShell ISE. I noticed is that the
.git-credentialsfile did not exist on
C:\Users\appveyor\before the script. The file was created during the script execution and the token was added. (as the previous screenshot shown).
If the script works from the PS ISE, it should work from the CI agent, right? May it be a permission issue? (But, at the best of my knowledge, the RDP session user is the same for the build agent)
Support Staff 8 Posted by Owen McDonnell on 04 Jul, 2018 04:12 PM
I have followed your steps very closely in this test project, with no problems (i'm making a trivial commit to the projects own wiki). Unless you can see something in it that significantly differentiates it
How about as a test you try making a trivial commit to some other repository you own. That way we will know for certain that the process itself is working for you as it is for me in the test project i linked to above..
9 Posted by Leandro Tavares on 04 Jul, 2018 07:59 PM
I have checked your script and I saw that it is very similar to mine. First, I changed the script to append a simple text to the Home.md (as you did). It did not work for the current wiki, so I changed the test to commit to another wiki repository. Same behavior, when running the full process through the build agent git push hangs. But, running the script inside the RDP session make it work. Do you think it is necessary any other setup? Btw, what permissions do you have set for the token? I granted it the full access. May it be something regarding git version? I ran the
git --versionand it returned
2.17.1.windows.2(we both are using the same VM image, but just in case to confirm)
Support Staff 10 Posted by Owen McDonnell on 05 Jul, 2018 12:30 AM
The token i use only has "repo" permissions.
I can't imagine granting all permissions could possibly do anything to interrupt this process...
Still, as this issue is really starting to stump me, do you mind generating a new token with those same permissions and trying again.
11 Posted by Leandro Tavares on 05 Jul, 2018 01:39 AM
Created a new token only with the "repo" permission, same behavior. On the agent it stucks in the git push, but in the RDP session, it works. May it be a different version of git.exe?
Support Staff 12 Posted by Owen McDonnell on 06 Jul, 2018 02:12 AM
By the looks of it, you got your build to push to github successfully. If so, did you determine what was causing the problem?
13 Posted by Leandro Tavares on 06 Jul, 2018 12:16 PM
Unfortunately, it didn´t work. I have accessed the RDP session and killed the
git-remote-https. I am still trying to figure out an way to make it work.
Support Staff 14 Posted by Owen McDonnell on 06 Jul, 2018 11:52 PM
I cloned your project but was still unable to reproduce this issue.
In order to move forward in troubleshooting this you'll need to create a test project that reproduces this error and make me a collaborator on your account.
Then you can create a temporary GitHub key and put all the settings (including that key) for the project in the UI so that i can make changes to them.
Ilya Finkelshteyn closed this discussion on 06 Sep, 2018 09:00 PM.