You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 11 Next »

Variables

Variables can be used throughout Continua and created at certain levels in the hierarchy. Environment variable are there by default and cannot be changed, they're the last variable namespace checked when determining a variable's value. The next level of variables checked at the Application level which is the highest level a user can define a variable. A variable defined in the Application namespace can be used anywhere in Continua. The next level of variables are for projects which are defined on the project wizard page followed by configuration variables which are on the configuration wizard page. The final variable namespace and the one at the top of the hierarchy is the Build Namespace. There are 3 ways to define a build level variable. When a build is triggered (defined when creating the trigger), when manually starting a build that prompts for variables and when setting a variable in a stage using the Set Variable Action. Variables can have a value type of Text, Numeric or Expression. Expression variables can contain references to other variable or objects. Variables can later be referenced using the Objects and Expressions Syntax.

Objects & Expressions

Throughout Continua you will come across input fields which accept Expressions in their value. Expressions are built up at design time then evaluated at run time. An Expression can reference a Continua Variable or a Continua Object. The UI differentiates these two types by starting and ending an Expression with the "%" character for variables and a "$" character for objects, these two keys will be referred to as "starting keys". A Variable Expression would look something like "%Configuration.MyOwnVariable%" and an Object Expression would look something like "$Build.BuildNumber$". To determine if an input field accepts Expressions as values, press a starting key and wait for the auto-complete drop down to appear below the input field.

Here's an example of pressing the Continua Object starting key.

The auto-complete drop down for a Continua Object contains a list of selectable options of object and value type. If an item in the drop down has a  icon next to it, it's an object type. Object types mean the object has children which can be object and value types. For example, in the drop down in the image above, "Build" has the object icon which means it's an object type. When selecting the Build option you will see a new list of items of that belong to the build. Value types are denoted by the  icon. Value types have no children and are the last selectable item in the drop down.

Note: It's possible for object types with children to be used as value types since they can have a default value. This is explained below in the Default Values section.

 

Here's an example of pressing the Continua Variable starting key.

The auto-complete drop down for a Continua Variable is similar to Continua Objects. Value types are also denoted by the  icon and are named after the name of the variable. The equivalent object type for variables is denoted by the folder icon  and represent a variable namespace. Namespaces are capable of having children which are the variables in that particular namespace.

 

Drop Down Usage and Auto Complete Shortcut keys

Navigating the drop down is possible by using the Up, Down, Home and End keys. Up and Down will highlight the previous or next item in the list, respectively. Home highlight the first item in the list and End highlights the last.  The drop down will display a maximum of 10 items but you can get to the other items by using the Up/Down keys. Home and End only applies to the viewable items in the drop down.

To select an item you can use either Enter or Space. When using Enter on a value type item, the cursor will be placed after the closing character of the expression since value types have no children you can get values from. If the type is an object then Enter will place the cursor at the end of the selected object's text and before the closing character of the expression. To get the next list of options in the drop down for that object type, press the period key. Alternatively, you can use Space to select an item. If the item selected is a value type then the expression will be completed and a space added at the end of the closing character. If the item selected is an object type, Space will complete the expression and put the cursor immediately after the closing character.

As you type in the middle of the expression, the drop down list will filter its results based on the text entered. While the cursor is in the middle of an expression you can also use the key combination of [CTRL]-[.] or [CTRL]-[Space] to display the drop down with available options. The auto-complete behavior will come into effect and take into account what has already been entered into the expression to formulate the selectable items in the drop down.  

 

Default Values

Some object types are overloaded to behave like both objects and values. The most common time an object will be used as a variable is when an expression is used to get a repositories' source directory. For example, if I want to refer to a build's version I would use the expression "$Build.Version$". However, when typing that into an input field, you will note that "Version" is an object type that has children objects ("Default" and "DotNet"). If you select the "DotNet" item you will then get a drop down of items which are all value types ("Major", "Minor", "Build", "Revision"). If you wanted to get only the major version value of your version string then you would use the expression "$Build.Version.DotNet.Major$". Build Version is only one example where you may want to use the default value and not any of its children.

Here's a list of other important object types that have default values:

 

ExpressionValue
$Source.YourRepository$

The path to your Source directory within a build's workspace.

Equivalent to $Source.YourRepository.Path$

$Date$

Defaults to local time (of server).

Equivalent to $Date.Local$

$Server$

Default to Server Name.

Equivalent to $Server.HostName$

 

 

 

 

  • No labels