使用 chocolatey 在 windows 上安装 gitlab-runner
Installation gitlab-runner on windows with chocolatey
我正在尝试使用 chocolatey 在 windows 上部署 gitlab-runner。
我的意图是在E:\gitlab-runner
目录下安装gitlab-runner,自动注册runner并作为服务启动
我执行了以下行:
choco install -y gitlab-runner /InstallDir E:\gitlab-runner /Service --source https://mynexusproxy/repository/chocolatey-org/
我得到了以下输出:
Chocolatey v0.10.11
Installing the following packages:
gitlab-runner;/InstallDir;E:\gitlab-runner;/Service
By installing you accept licenses for the packages.
Progress: Downloading gitlab-runner 11.8.0... 100%
gitlab-runner v11.8.0
gitlab-runner package files install completed. Performing other installation steps.
Using previous gitlab-runner install path: e:\gitlab-runner
Installing x64 bit version
Added C:\ProgramData\chocolatey\bin\gitlab-runner.exe shim pointed to 'e:\gitlab-runner\gitlab-runner.exe'.
The install of gitlab-runner was successful.
Software install location not explicitly set, could be in package or
default install location if installer.
Second path fragment must not be a drive or UNC name.
Parameter name: path2
gitlab-runner.exe在E:\gitlab-runner
中正确下载,但是没有完成注册,也没有创建服务。 register_example.ps1也在E:\gitlab-runner
.
下载
我的安装过程有什么问题?我需要用自定义值修改 register_example.ps1 吗?
很遗憾,这个特定的包在描述中没有提供示例来说明如何正确传递包参数。但是,您可以在此处找到更多信息以及如何执行此操作的示例:
https://chocolatey.org/docs/how-to-parse-package-parameters-argument
我相信您会想要类似于以下的命令:
choco install -y gitlab-runner --params="'/InstallDir=E:\gitlab-runner /Service'" --source https://mynexusproxy/repository/chocolatey-org/
否则,您尝试传递的参数将被忽略。
@Gary Ewan Park 提供的命令很好,但不足以完全管理 Windows 上的 gitlab-runner 安装。
安装过程
使用 chocolatey 安装 gitlab-runner
choco install -y gitlab-runner --params="'/InstallDir=E:\gitlab-runner /Service'" --source https://mynexusproxy/repository/chocolatey-org/
它将在E:\gitlab-runner directory
中下载一个exe,创建一个服务gitlab-runner并在同一目录中创建一个register_example.ps1
。
将register_example.ps1
修改为您想要的值,并在register.ps1
中重命名
执行register.ps1
在你的Gitlab服务器中注册runner。它还会在执行 register.ps1
脚本的目录中创建一个 config.toml
。
默认情况下,gitlab-runner 服务的可执行路径是
E:\gitlab-runner\gitlab-runner.exe run --working-directory C:\Windows\system32 --config C:\Windows\system32\config.toml --service gitlab-runner --syslog
这对我不利。要在命令行中更改可执行文件路径,请参阅此 thread.
之后,服务启动并且 运行 运行器在 Giltab 服务器中正确注册。
升级程序
停止 gitlab-runner 服务(否则巧克力崩溃,因为当文件已经存在时它无法创建文件)
用巧克力执行升级
choco upgrade -y gitlab-runner --source https://mynexusproxy/repository/chocolatey-org/
启动gitlab-runner服务
我正在尝试使用 chocolatey 在 windows 上部署 gitlab-runner。
我的意图是在E:\gitlab-runner
目录下安装gitlab-runner,自动注册runner并作为服务启动
我执行了以下行:
choco install -y gitlab-runner /InstallDir E:\gitlab-runner /Service --source https://mynexusproxy/repository/chocolatey-org/
我得到了以下输出:
Chocolatey v0.10.11
Installing the following packages:
gitlab-runner;/InstallDir;E:\gitlab-runner;/Service
By installing you accept licenses for the packages.
Progress: Downloading gitlab-runner 11.8.0... 100%
gitlab-runner v11.8.0
gitlab-runner package files install completed. Performing other installation steps.
Using previous gitlab-runner install path: e:\gitlab-runner
Installing x64 bit version
Added C:\ProgramData\chocolatey\bin\gitlab-runner.exe shim pointed to 'e:\gitlab-runner\gitlab-runner.exe'.
The install of gitlab-runner was successful.
Software install location not explicitly set, could be in package or
default install location if installer.
Second path fragment must not be a drive or UNC name.
Parameter name: path2
gitlab-runner.exe在E:\gitlab-runner
中正确下载,但是没有完成注册,也没有创建服务。 register_example.ps1也在E:\gitlab-runner
.
我的安装过程有什么问题?我需要用自定义值修改 register_example.ps1 吗?
很遗憾,这个特定的包在描述中没有提供示例来说明如何正确传递包参数。但是,您可以在此处找到更多信息以及如何执行此操作的示例:
https://chocolatey.org/docs/how-to-parse-package-parameters-argument
我相信您会想要类似于以下的命令:
choco install -y gitlab-runner --params="'/InstallDir=E:\gitlab-runner /Service'" --source https://mynexusproxy/repository/chocolatey-org/
否则,您尝试传递的参数将被忽略。
@Gary Ewan Park 提供的命令很好,但不足以完全管理 Windows 上的 gitlab-runner 安装。
安装过程
使用 chocolatey 安装 gitlab-runner
choco install -y gitlab-runner --params="'/InstallDir=E:\gitlab-runner /Service'" --source https://mynexusproxy/repository/chocolatey-org/
它将在
E:\gitlab-runner directory
中下载一个exe,创建一个服务gitlab-runner并在同一目录中创建一个register_example.ps1
。将
register_example.ps1
修改为您想要的值,并在register.ps1
中重命名
执行
register.ps1
在你的Gitlab服务器中注册runner。它还会在执行register.ps1
脚本的目录中创建一个config.toml
。默认情况下,gitlab-runner 服务的可执行路径是
E:\gitlab-runner\gitlab-runner.exe run --working-directory C:\Windows\system32 --config C:\Windows\system32\config.toml --service gitlab-runner --syslog
这对我不利。要在命令行中更改可执行文件路径,请参阅此 thread.
之后,服务启动并且 运行 运行器在 Giltab 服务器中正确注册。
升级程序
停止 gitlab-runner 服务(否则巧克力崩溃,因为当文件已经存在时它无法创建文件)
用巧克力执行升级
choco upgrade -y gitlab-runner --source https://mynexusproxy/repository/chocolatey-org/
启动gitlab-runner服务