Commands Execution Unit

Monteur supplies its own Commands Execution Unit. To ensure its portability across various platforms, most of the commands are natively implemented. This section explains how Monteur operates its Commands Execution Unit.

Data Structure

Monteur’s Commands Execution Unit uses a set of variables arranged in an array of instructions. Each unit has a standardized list of fields shown as follows:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
[[CMD]]
Name = 'Get Publish Branch First Commit for Cleaning'
Condition = [ 'all-all' ]
Type = 'command'
Location = '{{- .WorkingDir -}}'
Source = 'git rev-list --max-parents=0 --abbrev-commit HEAD'
Target = ''
Save = 'FirstCommitID'
SaveRegex = '(\w*)'
SaveStderr = true
ToSTDOUT = '{{- FirstCommitID -}}'
ToSTDERR = 'Completed obtaining first commit ID'

The Commands Execution Unit definition is declared by the CI Job. Example, in Setup, you get [[Setup]] instead of [[CMD]]. Please refers to the CI Job documentation.

Execution Sequences

This section explains Monteur’s steps of executing each of its available commands. There are 2 main activities:

  1. The chain of commands are parsed and validated that its Type is supported by the runtime Monteur.
  2. The executions of the chain of commands.

Step 0: Validate Monteur’s Supporting Commands

During the TOML data file parsing for chain of commands, Monteur will check through each command’s Type is within its supporting range. Otherwise, Monteur shall raise an error without executing any of the commands.

Otherwise, Monteur will begin executing the chain of commands.

Step 1: Process the Current Command

The Commands Execution Unit will then process Location, Source, and Target with Variables formatting.

At this point, should there be any processing errors (e.g. bad formatting clauses), Monteur shall raise that error and the chain of commands is stopped.

Step 2: Executing The Command

Once all validation and processing are completed, Monteur will then execute the command and generate its output data (can be structural depending on command Type).

Step 3: Process Save

If Save is set, the generated output is then saved into the Variables List based on the command Type. Should there be any existing variable with the same Key value (with Save), Monteur shall overwrite the existing value with the command output.

Step 4: Repeat Step 1 for Next Command

The Step 1 process is then repeated for the next command in line. Otherwise, the chain of commands is completed.

Available Commands

Monteur shall continuously add new commands from time to time. These are the currently available commands sorted by Type.