gitlab 子管道是从工件生成的,而不是根据子管道中的规则运行作业

问题描述 投票:0回答:1

这是子管道的内容,从 jinja 模板生成并在上一个作业中存储为工件。

触发此子管道时,它表示此子管道没有阶段或没有作业。

Test_Container_10.10.102.240:
  stage: TEST
  image: docker
  services:
    - docker:dind
  extends: .job_AWX_TEMPLATE_TEST_APT
  variables:
    dest_ip: 10.10.102.240
    srv_type: svc_all_apt
  artifacts:
    paths:
      - './apt*'
  rules:
    - if: $srv_type == 'svc_all_apt'
      when: on_success

在变量部分,srv_type 值是由 jinja 模板中的 python 代码提供的。

当我禁用规则部分时,该管道可以工作。 即使我使用规则运行与父管道相同的代码,它也能工作。

Why rule section is not working in the child pipeline
srv_type variable value comes from python code, in the previous job. 
Do I need to pass this value from the parent pipeline in this job.

gitlab gitlab-ci gitlab-ci-runner gitlab-ci.yml
1个回答
0
投票

如果:$srv_type == 'svc_all_apt'

您需要对值使用双引号,而不是单引号。

  rules:
    - if: $srv_type == "svc_all_apt"
© www.soinside.com 2019 - 2024. All rights reserved.