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

Deployment variables not working with multiple staging

Greg Hinch September 23, 2021

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
Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
September 24, 2021

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
AUG Leaders

Atlassian Community Events