gitlab - 从其他存储库中的触发管道获取工件

时间:2021-07-21 10:22:40

标签: gitlab gitlab-ci

我试图在单独的项目中触发管道,然后收集工件,但在添加 needs 部分时,我不断收到 CI lint 错误。触发器本身正在工作。

这是舞台:

trigger_integration_test:
    stage: test_on_dev
    variables:
        TEST_TYPE: ci
    trigger:
        project: <FULL_PATH_TO_PROJECT>
        strategy: depend
    needs:    
    - project: <FULL_PATH_TO_PROJECT>
    job: integration_tests_on_test
    ref: main
    artifacts: true

请指教。

1 个答案:

答案 0 :(得分:0)

我最终添加了一个单独的阶段,在测试之后运行以收集工件:

download_gauge_tests_artifacts:
  stage: test_on_dev
  script:
    - 'curl --location --output artifacts.zip --header "JOB-TOKEN: $CI_JOB_TOKEN" --request GET "https://gitlab.com/api/v4/projects/<projectid>/jobs/artifacts/main/download?job=integration_tests_on_test"'
    - unzip artifacts.zip
    - rm -rf artifacts.zip
  artifacts:
    paths:
     - reports/*
    when: always