Welcome
YAML and JSON Variables Loader is a Bamboo plugin to load build and deployment variables from YAML and JSON files. It is similar to the built in Inject Bamboo Variables task but supports files with either YAML or JSON properties.
- 1 Task Configuration
- 2 Bamboo Variable Naming
- 2.1 YAML Example
- 2.1.1 YAML File
- 2.1.2 Bamboo Variables
- 2.2 JSON Example
- 2.2.1 JSON File
- 2.2.2 Bamboo Variables
- 2.1 YAML Example
- 3 Debugging Tips
- 4 Issues
- 5 Development
Task Configuration
Configuration of the task simply requires specifying the path of your YAML or JSON file and selecting whether the extracted variables should be of Job or Result scope.
Job scoped variables have local scope and they cease to exist when the job finishes.
Result scoped variables persist beyond the execution of a Job and are passed into subsequent stages or related deployment releases.
Bamboo Variable Naming
The names of the variables follow these rules:
each nested map/dictionary entry is separated by a period, e.g. application.name
arrays are indexed using brackets, e.g. [0]
All variable names are prefixed with bamboo. based on how Bamboo variables function. See the Atlassian documentation on Bamboo variables for more details.
This scheme is most easy understood using examples.
YAML Example
YAML File
---
description: Application Configuration
applications:
- name: my-app
routes:
- route: example.com
- route: www.example.com/foo
- route: tcp-example.com:1234
env:
greeting: hello
BUNDLE_WITHOUT: test:development
stuff: otherThe variables that will be set are:
Bamboo Variables
bamboo.description=Application Configuration
bamboo.applications[0].name=my-app
bamboo.applications[0].routes[0].route=example.com
bamboo.applications[0].routes[1].route=www.example.com/foo
bamboo.applications[0].routes[2].route=tcp-example.com:1234
bamboo.applications[0].env.greeting=hello
bamboo.applications[0].env.BUNDLE_WITHOUT=test:development
bamboo.stuff=other
JSON Example
JSON File
{
"applications": {
"test-app": {
"one": "value",
"two": "value2"
}
},
"services" : [
"service1", "service2"
]
}The variables that will be set are:
Bamboo Variables
bamboo.applications.test-app.one=value
bamboo.applications.test-app.two=value2
bamboo.services[0]=service1
bamboo.services[1]=service2Debugging Tips
The built in Dump variables to log task is useful when trying to understand what variables have been loaded and what their keys are.
Issues
Create a new issue here.
Development
The project can be found at https://bitbucket.org/dehringer/bamboo-yaml-variables-loader.