Bin*_*gla 2 checkout github-actions github-actions-self-hosted-runners
我正在使用 GitHub Actions 和安装在 Windows 2019 服务器上的自托管代理来设置 CI/CD 管道。
我面临的问题是操作 actions/checkout@v2 无法签出存储库并完全解压缩它。当我说“完全解压”时,我的意思是目标文件夹中有一些文件,它在停止之前设法解压。
从日志中:
Run actions/checkout@v2
Syncing repository: Syd/ExternWebb
Getting Git version info
Deleting the contents of 'C:\actions-runner\_work\ExternWebb\ExternWebb'
The repository will be downloaded using the GitHub REST API
To create a local Git repository instead, add Git 2.18 or higher to the PATH
Downloading the archive
Writing archive to disk
Extracting the archive
C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -NoLogo -Sta -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -Command "$ErrorActionPreference = 'Stop' ; try { Add-Type -AssemblyName System.IO.Compression.FileSystem } catch { } ; [System.IO.Compression.ZipFile]::ExtractToDirectory('C:\actions-runner\_work\ExternWebb\ExternWebb\b3193a49-e100-4cbd-81c9-6bd23ff47313.tar.gz', 'C:\actions-runner\_work\ExternWebb\ExternWebb\b3193a49-e100-4cbd-81c9-6bd23ff47313')"
Exception calling "ExtractToDirectory" with "2" argument(s): "Could not find a part of the path 'C:\actions-runner\_wor
k\ExternWebb\ExternWebb\b3193a49-e100-4cbd-81c9-6bd23ff47313\Syd-ExternWebb-77d0427f54bc3e4d6694
f0719ca9fe3ab3be3706\ExternWebb.Library\Custom\Plugins\DomainRedirectModule\DomainRedirectConfigurationCollection
.cs'."
At line:1 char:111
+ ... catch { } ; [System.IO.Compression.ZipFile]::ExtractToDirectory('C:\a ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : DirectoryNotFoundException
Error: The process 'C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe' failed with exit code 1
Run Code Online (Sandbox Code Playgroud)
我尝试在本地自托管代理上运行相同的操作,没有任何问题。
Reddit 上的一篇帖子建议,可以通过 Git 获取存储库来缓解该错误,并在日志中指出了这一线索:
The repository will be downloaded using the GitHub REST API
To create a local Git repository instead, add Git 2.18 or higher to the PATH
Run Code Online (Sandbox Code Playgroud)
我尝试安装 Git v.2.30 并将其添加到上面的 PATH 中,但由于某种原因,该操作仍然通过 GIT API 下载存储库。我不知道是否需要重新启动服务器,但 git 命令可以在 Powershell 中使用。
我猜这就是为什么本地自托管代理(可以访问 GIT)可以检查存储库,但在服务器上运行的代理却不能。
这是工作流程 yml 文件:
name: Build Stage
on:
push:
branches: [ develop ]
pull_request:
branches: [ develop ]
jobs:
build:
runs-on: [self-hosted, stage]
env:
CONFIG: Stage
BUILD_FOLDER: _build
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Checking out source code
uses: actions/checkout@v2
Run Code Online (Sandbox Code Playgroud)
任何见解表示赞赏。
| 归档时间: |
|
| 查看次数: |
9266 次 |
| 最近记录: |