Encoding/locale gitlab runner 机器
Encoding/locale of gitlab runner machine
我已经在 winserver 2016 上安装了 GitLab runner。
一切正常,除了 gitlab 上的 runner 输出。
winserver 的语言环境是 RU。
我正在尝试使用 MSBUILD 构建项目,它输出俄语字符:
Checking out e5ec41d1 as release-2...
Skipping Git submodules setup
$ echo "начинается билд %PROJECT_NAME%"
"начинается билд PEPSolution"
$ echo "Релизная сборка... "
"Релизная сборка... "
$ "C:\Program Files ^(x86^)\MSBuild.0\Bin\amd64\MSBuild.exe" /consoleloggerparameters:ErrorsOnly /maxcpucount /nologo /property:Configuration=Release /verbosity:quiet "%PROJECT_NAME%.sln"
C:\Program Files (x86)\MSBuild.0\bin\amd64\Microsoft.Common.CurrentVersion.targets(2398,5): error MSB3091: ������ �� �믮�����, ⠪ ��� �� �����㦥�
yml
文件中的俄语符号显示正确。但是 MSBUILD 的输出是错误的
所以问题是:
- 如何让它正确显示?
- 我可能违反了一些最佳实践?
此致
找到最终解决方案!
只需添加
- chcp 65001
在调用 msbuild 之前进入 yml 文件
它告诉将 cmd 的默认代码页更改为 utf8
在 "stages:" 命令之前添加 "before_script:"
中的“- CHCP 65001”
before_script:
- CHCP 65001
stages:
- build
- test
- deploy
...
我有同样的问题(Windows 10 Home for one language - russian, v.1903, build 18362.535)。
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[=10=]\ga ...
10 + ~~~~~
11 + CategoryInfo : ObjectNotFound: (git:String) [], CommandNotFoundException
12 + FullyQualifiedErrorId : CommandNotFoundException
13
14 cd : �� 㤠���� ����� ���� "C:\<user>\GitLab-Runner\builds\vzC5L735[=10=]\<user>\test_unity_ci_project", ⠪ ��� �� ��
15 ����������.
16 C:\WINDOWS\TEMP\build_script063808752\script.ps1:159 ����:1
17 + cd "C:\<user>\GitLab-Runner\builds\vzC5L735[=10=]\<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
我已经为非 unicode 程序设置了语言:
控制面板 -> 区域标准 -> 附加 -> 非 unicode 程序的语言 -> 更改系统语言 -> 更改为 'English (USA)' -> 重新启动。
scr1
scr2
之后我得到了正确的 gitlab runner 消息:
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[=11=]\ga ...
12 + ~~~~~
13 + CategoryInfo : ObjectNotFound: (git:String) [], CommandNotFoundException
14 + FullyQualifiedErrorId : CommandNotFoundException
15
17 cd : Cannot find path 'C:\<user>\GitLab-Runner\builds\vzC5L735[=11=]\<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[=11=]\<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
我已经在 winserver 2016 上安装了 GitLab runner。
一切正常,除了 gitlab 上的 runner 输出。
winserver 的语言环境是 RU。
我正在尝试使用 MSBUILD 构建项目,它输出俄语字符:
Checking out e5ec41d1 as release-2...
Skipping Git submodules setup
$ echo "начинается билд %PROJECT_NAME%"
"начинается билд PEPSolution"
$ echo "Релизная сборка... "
"Релизная сборка... "
$ "C:\Program Files ^(x86^)\MSBuild.0\Bin\amd64\MSBuild.exe" /consoleloggerparameters:ErrorsOnly /maxcpucount /nologo /property:Configuration=Release /verbosity:quiet "%PROJECT_NAME%.sln"
C:\Program Files (x86)\MSBuild.0\bin\amd64\Microsoft.Common.CurrentVersion.targets(2398,5): error MSB3091: ������ �� �믮�����, ⠪ ��� �� �����㦥�
yml
文件中的俄语符号显示正确。但是 MSBUILD 的输出是错误的
所以问题是:
- 如何让它正确显示?
- 我可能违反了一些最佳实践?
此致
找到最终解决方案!
只需添加
- chcp 65001
在调用 msbuild 之前进入 yml 文件
它告诉将 cmd 的默认代码页更改为 utf8
在 "stages:" 命令之前添加 "before_script:"
中的“- CHCP 65001”before_script:
- CHCP 65001
stages:
- build
- test
- deploy
...
我有同样的问题(Windows 10 Home for one language - russian, v.1903, build 18362.535)。
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[=10=]\ga ...
10 + ~~~~~
11 + CategoryInfo : ObjectNotFound: (git:String) [], CommandNotFoundException
12 + FullyQualifiedErrorId : CommandNotFoundException
13
14 cd : �� 㤠���� ����� ���� "C:\<user>\GitLab-Runner\builds\vzC5L735[=10=]\<user>\test_unity_ci_project", ⠪ ��� �� ��
15 ����������.
16 C:\WINDOWS\TEMP\build_script063808752\script.ps1:159 ����:1
17 + cd "C:\<user>\GitLab-Runner\builds\vzC5L735[=10=]\<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
我已经为非 unicode 程序设置了语言: 控制面板 -> 区域标准 -> 附加 -> 非 unicode 程序的语言 -> 更改系统语言 -> 更改为 'English (USA)' -> 重新启动。
scr1
scr2
之后我得到了正确的 gitlab runner 消息:
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[=11=]\ga ...
12 + ~~~~~
13 + CategoryInfo : ObjectNotFound: (git:String) [], CommandNotFoundException
14 + FullyQualifiedErrorId : CommandNotFoundException
15
17 cd : Cannot find path 'C:\<user>\GitLab-Runner\builds\vzC5L735[=11=]\<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[=11=]\<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