【问题标题】:GitLab CI Build not uploading artifacts of codeceptionGitLab CI Build 未上传代码接收工件
【发布时间】:2019-06-11 13:56:38
【问题描述】:

当测试失败时,我遇到了 GitLab 不上传由 codeception 生成的工件的问题。它只上传_output 文件夹中的.gitignore。 这是我.gitlab-ci.yml的相关部分:

  - ./src/Vendor/codeception/codeception/codecept run acceptance || true
  - ls -a tests/_output
  artifacts:
    paths:
    - "tests/_output"
    expire_in: 20 days
    when: always

有趣的是,我甚至可以在工作完成之前浏览工件(在这种情况下只有 .gitignore 文件)。我的跑步者的日志证明,工件确实存在于目录tests/_output(短)中:

$ ls -a tests/_output
.
..
.gitignore
commentsCest.answerCommentTest.fail.html
commentsCest.answerCommentTest.fail.png
commentsCest.normalCommentTest.fail.html
commentsCest.normalCommentTest.fail.png
failed
Uploading artifacts...
tests/_output: found 2 matching files              
Uploading artifacts to coordinator... ok            id=123456789 responseStatus=201 Created token=abcdefghij
Job succeeded

我做错了什么?

【问题讨论】:

    标签: gitlab gitlab-ci


    【解决方案1】:

    我想出了一个解决方法:

    gitlab-runner 只在项目目录中正确上传文件。 要获取工件,请将所有文件复制到 ${CI_PROJECT_DIR}

    codeception_tests:
      stage: <your stage-name>
      image: <your image>
      script:
      - ...
      after_script:
      - mkdir ${CI_PROJECT_DIR}/artifacts
      - mkdir ${CI_PROJECT_DIR}/artifacts/codecept
      - cp tests/_output ${CI_PROJECT_DIR}/artifacts/codecept -R
      artifacts:
        paths:
          - ${CI_PROJECT_DIR}/artifacts/
        expire_in: 5 days
        when: always
    

    【讨论】:

    • 这对我有用。谢谢。我正在通过 Gitlab.com 运行 Maven - 管道。
    猜你喜欢
    • 1970-01-01
    • 2018-05-09
    • 2019-08-05
    • 1970-01-01
    • 1970-01-01
    • 2021-06-29
    • 1970-01-01
    • 1970-01-01
    • 2022-07-27
    相关资源
    最近更新 更多