我正在处理 gitlab pipeline 上的问题。我的构建工作似乎进展顺利,但即使路径良好,我也无法将我的工件 .rpm 上传到 gitlab。
.gitlab-ci.yml
build:
stage: build
image: centos
script:
- set -x
- various steps ...
- cd ~
- tree
artifacts:
paths:
- rpmbuild/RPMS/x86_64/*.rpm
错误信息 .
|-- anaconda-ks.cfg
|-- anaconda-post.log
|-- original-ks.cfg
`-- rpmbuild
|-- BUILD
| `-- *****
|-- BUILDROOT
|-- RPMS
| `-- x86_64
| `-- project-0.1-1.el8.x86_64.rpm
|-- SOURCES
| `-- project-0.1.tar.gz
|-- SPECS
`-- SRPMS
`-- project-0.1-1.el8.src.rpm
17 directories, 37 files
Uploading artifacts for successful job 00:00
Uploading artifacts...
WARNING: rpmbuild/RPMS/x86_64/*.rpm: no matching files. Ensure that the artifact path is relative to the working directory (/builds/firstnameName/project)
ERROR: No files to upload
Cleaning up project directory and file based variables
如有任何建议,我们将不胜感激
我尝试过的:
问题是你的 rpmbuild 文件夹不在“
$CI_PROJECT_DIR
”下,而是位于 Gitlab 运行程序的“home
”目录中。
"~"(home directory) != $CI_PROJECT_DIR(gitlab project directory).
它们是完全不同的目录。
要识别工件路径,您必须创建
rpmbuild
目录或将其移动到 $CI_PROJECT_DIR
中。下面我添加了一个复制命令,将 rpmbuild
复制到 $CI_PROJECT_DIR
build:
stage: build
image: centos
script:
- set -x
- various steps ...
- cd ~
- cp -R rpmbuild $CI_PROJECT_DIR/
artifacts:
paths:
- rpmbuild/RPMS/x86_64/*.rpm
您也可以移动文件夹而不是复制,这取决于您。