Jobs stage config should implement a script: or a trigger: keyword. But trigger keyword already there

Hi Team,

I’m facing a issue with using trigger key word for parent child pipelines. I’m using gitlab free EE is that the reason to fail the pipeline with bellow error?

error:

jobs stage config should implement a script: or a trigger: keyword*

code:

trigger_terraform_plan:
stage: trigger_plan
rules:
- if: ( $aws_account != null )
trigger:
include: child_jobs/ymls/terraform_plan_template.yml*

could you please help me to fix it?

Hi @uyanushka

It’s hard to tell what’s happening here, but it would help if you could format your YAML snippet as a code block (use the </> button in the text editor).

I think you want something like this, but you will probably need to play around with this a little further:

trigger_terraform_plan:
    stage: trigger_plan
    rules:
        - if: ${aws_account}
          when: always
        - when: never
    trigger:
        include: child_jobs/ymls/terraform_plan_template.yml

This is based on the child pipeline docs and the rules docs.

Hi @snim2

sorry forgot to format the code before, this is the formatted code. I’m getting error jobs stage config should implement a script: or a trigger: keyword * but in that stage we have trigger key word.

trigger_terraform_plan:
  stage: trigger_plan
  rules:
    - if: ( $aws_account != null )
  trigger:
   include: child_jobs/ymls/terraform_plan_template.yml*

OK, have you tried my version above? or something like it?

yes. I have tested with by removing if condition also, but same error occurred.

Is that due to free version when I was checking pricing I have noticed that advance pipeline are available on paid version.

The child pipeline docs say that parent-child pipelines are available in all tiers, so I don’t think the issue is that you are using the free plan. Also, that snippet passes the lint for me.

Is it possible to post your full .gitlab-ci.yml file?

difficult to provide entire code here since this is big project. give me some time I’ll try to regenerate it with some simple pipeline.

Hi @snim2

apologize on delay reply, could be able to regenerate the issue with 2 simple files.

.gitlab-ci.yml

stages:
  - stage1
  - trigger

.base:
  image:
    name: ${BASE_CICD_IMAGE}
    entrypoint: [""]
  tags:     
    - "docker-in-docker"

stage_1:
  stage: stage1
  extends: .base
  script:
    - echo stage1

trigger:
  stage: trigger
  trigger:
    include:  child_jobs/ymls/terraform_plan_template.yml

child_jobs/ymls/terraform_plan_template.yml

stage:
  - plan

.base:
  image:
    name: ${BASE_CICD_IMAGE}
    entrypoint: [""]
  tags:     
    - "docker-in-docker"

terraform_plan:
  stage: plan
  extends: .base
  script: 
    - echo test