firas
firas

Reputation: 21

extends in Gitlab-ci pipeline

I'm trying to include a file in which I declare some repetitive jobs, I'm using extends.

I always have this error did not find expected key while parsing a block

this is the template file

.deploy_dev:
 stage: deploy
  image: nexus
  script:
   - ssh -i ~/.ssh/id_rsa -o "StrictHostKeyChecking=no" sellerbot@sb-dev -p 10290 'sudo systemctl restart mail.service'
  only: 
    - dev

this is the main file

include: 
  - project: 'sellerbot/gitlab-ci'
    ref: master
    file: 'deploy.yml'


deploy_dev:
 extends:  .deploy_dev

Can anyone help me please `

Upvotes: 1

Views: 8170

Answers (1)

Anna Slastnikova
Anna Slastnikova

Reputation: 1548

It looks like just stage: deploy has to be indented. In this case it's a good idea to use gilab CI line tool to check if CI pipeline code is valid or just YAML validator. When I checked section from template file in yaml linter I've got

(<unknown>): mapping values are not allowed in this context at line 3 column 8

Upvotes: 1

Related Questions