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

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Can not use yaml anchors in pipeline

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

@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 Soumyadeep Mandal - SaM likes this

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

@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
Community showcase
Published in Bitbucket

New improvements to user management in Bitbucket Cloud 👥

Hey Community! We’re willing to wager that quite a few of you not only use Bitbucket, but administer it too. Our team is excited to share that we’ll be releasing improvements throughout this month of...

3,826 views 10 16
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you