Closed ipavlovi closed 4 years ago
Sounds like you have tried everything I can think of. But, interestingly I had a similar issue myself yesterday
We tried everything we could think of, with no luck finding a real solution.
In the end, and it was a work around, what we did was to add a separate agent stage to the pipeline stage to do the release generation and wiki upload and got this to be run by a hosted agent. Would this work for you?
But this is a workaround but not a solution.
This task uses Simple-Git to do the upload, the task just wrappers this. The only way I can think of to move this forward is to do some local testing of Simple-Git a failing agent. Unfortunately, I don't have access to such an agent.
Oh, sorry forgot to say there is one thing extra to try switch on the inject header option to true. This can help if proxies are in the way. It was added to fix an issue for on premises TFS setups, but it is worth a try
Look like there is a work around the Git, at least if content should be published to AzureDevops Wiki
I can push new page to Wiki using PS and DevOps API but that is exactly what I wanted to avoid by using WIKIUpdater task.
I will keep on trying to find solution for the original problem
I have tried Inject Header option but it failed with the same error message
I think I have found the cause of the problem
Environment PATH variable had C:\Program Files\Git\cmd\
entry but C:\Program Files\Git\
was missing.
After Adding 'C:\Program Files\Git\' to the path and restarting agent service deployment was successful.
I am not 100% sure yet. Let me check it on another environment as well before closing this issue
I was wrong.
The correct solution is to add C:\agent\externals\git\cmd
to the Environment Path on agent machine. Previous solution will work only if Git is installed separately.
It seems that simple-git is sending git commands to console and console cannot resolve path to git.exe because it is not in the environment path.
Thanks for the excellent analysis. I will add it to the wiki notes in a troubleshooting section
New troubleshooting notes in WIKI with 1.12.3
I was wrong.
The correct solution is to add
C:\agent\externals\git\cmd
to the Environment Path on agent machine. Previous solution will work only if Git is installed separately.It seems that simple-git is sending git commands to console and console cannot resolve path to git.exe because it is not in the environment path.
We have the exact same problem here. Git is missing in the enviroment path variable. Can someone tell me, how I can add the Git-Path to the agent path variable?
I assume you are using the hosted agents, as if it is private agent you can just update the path in the standard manner via the control panel for all users.
If it is hosted agent, then you need to make the change at runtime. The path is only an environmental variable, so you could try the process outlined here
No, we are using private agents. I assume we are talking about the System capabilities of the agent, right? When I navigate to our Agent pools and then check agents capabilities, the Path variable doesn't contain a path to the git directory. And I can't update any variable in this control panel, since everything is locked. Am I trying to fix it in the wrong place?
You can use the Windows UI to edit the path for all users
You can set the path here for all users on that machine
So I was completely wrong :D Works like a charm now. Thank you.
In case it helps anyone, I had this in a pipeline when using an Ubuntu VM, and the easiest fix was to switch to windows-latest, because that latter has the path to GIT already set up.
Maybe I'm not commenting in the right issue, but I'm also facing the same problem, but under an Ubuntu Hosted Agent. Any plan to make this task work on Linux? I know using the image windows-latest is the workaround, but we're trying to exclusively use linux machines inside our build agents to reduce the overall execution time.
@ddprince-yaksa you have a new issue it is best to start a new discussion or issue with details of your problem.
This thread was about the WIKI Updater, this already support Windows, Linux and Max agents - but this that the task you are using?
@rfennell yes this is the task we're using. I'm having the issue described here under an Ubuntu agent. I can open a new issue if you want!
So your problem is that the task cannot fine the instance of the Git command line tool?
I assume this is on an on premise Ubuntu agent, as I have tested this task with the Microsoft hosted Ubuntu agents. If that is the case, the fix is the same a Windows, make sure Git is installed on the agent and it is in the path
If that does not sort it, might be best to log a new issues with a details debug log (run with the variable system.debug=true
set)
@rfennell this is not an on premise agent, we're using the Microsoft Hosted Agent. I'm currently getting the details and I can get back to you. Which information from the debug output would you like to see?
The whole debug output for the task, the following is what I expect to see for a Ubuntu agent
##[debug]updateOrderFile=true
##[debug]orderFilePath=undefined
##[debug]injecttoc=False
Variable: Repo [dev.azure.com/richardfennell/Git%20project/_git/Git-project.wiki]
Variable: Filename [TestPageWithCreds-10703.md]
Variable: Contents [Header
---
**Build Number**: 10703`n**Build Trigger PR Number**: `n`n# Global list of WI (0)`n`n# Global list of CS (1)`n### Associated commits (only shown if CS) `n* ** ID6b7059ed94faa2e0105fe4ad9b4784bbb7ff472d**`n - **Message:** Documentation update (#1472)`n - **Commited by:** rfennell`n
---
Footer]
Variable: Commit Message [Update from Release - $(Release.ReleaseName) with Creds]
Variable: Git Username [builduser]
Variable: Git Email [build@demo]
Variable: Use Agent Token [false]
Variable: Replace File [true]
Variable: Append to File [true]
Variable: Username [richardfennell]
Variable: Password [*****]
Variable: LocalPath [D:\a\1\s\azurerepowithcreds]
Variable: Data Is File [false]
Variable: SourceFile [undefined]
Variable: Tag Repo [false]
Variable: Tag [undefined]
Variable: Branch [undefined]
Variable: InjectExtraHeader [false]
Variable: SslBackend [undefined]
Variable: Retries [5]
Variable: trimLeadingSpecialChar [false]
Variable: fixLineFeeds [true]
Variable: fixSpaces [false]
Variable: insertLinefeed [false]
Variable: updateOrderFile [true]
Variable: prependEntryToOrderFile [false]
Variable: orderFilePath [undefined]
Variable: injecttoc [false]
The provided repo URL is dev.azure.com/richardfennell/Git%20project/_git/Git-project.wiki
The protocol is https
The provided repo URL is dev.azure.com/richardfennell/Git%20project/_git/Git-project.wiki
Trimmed the URL to dev.azure.com/richardfennell/Git%20project/_git/Git-project.wiki
URL used https://richardfennell:***@dev.azure.com/richardfennell/Git%20project/_git/Git-project.wiki
Cleaned D:\a\1\s\azurerepowithcreds
Cloned dev.azure.com/richardfennell/Git%20project/_git/Git-project.wiki to D:\a\1\s\azurerepowithcreds
Set GIT values in D:\a\1\s\azurerepowithcreds
No sub-directory passed change to D:\a\1\s\azurerepowithcreds
Pull in case of post clone updates from other users
Working file name is TestPageWithCreds-10703.md
Created the 'TestPageWithCreds-10703.md' in 'D:\a\1\s\azurerepowithcreds' - fixing line-endings
Added TestPageWithCreds-10703.md to repo D:\a\1\s\azurerepowithcreds
Using the file - D:\a\1\s\azurerepowithcreds/.order
Attempting to updating the existing .order file
Appending entry to the .order file
Added .order file to repo D:\a\1\s\azurerepowithcreds
##[debug]Committing the changes with the message: Update from Release - $(Release.ReleaseName) with Creds
Committed file "D:\a\1\s\azurerepowithcreds" with message "Update from Release - $(Release.ReleaseName) with Creds" as SHA ead54bbd8764e79031ef6dedc645bbfcfde25d9e
Attempt 1 - Push to dev.azure.com/richardfennell/Git%20project/_git/Git-project.wiki
Push completed
Finishing: Git based WIKI Updater - Azure DevOps with Creds update .order file
@rfennell please see attached. 93.txt
I confirm the following agent is used for the task: Pool: Azure Pipelines Image: ubuntu-latest Agent: Hosted Agent
@ddprince-yaksa this is getting too complex to handle in a side chat - now being tracked in #1473
Release notes are successful generated but in the next step publish to Azure DevOps Wiki fails with following error:
tasklog_18.log
YAML Definition
I am getting the same outcome no matter I am using username and PAT, OAUTH token, or if credentials are passed via Header.
Agent Info
I have successfully tested the same task group using both azure-hosted and self-hosted agents with out any problems using OAUTH token. All release notes were successful published to the same git repo.
Once tests were all good I have added the same taskgroup to stages for our production environments.
Self-hosted agents on both test and production environments are configured to run under local admin account as windows service.
PAT issued for agents have full access to Azure DevOps.
Other info