I am trying to write bitbucket pipeline and use YAML anchors to reduce repetition.
So this is the example of what I would like to do:
---
definitions:
steps:
- step: &build-test-alpine
image: php:7.4-alpine
caches:
- composer
script:
- apk add unzip curl
- curl -sS https://getcomposer.org/installer | php -- --install-dir='/usr/local/bin' --filename='composer'
- composer --no-ansi -n install
- composer --no-ansi -n test
pipelines:
custom:
deploy:
- step:
name: Build and deploy application
<<: *build-test-alpine
script:
- Some other command to execute
default:
- step:
<<: *build-test-alpine
name: PHP 7.4
- step:
<<: *build-test-alpine
image: php:7.3-alpine
name: PHP 7.3
...
Of course this does not work (see custom deploy step). One can not define another script item and expect it to merge it to the anchor script. Is there a way to do this?