Error "config contains unknown keys: trigger."

Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.

Hello!

I'm using self-managed GitLab 15.4.0-ee and getting the subject error from the native linter in 2 cases.

One of them is pretty straightforward:

.foo:
  except:
    variables:
      - $FOO == "foo"

test:
  extends:
    - .foo
  script:
    - echo "test"
  trigger:
    project: my/other-pipeline

Because the trigger-jobs don't run on runners, they can't execute any scripts. Plain and simple, also fits the limitations from here: https://docs.gitlab.com/ee/ci/yaml/#extends.

However, I don't understand why it produces the same error here:

.foo:
  script:
    - echo "foo"
    
test:
  extends:
    - .foo
  trigger:
    project: my/other-pipeline

What I would like to achieve is this:

  1. Create a job like .foo that does some preparatory steps, let's call it job1
  2. Create 4 different jobs that would extend the job1 and deploy my code to 4 different environments: development, test, staging and production; each of these jobs would also produce its own artifact
  3. In each of these 4 jobs, trigger a downstream pipeline from another project that would deploy the artifacts to a cloud storage

I'm relatively new to GitLab, so maybe I'm missing something, but for now I don't see a clean way to achieve my goal.

I also couldn't find any clues neither here, not on the Internet. I followed this discussion, but it seems to be about the aforementioned case №1, which, as I mentioned, makes total sense to me. Also, in that discussion Marcel Amirault seems to have mentioned the case №2, saying it should work, but as we know, unfortunately, it doesn't.

Edited by 🤖 GitLab Bot 🤖