Bitbucket has one stage feature that allows to have multiple steps inside a single stage and i was trying to find out the correct approach to do this with the Allowed parent properties as default, branches, pull-requests, tags, and custom. When i was trying in VS code and it gives me Code Property stage is not allowed. Can someone give me the correct way of doing this part. Below is the method that i was trying and attached the screenshots for the same
Hi Vysakh and welcome to the community!
The bitbucket-pipelines.yml file you posted here is valid. I tried running a build with this yml and there were no issues.
You can use the following validator to validate your bitbucket-pipelines.yml file:
Just a heads up, there is a bug with the validator when yaml anchors are used. In this case, the validator doesn't show any errors.
VS code is not built by Atlassian, so I'm not sure why it shows an error and how exactly it does the validation. If you want to find out, it may be best to reach out to a VS Code-specific forum or the product's support team.
Kind regards,
Theodora
Hi Theodora,
Thanks for your comments regarding this issue. When I introduced the stage feature I got the below error from the pipeline. Please look this one as well
Thanks
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Vysakh,
This error shows when there is an error with indentation.
You can try with indentation as follows: (Edited to correct the yml indentation)
image: hashicorp/terraform:latest
pipelines:
branches:
'{feature-dev-*,feature-qa-*,feature-master-*}':
- stage:
name: Build and test
steps:
- step:
name: Deploy
script:
- |
branch=$(echo $BITBUCKET_BRANCH | awk -F'-' '{print tolower($2)}')
Please feel free to let me know how it goes.
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.
Hi Theodora,
Thanks for your reply and there was a slight change in the code that you shared above. It should be:
image: hashicorp/terraform:latest
pipelines:
Once more thanks for the correction in the stage section. Now the pipeline is working as I expected.
Thanks and Regards
Vysakh M
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Vysakh,
You are absolutely right, I slipped up. I will edit my reply to avoid confusion.
It's good to hear that the pipeline is working now. Please feel free to reach out if you ever need anything else!
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.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.