GitLab CI/CD cache error: The filename, directory name, or volume label syntax is incorrect
GitLab CI/CD cache error: The filename, directory name, or volume label syntax is incorrect
我正在安装 GitLab-Runner 并在 Windows Server 2012 上 运行ning。我正在尝试缓存 node_modules
文件夹。
我按照在互联网上找到的许多示例编写了这个 yml:
cache:
key: "%CI_PROJECT_NAME%" #Defines when to cache.
untracked: true
paths:
- node_modules/
variables:
SOLUTION: $CI_PROJECT_DIR\App.Web.sln
stages:
- setup
- build
setup: #From: https://gitlab.com/gitlab-org/gitlab-ce/issues/12963
stage: setup
script:
- npm install #Install all packages
build_backend:
stage: build
script:
- echo "Building backend branch '%CI_COMMIT_REF_NAME%' for '%SOLUTION%'."
- dotnet restore "%SOLUTION%"
- dotnet msbuild /p:Configuration=Release "%SOLUTION%"
except:
- tags
build_frontend:
stage: build
script:
- echo "Building frontend branch '%CI_COMMIT_REF_NAME%' for '%SOLUTION%'."
- npm run build:vendor && npm run build:webpack
except:
- tags
我的 setup
阶段 运行 成功(作业移至构建阶段),但存在致命错误并且从未执行缓存。
如果我们详细查看它失败的原因,路径真的很奇怪:
FATAL: open ..\..\..\..\..\cache\web\app\app:1\cache.zip: The filename, directory name, or volume label syntax is incorrect.
| | | |
(1) (2) (3) (4)
???
(1) This is GitLab-Runner root dir
(2) GitLab group for project
(3) Project name
(4) I think this cause problems, because aap:1 is invalid dir name.
完整日志:
Running with gitlab-runner 10.4.0 (857480b6)
on Dexter (7cab42e4)
Using Shell executor...
Running on DEXTER...
Fetching changes...
HEAD is now at b0344f2 Fix
Checking out 692e0373 as 51-move-ci-cd-to-docker...
Skipping Git submodules setup
Checking cache for %CI_PROJECT_NAME%:1...
FATAL: open ..\..\..\..\..\cache\web\app\app:1\cache.zip: The filename, directory name, or volume label syntax is incorrect.
Successfully extracted cache
$ npm install
....
....
added 1489 packages in 245.681s
Creating cache %CI_PROJECT_NAME%:1...
node_modules/: found 47345 matching files
WARNING: GetFileAttributesEx ..\..\..\..\..\cache\web\app\app:1\cache.zip: The filename, directory name, or volume label syntax is incorrect.
FATAL: open ..\..\..\..\..\cache\web\app\:1\archive_428238003: The filename, directory name, or volume label syntax is incorrect.
Created cache
Job succeeded
我也尝试不使用 cache:key
但错误大致相同:
FATAL: open ..\..\..\..\..\cache\web\app\default:1\cache.zip: The filename, directory name, or volume label syntax is incorrect.
您需要在 gitlab-runner
用户主目录下创建目录并赋予整个缓存目录所有权。
在您的特定情况下 运行 以下命令
mkdir -p /home/gitlab-runner/cache/web/app/app/
sudo chown -R gitlab-runner:gitlab-runner /home/gitlab-runner/cache/
我正在安装 GitLab-Runner 并在 Windows Server 2012 上 运行ning。我正在尝试缓存 node_modules
文件夹。
我按照在互联网上找到的许多示例编写了这个 yml:
cache:
key: "%CI_PROJECT_NAME%" #Defines when to cache.
untracked: true
paths:
- node_modules/
variables:
SOLUTION: $CI_PROJECT_DIR\App.Web.sln
stages:
- setup
- build
setup: #From: https://gitlab.com/gitlab-org/gitlab-ce/issues/12963
stage: setup
script:
- npm install #Install all packages
build_backend:
stage: build
script:
- echo "Building backend branch '%CI_COMMIT_REF_NAME%' for '%SOLUTION%'."
- dotnet restore "%SOLUTION%"
- dotnet msbuild /p:Configuration=Release "%SOLUTION%"
except:
- tags
build_frontend:
stage: build
script:
- echo "Building frontend branch '%CI_COMMIT_REF_NAME%' for '%SOLUTION%'."
- npm run build:vendor && npm run build:webpack
except:
- tags
我的 setup
阶段 运行 成功(作业移至构建阶段),但存在致命错误并且从未执行缓存。
如果我们详细查看它失败的原因,路径真的很奇怪:
FATAL: open ..\..\..\..\..\cache\web\app\app:1\cache.zip: The filename, directory name, or volume label syntax is incorrect.
| | | |
(1) (2) (3) (4)
???
(1) This is GitLab-Runner root dir
(2) GitLab group for project
(3) Project name
(4) I think this cause problems, because aap:1 is invalid dir name.
完整日志:
Running with gitlab-runner 10.4.0 (857480b6)
on Dexter (7cab42e4)
Using Shell executor...
Running on DEXTER...
Fetching changes...
HEAD is now at b0344f2 Fix
Checking out 692e0373 as 51-move-ci-cd-to-docker...
Skipping Git submodules setup
Checking cache for %CI_PROJECT_NAME%:1...
FATAL: open ..\..\..\..\..\cache\web\app\app:1\cache.zip: The filename, directory name, or volume label syntax is incorrect.
Successfully extracted cache
$ npm install
....
....
added 1489 packages in 245.681s
Creating cache %CI_PROJECT_NAME%:1...
node_modules/: found 47345 matching files
WARNING: GetFileAttributesEx ..\..\..\..\..\cache\web\app\app:1\cache.zip: The filename, directory name, or volume label syntax is incorrect.
FATAL: open ..\..\..\..\..\cache\web\app\:1\archive_428238003: The filename, directory name, or volume label syntax is incorrect.
Created cache
Job succeeded
我也尝试不使用 cache:key
但错误大致相同:
FATAL: open ..\..\..\..\..\cache\web\app\default:1\cache.zip: The filename, directory name, or volume label syntax is incorrect.
您需要在 gitlab-runner
用户主目录下创建目录并赋予整个缓存目录所有权。
在您的特定情况下 运行 以下命令
mkdir -p /home/gitlab-runner/cache/web/app/app/
sudo chown -R gitlab-runner:gitlab-runner /home/gitlab-runner/cache/