![](/img/trans.png)
[英]why im getting Cleaning up file based variables 00:01 ERROR: Job failed: exit code 1 in gitlab pipeline creation
[英]Cleaning up project directory and file based variables 00:01 ERROR: Job failed: exit code 1
我开始使用 udemy 上的课程学习 gitlab-ci。 下面的代码与大师的代码绝对相似,但他的代码运行正确但我的代码发布错误。 下面的代码有什么问题:
stages:
- build
- test
build the car:
stage: build
script:
- mkdir build
- touch car.txt
- echo "chassis" >> car.txt
- echo "engine" >> car.txt
- echo "wheels" >> car.txt
artifacts:
paths:
- build/
test the car:
stage: test
script:
- ls
- test -f build/car.txt
- cd build
- ls
- cat car.txt
- grep "chassis" car.txt
- grep "engine" car.txt
- grep "wheels" car.txt
[:[错误][1]][1][1]: https.//i.stack.imgur.com/dWGiY.png
您正在创建build
目录,但您的car.txt
位于根文件夹中,因此不是工件的一部分,也不存在于测试阶段。
你现在的结构:
.
├── /build
├── car.txt
应该如何
.
├── /build
│ └── car.txt
您应该将所有与car.txt
相关的命令重构为build/car.txt
。
如果您正在上 udemy 课程,您可能想查看变量,以便可以将文件路径分配给变量,并且如果您需要在不同命令中关联相同路径,则不会遇到问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.