Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Deployment variables not working with multiple staging

I have a deployment pipeline I'm trying to configure, and within the pipeline I have multiple deployment steps for various parts of the staging environment.

I have configured the repository settings to group these deployments under Staging:

"Staging-step-1"
"Staging-step-2"

In my pipeline, I've configured some variables at the Repository level, and some additional Deployment specific variables at the Staging level. However, when I try and run the pipeline, the Staging Deployment variables are empty. Here's an example step:

 - step:
name: Build and deploy Lambda image on Staging
deployment: Staging-step-1
trigger: manual
size: 2x
services:
- docker
script:
- echo "Building container image"
- docker build --build-arg SHA=$BITBUCKET_COMMIT -t $MY_IMAGE_NAME .
- pipe: atlassian/aws-ecr-push-image:1.4.2
variables:
IMAGE_NAME: ${MY_IMAGE_NAME}
AWS_DEFAULT_REGION: ${AWS_DEFAULT_REGION}
AWS_ACCESS_KEY_ID: ${AWS_ACCESS_KEY_ID}
AWS_SECRET_ACCESS_KEY: ${AWS_SECRET_ACCESS_KEY}
- pipe: atlassian/aws-lambda-deploy:1.1.0
variables:
AWS_ACCESS_KEY_ID: ${AWS_ACCESS_KEY_ID}
AWS_SECRET_ACCESS_KEY: ${AWS_SECRET_ACCESS_KEY}
FUNCTION_NAME: ${MY_FUNCTION_NAME}
COMMAND: 'update'
IMAGE_URI: '${AWS_ACCOUNT_ID}.dkr.ecr.eu-west-2.amazonaws.com/${MY_IMAGE_NAME}:latest' 

In the above, all of the AWS variables are defined for the Repository, and they are set correctly. The rest of the variables (eg. MY_IMAGE_NAME) are set at the Staging Deployment level, and they come in blank.

What am I missing here?

1 answer

1 accepted

0 votes
Answer accepted

Hi Greg and welcome to the community!

You mention the following:

I have configured the repository settings to group these deployments under Staging:

"Staging-step-1"
"Staging-step-2"

Could you please clarify if you have created additional deployment environments with the names Staging-step-1, Staging-step-2? If so, are the deployment variables defined for these environments?

For the example you included in your post, the variable MY_IMAGE_NAME will need to be defined for the environment with the name Staging-step-1.

Based on your description, it sounds that you may have defined the variable for the environment named Staging only, which would explain why the variables are empty. Even if you create multiple staging environments, each of them is separate and cannot read variables set for a different staging environment.

I would suggest double-checking if the rest of the variables are set for the deployment environments where you're using them, e.g. Staging-step-1, Staging-step-2, and if not, define them there. Please feel free to let me know if this helps or if you're still facing issues.

Kind regards,
Theodora

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Bitbucket

📣 Calling Bitbucket Data Center customers to participate in research

Hi everyone, Are you Bitbucket DC customer? If so, we'd love to talk to you! Our team wants to dive deep to understand your long-term plans regarding Bitbucket DC and Atlassian Cloud. Do you plan...

218 views 2 5
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you