Hello team,
I'm trying to work with anchors and inheritance in Bitbucket yaml file but I got this error
There is an error in your bitbucket-pipelines.yml at [pipelines > branches > release > 1]. Step is empty, null, or missing.
- step: &build-release-common
Hi Yosser,
This error usually indicates an issue with indentation. Indentation needs to be at least one space from the previous level, and for everything under - step: it needs to be at least three spaces. I normally use two and four spaces respectively.
Additionally, combining a YAML anchor for a step with an additional script is not going to work. Even with correct indentation, the step <<: *build-release-common is not going to be executed. When you use a YAML anchor in a step, you can only use overrides for things like the step name, deployment, trigger. You cannot add another script in that step.
An example that should work with correct indentation and no additional script under the anchor is the following:
definitions:
services:
docker:
memory: 1024
caches:
sonar: ~/.sonar
maven: ~/.m2/repository
steps:
- step: &build-release-common
name: Build and Test with Default Branches
caches:
- maven
size: 2x
script:
- echo "Building and testing the project with release branches..."
pipelines:
branches:
"release":
- step:
<<: *build-release-common
deployment: Staging
name: "build and test"
Please feel free to let me know if you have any questions!
Kind regards,
Theodora
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.