我有一个包含多个文件的目录:
- file1.json
- file2.txt
- file3.json
我正在运行一个命令,在同一文件夹中创建一个
output.txt
。
我想创建两个工件,一个带有包含文件的 zip,另一个带有
output.txt
。如果我做这样的事情:
artifacts:
paths:
- ${DOWNLOADS_DIR}/*
- ${DOWNLOADS_DIR}/output.txt
有效果吗?提前谢谢大家!
首先,我建议检查此链接。
那么,我建议尝试这个:
before_script:
- DOWNLOADS_DIR="my_artifact/path/to/DOWNLOADS_DIR"
- mkdir -p $DOWNLOADS_DIR
script:
- zip $DOWNLOADS_DIR/output.zip file1.txt file2.txt file3.txt
- cat file1.txt file2.txt file3.txt >> $DOWNLOADS_DIR/output.txt
artifacts:
paths:
- my_artifact
您可以从 Build > 查看项目中存储的所有工件 文物页面。
我使用的完整脚本:
stages:
- test
test:
stage: test
before_script:
- apt-get update
- apt-get install zip
- DOWNLOADS_DIR="my_artifact/path/to/DOWNLOADS_DIR"
- mkdir -p $DOWNLOADS_DIR
script:
- zip $DOWNLOADS_DIR/output.zip file1.txt file2.txt file3.txt
- cat file1.txt file2.txt file3.txt >> $DOWNLOADS_DIR/output.txt
artifacts:
paths:
- my_artifact