Welcome to the Inedo Forums! Check out the Forums Guide for help getting started.
If you are experiencing any issues with the forum software, please visit the Contact Form on our website and let us know!
Proper script to create Map variable
-
First off, can I create a map variable in the pipeline variables?
If so what would be the format to create one that has a content something like the Deployment Variables, multiple sets of values.
I've tried searching online but I couldn't find any examples like this.
Product: BuildMaster
Version: 5.6.8
-
You mean something like this?
set %ImAnEmptyMap = %(); set %RectangleProperties = %(Sides:4,Color:blue,Coordinates:%(x:10,y:15),Environments:@(Dev, QA, Prod));
https://inedo.com/support/documentation/otter/reference/otter-script/formal-grammar
The formal definition of a map
one of:
- a variable_expression for a map (%) type, or a
- a % character followed by left-parens ((), and any number of key-values pairs delimeted with commas (,), followed by a right-parens ()). A key-value pair consists of any_name, followed by a colon (:), followed by a literal_expression
Also yes you can create a map variable in the pipeline variables.
-
something more like this, but proper format:
set %shapes = %({type:square,size:7},{type:rectangle,size:9})
Also hoping to do this in pipeline variables.
I do have a workaround by using multiple maps with different names but the same key names but I was just wanting to see if this type of thing could be done.To better explain, I need to deploy multiple service instances for customers on our server with each having a unique name and several other settings but all using the same files. So I'm looking to loop through map keys to get the values I need for each one. (don't judge it's old software! ;-D)
-
It sounds like you want to create a list of maps.
set @MyConfigurations = @(%(type:square,size:7),%(type:rectangle,size:9));
-
Yes, that is what I'm looking for. Sorry I didn't say it that way but I didn't think that was possible based on the docs, I thought having the sub-types like that was only in the maps.
I tried that out and it works perfectly for me.Thanks!