Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Expressions and Starting Keys

Throughout Continua CI 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 either a Continua CI variable or a Continua CI object.

Continua CI differentiates between variables and objects by starting and ending an Expression with the "%" character for variables and a "$" character for objects. These two keys are known as starting keys.

For example, 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 either the "%" or "$" key while targeting the input field and wait for the auto-complete drop down to appear.

Objects

The auto-complete drop down for a Continua CI object contains a list of selectable objects and values. If an item in the drop down has a Image Added icon next to it, it's an object. Objects have children which are also objects and values. For example, in figure 1, "Build" has the object icon which means it's an object. When selecting the Build option you will see a new list of items that belong to the build (see figure 2).

Values are denoted by the Image Added icon. Value types have no children and are the last selectable item in the drop down. In figure 2, BuildNumber is an example of a value.

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.

 

Figure 1. An example of the drop down created by pressing the object starting key, "$".

Image Added

 

Figure 2. An example of the "Build" object's children.

Image Added

Variables

Variables can be used throughout Continua CI and can be created at all levels of Continua CI. They are used to pass dynamic values into the build process. When a build is ready to run, it pulls the value from one of the following variables:

...

The values of Application, Project and Configuration variables cannot be modified during a build. Their values will not change over the course of a build. To access these variables using the query syntax (this is explained in greater detail below), you would prefix the variables with their namespace. Eg. %Application.MyVariable%%Project.MyVariable%%Configuration.MyVariable%. Alternatively, you can choose to not specify a namespace for a variable. If no namespace is provided then it will try and get the value for that variable by searching the namespaces from the bottom up (see figure 1). Not prefixing your variable with a namespace is the only way to access build namespace variable values. It's also a simple way to allow namespaces to override their parents.

The auto-complete drop down for a Continua CI variable is similar to the Continua CI objects dropdown (see figure 3). Value types are also denoted by the Image Added icon and are named after the name of the variable. When working with variables, variable namespaces are used instead of objects and these are represented with the folder icon Image Added. Namespaces are capable of having children which are the variables in that particular namespace.

 

Figure 3. An example of the drop down created by pressing the variable starting key, "%".

...

Image Added

Working with Variables

Given

Variable Example

...

you have the following:

A project variable called %MyVariable% with a value of 1.

A configuration variable also called %MyVariable% with a value of 2.

These are the results you would get if you referred to these variables:

referring to %MyVariable% would return 2 (as there is no build variable called %MyVariable%, the build pulls the value from the configuration, not the project, as the configuration is further down the hierarchy).

%Configuration.MyVariable% would return 2 (retrieves the configuration variable as it has been specifically called).

%Project.MyVariable% would return 1 (retrieves the project variable as it has been specifically called).

If you ever change the value of a non-build variable during the build process, you are actually creating a new variable in the build namespace. This variable will have the same name and as you are now dealing with a build variable, you will need to refer to it without a namespace prefix for the remainder of the build.

For example, given the %MyVariable% values above:

If you assign the value 3 to %MyVariable%, you will create a new variable called %MyVariable% in the build namespace.

These are the new results you would get referring to %MyVariable%:

%MyVariable% would return 3 (This returns the value of the build variable)

%Configuration.MyVariable% would return 2 (This value never changed)

%Project.MyVariable% would return 1 (This value never changed)

Defining Variables

The method used to declare variables is different differs depending on the variable level.

...

  • Text variables can take standard string and text inputs
  • Numeric variables can take any numeric value.
  • Expression variables. These can contain references to other variables and objects in Continua CI.

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.

Image Removed

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 Image Removed 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 Image Removed 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.

 

...

  • .

...

The auto-complete drop down for a Continua Variable is similar to Continua Objects. Value types are also denoted by the Image Removed icon and are named after the name of the variable. The equivalent object type for variables is denoted by the folder icon Image Removed 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 ] highlights 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 left mouse click), [Space] or [SpaceTab]. 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.  

 

Object Default Values

Some object types objects 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.

...