Adding include: template: Jobs/SAST.gitlab-ci.yml to gitlab-ci.yml doesn't work

Can somebody tell my what I am doing wrong

my gitlab-ci.yml file looks like it:

default:

  image:

    name: registry.gitlab.com/arrowelectronics/postnl/self-pickup-app-prod/dev-selfpickup:$CI_IMG_TAG

    entrypoint: [""]

include:

    template: Jobs/SAST.gitlab-ci.yml

stages:

  - build

linter:

  stage:

    build

  script:

    - echo "Simple build job"

After i added include it does says

sast job: chosen stage does not exist; available stages are .pre, build, .post

without that part of include it works :slight_smile:

Hi,

the SAST template expects more stages by default, test is one of them. You only have build defined. In order to fix that, change stages to

stages:
  - build
  - test

and move it to the top before the template include.

Cheers,
Michael

1 Like

It still doesn’t work
I still cannot create stage with name that i want to.

default:

  image:

    name: registry.gitlab.com/arrowelectronics/postnl/self-pickup-app-prod/dev-selfpickup:$CI_IMG_TAG

    entrypoint: [""]

stages:

  - blabla

include:

    template: Jobs/SAST.gitlab-ci.yml

linter:

  stage:

    blabla

  script:

    - echo "Simple build job"

linter1:

  stage:

    test

  script:

    - echo "Simple build job"

linter2:

  stage:

    build

  script:

    - echo "Simple build job"

Hi,

if you are including the SAST template, you must define the test stage in the stages array, and add your own in addition.

Cheers,
Michael