小编Oks*_*iuk的帖子

无法将变量传递到 GitLab CI 上的下游管道

一个多星期以来,我一直在努力在 GitLab CI 的多项目管道中的作业之间传递变量,并遇到了很多奇怪的错误。该机制看起来非常基本,它让我发疯,这样一个明显的事情仍然对我不起作用,如果有人遇到类似的问题 - 我将感谢你的帮助!

所以我一直在尝试做的事情:我在 gitlab 上有两个项目,我试图将它们链接到一个多项目管道中,作业模式如下所示: 在项目 A 中:

variables: BUILD_PATH:""

build:
    script:
        - $BUILD_PATH="some-path" #the important point here that this value sets inside the job, it's not static

bridge:
  variables: 
    PATH: $BUILD_PATH
    RUN_TYPE: test #this value is a static and it passes correctly, no issues here
  trigger:
    project: project-B-path
Run Code Online (Sandbox Code Playgroud)

在项目B中:

variables: 
  PATH: ""
  RUN_TYPE: ""

test:
  script: 
    echo "From upstream pipeline dynamic: $PATH"
    echo "From upstream pipeline static: $RUN_TYPE"
    ...
Run Code Online (Sandbox Code Playgroud)

当我在 CI 上运行它时,我正确传递了 $RUN_TYPE 变量,并且 $PATH …

continuous-integration gitlab

5
推荐指数
2
解决办法
9594
查看次数

标签 统计

continuous-integration ×1

gitlab ×1