在本地使用gitlab-runner并传递上一步的工件

时间:2019-09-13 13:59:13

标签: docker gitlab gitlab-ci gitlab-ci-runner

我正在尝试调试GitLab CI管道中的一些问题。我有一个步骤B,它正在使用步骤A中的一些工件。

步骤A很长(并且正在CI中运行),所以我不想在本地运行它:我只是从GitLab下载生成的工件。因此,我有一个artifacts.zip,我将其提取以获得一个output和一个logs目录。到目前为止一切顺利。

我想使用gitlab-runner在本地运行步骤B。请注意,我使用的是9.5版(https://docs.gitlab.com/runner/install/old.html)。

我正在使用以下命令:

gitlab-runner exec docker step-b

正如我所解释的,step-b需要来自step-a的工件。这是我尝试过的:

gitlab-runner exec docker --docker-volumes ~/Downloads/output step-b 

在步骤B中执行的脚本之一正在执行类似mv ../output /some/where/else的操作。但是,此脚本失败并显示以下错误:

mv: cannot stat '../output': No such file or directory

出现此错误后,我有两个问题:

  • 此脚本在哪里执行?在.gitlab-ci.yml中这样称呼:

    ./scripts/my_script.sh.
    

    在这种情况下,.是什么?

  • 如何确保使用--docker-volumes ~/Downloads/output将目录安装在正确的位置,以便我的脚本可以找到它?

编辑

根据要求,以下是步骤A的说明。

script:
  - mkdir -p /usr/local/compil_result
  - ./scripts/compil.sh
  - mv /usr/local/compil_result ./output
artifacts:
  paths:
    - output
    - logs

0 个答案:

没有答案