Closed johlju closed 3 years ago
With the fix in PR #96 this correctly fails now.
2021-08-05T09:17:03.4468068Z Publishing Wiki content.
2021-08-05T09:17:03.4523393Z VERBOSE: Creating a temporary working directory.
2021-08-05T09:17:03.4636211Z VERBOSE: Cloning the Wiki Git Repository 'https://github.com/dsccommunity/DscResource.DocGenerator.wiki.git'.
2021-08-05T09:17:04.7094431Z VERBOSE: git standard output: ''
2021-08-05T09:17:04.7105226Z VERBOSE: git standard error: 'Cloning into 'C:\Users\VssAdministrator\AppData\Local\Temp\400ntr4j.p5o'...
2021-08-05T09:17:04.7105850Z '
2021-08-05T09:17:04.7112247Z VERBOSE: git exit code: '0'
2021-08-05T09:17:04.7119990Z DEBUG: Command: git clone https://github.com/dsccommunity/DscResource.DocGenerator.wiki.git C:\Users\VssAdministrator\AppData\Local\Temp\400ntr4j.p5o
2021-08-05T09:17:04.7126034Z DEBUG: git Working Directory: 'C:\Users\VssAdministrator\AppData\Local\Temp\400ntr4j.p5o'
2021-08-05T09:17:04.7182624Z VERBOSE: Copying Wiki files from 'D:\a\1\s\output\WikiContent'.
2021-08-05T09:17:04.7215169Z VERBOSE: Copying file 'Home.md' to the Wiki.
2021-08-05T09:17:04.7309005Z VERBOSE: Generating Wiki Sidebar '_Sidebar.md'.
2021-08-05T09:17:04.7345998Z VERBOSE: Adding file 'Home.md' to the Wiki Sidebar.
2021-08-05T09:17:04.7414338Z VERBOSE: Configuring local Git settings.
2021-08-05T09:17:04.7782697Z VERBOSE: git standard output: ''
2021-08-05T09:17:04.7785722Z VERBOSE: git standard error: ''
2021-08-05T09:17:04.7788804Z VERBOSE: git exit code: '0'
2021-08-05T09:17:04.7793926Z DEBUG: Command: git config --local user.email dsccommunity@outlook.com
2021-08-05T09:17:04.7797609Z DEBUG: git Working Directory: 'C:\Users\VssAdministrator\AppData\Local\Temp\400ntr4j.p5o'
2021-08-05T09:17:04.8153655Z VERBOSE: git standard output: ''
2021-08-05T09:17:04.8156973Z VERBOSE: git standard error: ''
2021-08-05T09:17:04.8160115Z VERBOSE: git exit code: '0'
2021-08-05T09:17:04.8165798Z DEBUG: Command: git config --local user.name dscbot
2021-08-05T09:17:04.8169430Z DEBUG: git Working Directory: 'C:\Users\VssAdministrator\AppData\Local\Temp\400ntr4j.p5o'
2021-08-05T09:17:04.8537503Z VERBOSE: git standard output: ''
2021-08-05T09:17:04.8540399Z VERBOSE: git standard error: ''
2021-08-05T09:17:04.8543958Z VERBOSE: git exit code: '0'
2021-08-05T09:17:04.8549327Z DEBUG: Command: git remote set-url origin https://dscbot:***@github.com/dsccommunity/DscResource.DocGenerator.wiki.git
2021-08-05T09:17:04.8550913Z DEBUG: git Working Directory: 'C:\Users\VssAdministrator\AppData\Local\Temp\400ntr4j.p5o'
2021-08-05T09:17:04.8566535Z VERBOSE: Adding the Wiki Content to the Git Repository.
2021-08-05T09:17:04.9202514Z VERBOSE: git standard output: ''
2021-08-05T09:17:04.9211187Z VERBOSE: git standard error: ''
2021-08-05T09:17:04.9216110Z VERBOSE: git exit code: '0'
2021-08-05T09:17:04.9224278Z DEBUG: Command: git add *
2021-08-05T09:17:04.9227802Z DEBUG: git Working Directory: 'C:\Users\VssAdministrator\AppData\Local\Temp\400ntr4j.p5o'
2021-08-05T09:17:04.9247868Z VERBOSE: Committing the changes to the Repository and adding build tag '0.10.0-debug'.
2021-08-05T09:17:05.0453028Z VERBOSE: git standard output: '[master a6269b6] Updating Wiki with the content for module version '0.10.0-debug'.
2021-08-05T09:17:05.0453939Z 1 file changed, 1 insertion(+), 1 deletion(-)
2021-08-05T09:17:05.0454415Z '
2021-08-05T09:17:05.0457574Z VERBOSE: git standard error: ''
2021-08-05T09:17:05.0460380Z VERBOSE: git exit code: '0'
2021-08-05T09:17:05.0464952Z DEBUG: Command: git commit --message "Updating Wiki with the content for module version '0.10.0-debug'."
2021-08-05T09:17:05.0467950Z DEBUG: git Working Directory: 'C:\Users\VssAdministrator\AppData\Local\Temp\400ntr4j.p5o'
2021-08-05T09:17:05.0482955Z VERBOSE: Pushing the updated Repository to the Git Wiki.
2021-08-05T09:17:05.1282940Z VERBOSE: git standard output: ''
2021-08-05T09:17:05.1286563Z VERBOSE: git standard error: ''
2021-08-05T09:17:05.1289890Z VERBOSE: git exit code: '0'
2021-08-05T09:17:05.1302304Z DEBUG: Command: git tag --annotate 0.10.0-debug --message 0.10.0-debug
2021-08-05T09:17:05.1307762Z DEBUG: git Working Directory: 'C:\Users\VssAdministrator\AppData\Local\Temp\400ntr4j.p5o'
2021-08-05T09:17:07.8871747Z VERBOSE: git standard output: ''
2021-08-05T09:17:07.8875850Z VERBOSE: git standard error: 'remote: Invalid username or password.
2021-08-05T09:17:07.8876473Z fatal: Authentication failed for 'https://github.com/dsccommunity/DscResource.DocGenerator.wiki.git/'
2021-08-05T09:17:07.8876909Z '
2021-08-05T09:17:07.8879762Z VERBOSE: git exit code: '128'
2021-08-05T09:17:07.8884268Z DEBUG: Command: git push origin
2021-08-05T09:17:07.8887217Z DEBUG: git Working Directory: 'C:\Users\VssAdministrator\AppData\Local\Temp\400ntr4j.p5o'
2021-08-05T09:17:08.2210834Z ERROR: Command: git push origin
2021-08-05T09:17:08.2211347Z git exit code: '128'
2021-08-05T09:17:08.2211731Z git standard output: ''
2021-08-05T09:17:08.2212148Z git standard error: 'remote: Invalid username or password.
2021-08-05T09:17:08.2212686Z fatal: Authentication failed for 'https://github.com/dsccommunity/DscResource.DocGenerator.wiki.git/'
2021-08-05T09:17:08.2213125Z '
2021-08-05T09:17:08.2213221Z
2021-08-05T09:17:08.2213680Z At D:\a\1\s\output\DscResource.DocGenerator\0.10.0\DscResource.DocGenerator.psm1:2779 char:13
2021-08-05T09:17:08.2214157Z + throw $throwMessage
2021-08-05T09:17:08.2214508Z + ~~~~~~~~~~~~~~~~~~~
2021-08-05T09:17:08.2318816Z At D:\a\1\s\source\tasks\Publish_GitHub_Wiki_Content.build.ps1:102 char:1
2021-08-05T09:17:08.2319505Z + task Publish_GitHub_Wiki_Content {
2021-08-05T09:17:08.2320045Z + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2021-08-05T09:17:08.2454508Z Build FAILED. 1 tasks, 1 errors, 0 warnings 00:00:15.9882497
2021-08-05T09:17:08.2761457Z Command: git push origin
2021-08-05T09:17:08.2762020Z git exit code: '128'
2021-08-05T09:17:08.2763034Z git standard output: ''
2021-08-05T09:17:08.2763490Z git standard error: 'remote: Invalid username or password.
2021-08-05T09:17:08.2764509Z fatal: Authentication failed for 'https://github.com/dsccommunity/DscResource.DocGenerator.wiki.git/'
2021-08-05T09:17:08.2764954Z '
2021-08-05T09:17:08.2765803Z At D:\a\1\s\output\DscResource.DocGenerator\0.10.0\DscResource.DocGenerator.psm1:2779 char:13
2021-08-05T09:17:08.2766328Z + throw $throwMessage
2021-08-05T09:17:08.2767024Z + ~~~~~~~~~~~~~~~~~~~
2021-08-05T09:17:08.2773244Z + CategoryInfo : OperationStopped: (Command: git push o…rator.wiki.git/'
2021-08-05T09:17:08.2773896Z '
2021-08-05T09:17:08.2774209Z :String) [], RuntimeException
2021-08-05T09:17:08.2774584Z + FullyQualifiedErrorId : Command: git push origin
2021-08-05T09:17:08.2774970Z git exit code: '128'
2021-08-05T09:17:08.2775672Z git standard output: ''
2021-08-05T09:17:08.2776052Z git standard error: 'remote: Invalid username or password.
2021-08-05T09:17:08.2776600Z fatal: Authentication failed for 'https://github.com/dsccommunity/DscResource.DocGenerator.wiki.git/'
2021-08-05T09:17:08.2777007Z '
2021-08-05T09:17:08.3915801Z ##[error]PowerShell exited with code '1'.
2021-08-05T09:17:08.5227001Z ##[section]Finishing: Run Publish_GitHub_Wiki_Content
Details of the scenario you tried and the problem that is occurring
When the content is published (pushed) to the GitHub repository Wiki git repository it never fails if there is an invalid or expired token.
Steps to reproduce the problem
Add a debug stage to the
azure-pipelines.yml
after the stageBuild
. This pipeline job set a fake token and starts the correct task.On the lines:
https://github.com/dsccommunity/DscResource.DocGenerator/blob/d79b4247eb69e6bc80d8141ff09f45232b275ffe/source/tasks/Publish_GitHub_Wiki_Content.build.ps1#L197-L198
Temporary hard-code to the real GitHub repository Wiki git repository repo:
Expected behavior
The task should fail if an error is encountered, especially when pushing to a repo with an invalid token.
Current behavior
Passes without any error. Below is pipeline output when running with the debug stage above.
Suggested solution to the issue
We should, at minimum, add error handling here:
https://github.com/dsccommunity/DscResource.DocGenerator/blob/d79b4247eb69e6bc80d8141ff09f45232b275ffe/source/Public/Publish-WikiContent.ps1#L162-L166
The operating system the target node is running
Ubuntu or Windows.
Version and build of PowerShell the target node is running
7.x
Version of the module that was used
v0.9.0-preview0009