YAML Anchors
ironsalsa opened this issue · comments
Would it be possible to have this work with YAML anchors? We use them extensively, and it would be nice to have this tool automatically expand them if found in the file as a pre-step, since it bombs like this when ancors are used:
branches/dev ERROR Missing required property 'step'
@ironsalsa have you installed the YAML extension in PHP? On *nix you can try something along the lines:
$ php -i | grep -iA1 yaml
/etc/php/7.4/cli/conf.d/20-yaml.ini
--
yaml
LibYAML Support => enabled
Module Version => 2.0.4
LibYAML Version => 0.1.7
--
yaml.decode_binary => 0 => 0
yaml.decode_php => 0 => 0
yaml.decode_timestamp => 0 => 0
yaml.output_canonical => 0 => 0
yaml.output_indent => 2 => 2
yaml.output_width => 80 => 80
Also it would help me if you could provide your pipelines file so I can check it as well (if it's large or contains internals, just the part that is causing it).
I'm currently replacing the fallback YAML parser with a different and would be good to know if that one does it (the current fallback parser IIRC does not).
Thanks!
I'm able to reproduce the error when I deactivate the PHP YAML extension by taking the example from Configure bitbucket-pipelines.yml - YAML anchors:
tests/data/yml/alias2.yml
# this file is part of pipelines
#
# fixture file for aliases inside a yaml to re-use a pipeline
definitions:
steps:
- step: &build-test
name: Build and test
script:
- mvn package
artifacts:
- target/**
pipelines:
branches:
develop:
- step: *build-test
master:
- step:
<<: *build-test
name: Testing on Master
$ bin/pipelines --file tests/data/yml/alias2.yml --show
PIPELINE ID IMAGES STEPS
branches/develop ERROR Missing required property 'step'
branches/master atlassian/default-image:latest 1 ("Testing on Master")
Good news is that the new fallback YAML parser handles this better:
$ bin/pipelines --file tests/data/yml/alias2.yml --show
PIPELINE ID IMAGES STEPS
branches/develop atlassian/default-image:latest 1 ("Build and test")
branches/master atlassian/default-image:latest 1 ("Testing on Master")
@ironsalsa: Please find Pipelines version 0.0.22 released to address the issue you see. Let me know if it works for you.