问题
I have setup GitLab runner on winserver 2016.
Everything works fine, except output of runner on gitlab.
Locale of winserver is RU.
I'm trying to build projects with MSBUILD, which outputs russian characters:
Checking out e5ec41d1 as release-2...
Skipping Git submodules setup
$ echo "начинается билд %PROJECT_NAME%"
"начинается билд PEPSolution"
$ echo "Релизная сборка... "
"Релизная сборка... "
$ "C:\Program Files ^(x86^)\MSBuild\14.0\Bin\amd64\MSBuild.exe" /consoleloggerparameters:ErrorsOnly /maxcpucount /nologo /property:Configuration=Release /verbosity:quiet "%PROJECT_NAME%.sln"
C:\Program Files (x86)\MSBuild\14.0\bin\amd64\Microsoft.Common.CurrentVersion.targets(2398,5): error MSB3091: ������ �� �믮�����, ⠪ ��� �� �����㦥�
Russian symbols from yml
file are displayed correctly. But from output of MSBUILD is wrong
So questions are:
- How to make it to show in correctly?
- May be I violate some best practices?
Regards
回答1:
Add before "stages:" command "- CHCP 65001" in "before_script:"
before_script:
- CHCP 65001
stages:
- build
- test
- deploy
...
回答2:
Found finaly solution!
just add
- chcp 65001
into yml file before calling msbuild
it tells change default codepage of cmd to utf8
回答3:
I have same issue (Windows 10 Home for one language - russian, v.1903, build 18362.535).
Result of gitlab runner:
1 Running with gitlab-runner 12.6.0 (ac8e767a)
2 on gitlab-unity-runner vzC5L735
3 Using Shell executor...
4 Running on DESKTOP-LOSJ2JN...
5 Fetching changes with git depth set to 50...
6 & : ��� "git" �� ��ᯮ����� ��� ��� ����������, �㭪樨, 䠩�� �業���� ��� �믮��塞�� �ணࠬ��. ������ �ࠢ��쭮�
7 �� ����ᠭ�� �����, � ⠪�� ����稥 � �ࠢ��쭮��� ����, �� 祣� ��������� �������.
8 C:\WINDOWS\TEMP\build_script960183957\script.ps1:163 ����:3
9 + & "git" "config" "-f" "C:\<user>\GitLab-Runner\builds\vzC5L735\0\ga ...
10 + ~~~~~
11 + CategoryInfo : ObjectNotFound: (git:String) [], CommandNotFoundException
12 + FullyQualifiedErrorId : CommandNotFoundException
13
14 cd : �� 㤠���� ����� ���� "C:\<user>\GitLab-Runner\builds\vzC5L735\0\<user>\test_unity_ci_project", ⠪ ��� �� ��
15 ����������.
16 C:\WINDOWS\TEMP\build_script063808752\script.ps1:159 ����:1
17 + cd "C:\<user>\GitLab-Runner\builds\vzC5L735\0\<user>\test_unity_c ...
18 + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
19 + CategoryInfo : ObjectNotFound: (C:\<user>\Git...nity_ci_project:String) [Set-Location], ItemNotFoundE
20 xception
21 + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.SetLocationCommand
22
23 ERROR: Job failed: exit status 1
I've set language for non unicode programs: Control panel -> Regional standards -> Additional -> Language for non unicode programs -> Change system language -> change to 'English (USA)' -> reboot.
scr1
scr2
After that I've got correct gitlab runner message:
1 Running with gitlab-runner 12.6.0 (ac8e767a)
2 on gitlab-unity-runner vzC5L735
3 Using Shell executor...
5 Running on DESKTOP-LOSJ2JN...
7 Fetching changes with git depth set to 50...
8 & : The term 'git' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spe
9 lling of the name, or if a path was included, verify that the path is correct and try again.
10 At C:\WINDOWS\TEMP\build_script179741393\script.ps1:163 char:3
11 + & "git" "config" "-f" "C:\<user>\GitLab-Runner\builds\vzC5L735\0\ga ...
12 + ~~~~~
13 + CategoryInfo : ObjectNotFound: (git:String) [], CommandNotFoundException
14 + FullyQualifiedErrorId : CommandNotFoundException
15
17 cd : Cannot find path 'C:\<user>\GitLab-Runner\builds\vzC5L735\0\<user>\test_unity_ci_project' because it does not
18 exist.
19 At C:\WINDOWS\TEMP\build_script677283324\script.ps1:159 char:1
20 + cd "C:\<user>\GitLab-Runner\builds\vzC5L735\0\<user>\test_unity_c ...
21 + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
22 + CategoryInfo : ObjectNotFound: (C:\<user>\Git...nity_ci_project:String) [Set-Location], ItemNotFoundE
23 xception
24 + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.SetLocationCommand
25
27 ERROR: Job failed: exit status 1
来源:https://stackoverflow.com/questions/49295637/encoding-locale-of-gitlab-runner-machine