gitlab runner catch错误:没有匹配的文件

时间:2018-05-28 09:11:49

标签: git gitlab gitlab-ci gitlab-ci-runner

如果找不到匹配的文件或批处理文件发出错误,是否有办法捕获错误?

...
Rebuild complete.
Syntaxerror.
Syntaxerror.
Syntaxerror.
Uploading artifacts...
WARNING: Ticket/Ticket_111b: no matching files     
WARNING: Failed to load system CertPool: crypto/x509: system root pool is not available on Windows 
Uploading artifacts to coordinator... ok            id=622 responseStatus=201 Created token=xxxxxx
Job succeeded

结果显示作业已成功执行。 gitlab-runner如何知道批处理文件中的错误或无匹配的文件警告?

gitlab YAML文件:

before_script:
  - xcopy /y /s "C:/Bauen" "%CI_PROJECT_DIR%"


stages:
  - build
  - deploy





build:
  stage: build
  script:
  - build.cmd
  artifacts:
    expire_in: 1 week
    name: "%CI_COMMIT_REF_NAME%"
    paths:
      - "%CI_COMMIT_REF_NAME%"
  only:
  - tags
  except:
  - master


build_master:
  stage: build
  script:
  - buildm.cmd
  artifacts:
    expire_in: 1 week
    name: "%CI_COMMIT_REF_NAME%"
    paths:
      - "%CI_COMMIT_REF_NAME%"
  only:
  - master

deploy:
 stage: deploy
 script:
 - ./upload.cmd
 dependencies:
 - build_master
 only:
 - master

GitLab Runner在Windows机器上运行。

1 个答案:

答案 0 :(得分:1)

我不太清楚你想要什么。

如果某些文件不存在,您是否想停止工作?

如果是这样,您只需在脚本部分添加一行,如果您的文件不存在则会失败。例如,在bash中:

script:
- ls this_file_must_exists