Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

JSON Configuration transformation (dev coming from Octopus to BB Pipelines / Deployments)

josh
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
October 2, 2024

We're coming from Octopus deploy - where app configuration is a first class citizen. You can scope configuration values by target, role, environment - almost anything you want.

In deploy steps you can even specify all the files you need "transformed" (I.E. find all appsettings.json files and transform them with the values stored in Octopus).

While this is awesome - we want to simplify all of our building and deploying into one system (and just bitbucket pipelines + deployments).

But the one hurdle I can't get over is: BB only supports storing and referencing variables (at the workspace/repo/environment levels). 

Sure, I can reference each variable one by one in my bitbucket-pipelines.yml file. But we have hundreds of variables.

Is there maybe a pipe I'm missing to "transform all .json/xml files with same-named-variables stored in the BB environment variables"?

1 answer

0 votes
Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
October 4, 2024

Hi Josh and welcome to the community!

There is no such feature available in Bitbucket Pipelines. You could store variable definitions in an .env file, e.g.

export myvar=somevalue

You can then either commit the file in the repo or store it elsewhere (e.g. the Downloads section of the repo) and download it during the step. Then, you can source the file during the step, e.g. if the file is named build.env

- source build.env

and the variables will be available for this step.

If you have workspace, repository, or deployment variables with the same name as in the build.env file, then sourcing this file is NOT going to change the value of these variables in the respective settings. It will only change their value for this specific step after you source the file. So, if you run another step where you don't source the file, the variables are going to be retrieved from workspace, repository, or deployment variables settings.

If you use deployment variables with the same name for different deployment environments, then you'd need a different .env file for each environment.

Kind regards,
Theodora

Suggest an answer

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

Atlassian Community Events