Unable to get Deployment Variables
Asked by Oskar Kuklinski:

My project uses a mix of Repository and Deployments variables. Repository variables are being fetched correctly but there is something wrong with deployment vars for each pipeline. Below I'm attaching my bitbucket-pipelines.yaml file and a setup in Repository settings -\> Deployments

Echo script were only to check if the values are being passed.  
BITBUCKET_DEPLOYMENT_ENVIRONMENT was empty while the rest were present in a  
my_variables file  
![Screenshot 2023-05-01 at 14.30.05.png](/t5/image/serverpage/image-id/254682iD097BA59D05FF225/image-size/large?v=v2&px=999 "Screenshot 2023-05-01 at 14.30.05.png")  
![Screenshot 2023-05-01 at 14.36.18.png](/t5/image/serverpage/image-id/254683iDCB3BE3AC3ADF326/image-size/large?v=v2&px=999 "Screenshot 2023-05-01 at 14.36.18.png")


Answers:
author: Theodora Boudale
body: Hi [@Oskar Kuklinski](/t5/user/viewprofilepage/user-id/5208435) and welcome to the community!

I believe that the variable is empty because the syntax of the step is incorrect.

The following line can be used if you don't want to specify any additional values, like the step name and deployment environment.

```
- step: *env-specific-build-and-deploy
```

If you want to specify a different step name and deployment environment, the step should look as follows:

```
- step: 
    <<: *env-specific-build-and-deploy
    name: Some name
    deployment: stage
```

The step in the master branch pipeline needs to have a similar definition as well.

This is the documentation for reference (see section **Override values**)

* <https://support.atlassian.com/bitbucket-cloud/docs/yaml-anchors/>

Could you give it a try and let me know if it works for you?

Kind regards,  
Theodora

comments: author: Oskar Kuklinski
body: Hi [@Theodora Boudale](/t5/user/viewprofilepage/user-id/818086) and thanks for looking into it!

Unfortunately after making a change mentioned above I am getting following error when running a pipeline (nothing else in console logs):

![Screenshot 2023-05-02 at 13.22.37.png](https://community.atlassian.com/t5/image/serverpage/image-id/254832iA195DAAA4820FA6B/image-dimensions/356x204?v=v2 "Screenshot 2023-05-02 at 13.22.37.png")

Any idea why this could be happening? Also attaching updated bitbucket-pipelines.yaml file

![Screenshot 2023-05-02 at 13.24.32.png](https://community.atlassian.com/t5/image/serverpage/image-id/254834i4A05F82339F2D550/image-size/large?v=v2&px=999 "Screenshot 2023-05-02 at 13.24.32.png")


author: Theodora Boudale
body: Hi [@Oskar Kuklinski](/t5/user/viewprofilepage/user-id/5208435),

I think the error occurs because of the indentation.

See my example:

```
- step: 
    <<: *env-specific-build-and-deploy
    name: Some name
    deployment: stage
```

For the lines below **-step:** I am using 4 spaces for indentation. In your yml file, it looks like the indentation is 2 spaces instead, which I believe is the reason for this error.

Kind regards,  
Theodora


author: Oskar Kuklinski
body: Yes, that was indentation issue. Thanks for your help, pipeline runs successfully now!


author: Theodora Boudale
body: You are very welcome Oskar, I'm glad to have helped!

Please feel free to reach out if you ever need anything else!


Tags: bitbucket-cloud

cloud