简体   繁体   English

清理项目目录和基于文件的变量 00:01 错误:作业失败:退出代码 1

[英]Cleaning up project directory and file based variables 00:01 ERROR: Job failed: exit code 1

I started learning gitlab-ci using a course on udemy.我开始使用 udemy 上的课程学习 gitlab-ci。 Below code is absolutely similar to the master's code but his code run correctly but my code release error.下面的代码与大师的代码绝对相似,但他的代码运行正确但我的代码发布错误。 what is wrong with below code:下面的代码有什么问题:

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

[:[error][1]][1] [1]: https.//i.stack.imgur.com/dWGiY.png [:[错误][1]][1][1]: https.//i.stack.imgur.com/dWGiY.png

You are creating the build directory but your car.txt is at the root folder, therefore not part of the artifact and not existing in the test stage.您正在创建build目录,但您的car.txt位于根文件夹中,因此不是工件的一部分,也不存在于测试阶段。

Your structure now:你现在的结构:

.
├── /build
├── car.txt

How it should be应该如何

.
├── /build
│   └── car.txt

You should refactor all car.txt related commands to build/car.txt .您应该将所有与car.txt相关的命令重构为build/car.txt

If you are doing an udemy course, you might wanna have a look at variables so that you can assign the filepath to a variable and don't run into problems if you need to relate to the same path in different commands.如果您正在上 udemy 课程,您可能想查看变量,以便可以将文件路径分配给变量,并且如果您需要在不同命令中关联相同路径,则不会遇到问题。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 为什么我会清理基于文件的变量 00:01 错误:作业失败:gitlab 管道创建中的退出代码 1 - why im getting Cleaning up file based variables 00:01 ERROR: Job failed: exit code 1 in gitlab pipeline creation 清理基于文件的变量。 错误:作业失败:退出代码 1 - Cleaning up file based variables. ERROR: Job failed: exit code 1 Laravel Gitlab CI/CD,错误:作业失败:退出代码 1 - Laravel Gitlab CI/CD, ERROR: Job failed: exit code 1 Docker:错误:作业失败:命令以退出代码 1 终止 - Docker: ERROR: Job failed: command terminated with exit code 1 Gitlab CI 失败并出现错误:作业失败:退出代码 1 - Gitlab CI fails with ERROR: Job failed: exit code 1 谁能告诉我为什么我从 GitLab 收到此“错误:作业失败:退出代码 1”消息? - Can anyone tell me why I get this 'ERROR: Job failed: exit code 1' message from GitLab? gitlab ci/cd 错误:作业失败:chmod og= $STAGE_ID_RSA 上的退出代码 1 - gitlab ci/cd ERROR: Job failed: exit code 1 on chmod og= $STAGE_ID_RSA 更改目录时,Gitlab CI运行程序作业退出状态失败1 - Gitlab CI runner job failed exit status 1 when changing directory GitLab CI。 作业失败并出现错误:错误:作业失败:退出状态 9009 - GitLab CI. Job failed with error: ERROR: Job failed: exit status 9009 testdriven.io flask-tdd-docker课程第15章管道阶段测试错误:作业失败:退出代码1 - testdriven.io flask-tdd-docker course chapter 15 pipeline stage test ERROR: Job failed: exit code 1
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM