Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Unable to get Deployment Variables

Oskar Kuklinski May 1, 2023

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
Screenshot 2023-05-01 at 14.36.18.png

1 answer

1 accepted

0 votes
Answer accepted
Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 2, 2023

Hi @Oskar Kuklinski 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)

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

Kind regards,
Theodora

Oskar Kuklinski May 2, 2023

Hi @Theodora Boudale 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

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

Screenshot 2023-05-02 at 13.24.32.png

Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 2, 2023

Hi @Oskar Kuklinski,

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

Oskar Kuklinski May 2, 2023

Yes, that was indentation issue. Thanks for your help, pipeline runs successfully now!

Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 2, 2023

You are very welcome Oskar, I'm glad to have helped!

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

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PERMISSIONS LEVEL
Site Admin
TAGS
AUG Leaders

Atlassian Community Events