Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Can not use yaml anchors in pipeline

Nativ Issac January 27, 2021

Hey All!

 

I'm pretty new to bitbucket pipelines, so the following may seem trivial but anyway..

Tryin to declare the following bitbucket-pipelines.yml file:

definitions:
steps:
- step: &black
name: Black Format Check
image: python:3.7
script:
- pip install black
- black --check .
- step: &mypy
name: mypy Check
image: python:3.7
script:
- pip install mypy
- mypy src
- step: &flake8
name: flake8 Lint Check
image: python:3.7
script:
- pip install flake8 flake8-bugbear
- flake8 -v .
- step: &pylint
name: pylint Lint Check
image: python:3.7
script:
- pip install pylint
- pylint src


pipelines:
pull-requests:
feature/*:
- parallel:
- step: *black
- step: *mypy
- step: *flake8
- step: *pylint

 But the pycharm states that

Schema validation: Property 'parallel' is not allowed

Interesting considering when checked using the online validator I see it's valid :\

Have I miss used yaml anchors?

 

Thanks in advance for your help :)

1 answer

1 accepted

2 votes
Answer accepted
Soumyadeep Mandal - SaM
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 27, 2021
Nativ Issac January 27, 2021

@Soumyadeep Mandal - SaM Thanks a lot!

Appreciate your quick & informative response :)

 

For the record, problem was that I declared the  steps as list items.

Fix was to convert them to sub keys:

definitions:
black-step: &black
name: Black Format Check
image: python:3.7
script:
- pip install black
- black --check .
mypy-step: &mypy
name: mypy Check
image: python:3.7
script:
- pip install mypy
- mypy src
flake8-step: &flake8
name: flake8 Lint Check
image: python:3.7
script:
- pip install flake8 flake8-bugbear
- flake8 -v .
pylint-step: &pylint
name: pylint Lint Check
image: python:3.7
script:
- pip install pylint
- pylint src


pipelines:
pull-requests:
feature/*:
- parallel:
- step: *black
- step: *mypy
- step: *flake8
- step: *pylint

Thanks again!

Like # people like this
Francis Poulin April 7, 2021

Hi @Nativ Issac ,

 

I'm currently facing an issue similar to yours and I'm not sure how your solution fixed the issue. 

I understand that you changed your step definitions from an array to mapped objects, but this should't affect the referenced object.

In both exemple, *black should have the same value. 

 

Note: I just saw that in your first example, the indentation for the step is wrong (i think)

definitions:
steps:
- step: &black
name: Black Format Check

Should be:

definitions:
steps:
- step: &black
name: Black Format Check

 

Cheers, 

Like Nativ Issac likes this
Nativ Issac April 8, 2021

@Francis Poulin Hi, thanks for letting me (and perhaps some more future readers) know.

Our pipelines are already implemented in the mapped objects approach and it does not bother me that much..

Have not checked your suggestion, but I hope it suites your needs.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events