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

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

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

YAML anchors + Overriding + Reusing deployment variables Edited

So here is a doozy

  1. For some reason bitbucket does not allow us to use the deployment variables for more than on step.
  2. To get around this we are passing in variables through the use of artifacts to the next step.
  3. As one of those variables is an AWS Key we obviously don't want to pass that off as an artifact to leave out in the open.
  4. To get around this we are creating a separate AWS variable at the repo level for each environment.

The problem is if you are reusing steps vs YAML anchors (say s3 deploy pipe), how would you get the right AWS variable to be called in the reused pipes? Sample code below. So say I have different keys for Dev and UAT

definitions:
- step: &build-and-deploy
name: Build And Deploy
script:
- pipe: atlassian/aws-s3-deploy:0.2.4
variables:
AWS_ACCESS_KEY_ID: $AWS_ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY: $AWS_SECRET_ACCESS_KEY
pipelines:
branches:
dev:
- step: *build-and-deploy
uat:
- step: *build-and-deploy

 

 

 

2 answers

@Ming Han Chung I have the same issue. I want to reuse codedeploy pipe and replace the value of DEPLOYMENT_GROUP.

 master:
- step: *build
- step:
<<: *deploy
name: Deploy to Prod
deployment: production
trigger: manual
script:
variables:
DEPLOYMENT_GROUP: 'production-deployment-group'

@Abryan Manalansang  did you get a solution to this?

likewise! This would save me a lot of effort

There a possible hacky solution here: https://community.atlassian.com/t5/Bitbucket-questions/Bitbucket-Pipeline-Using-a-different-environmental-variable/qaq-p/1023246

Basically use a step that writes env vars to a file and pass that around... 

Suggest an answer

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

Announcing the waitlist for Jira Work Management

Hey there Cloud Community members! We’re excited to give you the first glimpse of the new home for business teams on Jira — Jira Work Management. Jira Work Management is the next generation of J...

642 views 10 16
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