Setup

Monteur provides Setup CI Job to setup and get the repository ready for work - develop, test, build, package, release, etc.

The objective of the job is simple: to setup the repository all the way for other CI Jobs with consistency, minimal efforts, and now further instructions.

All users has to do is to issue this command:

1
montuer setup

Job Level Configurations

Montuer does facilitate a job-wide configurations file for configuring Setup CI Job over all settings and supplying job-wide variables.

The configurations, by default, are stored in the data file located in:

1
.configs/monteur/setup/config.toml

The file MUST be strictly named config alongside with the following supported data format's file extension. Currently, Monteur offers the following supported formats, arranged in priority by sequences: The file structure of the recipe configuration file is detailed from top to bottom in the following sub-sections, in sequences.

Job Level Download Settings

These settings affect all network downloads performances to avoid network starvation or abuses. The data structure of the settings are:

1
2
3
[Downloads]
Limit = 3
Timeout = 120000000000 # nanosecond
  • Limit - Setting the total downloads limit at a time. 0 or negative values denotes unlimited download activities.

  • Timeout - Instructs Monteur to bail out a network waiting and report as error after waiting a specific amount of time. The unit is nanosecond. The value MUST be positive value. Setting 0 or negative values denotes the default 2 minutes.

    Example, for 2 minutes duration, it is 2 x 60 x 1000 x 1000 x 1000 = 120000000000.

Job Level Variables Section

The Monteur's Variables Processing features. All variables defined in this job-wide configuration file only visible to ALL Setup CI Job recipes. It is highly recommended to place all project-based variables data into this list for recipes consistency purposes.

An example of the job-level variables section consists of the following fields:

1
2
3
4
5
6
[Variables]
Version = '1.17.3'
BaseURL = 'https://golang.org/dl/'

[FMTVariables]
Command = 'go{{- .Version -}}'

Recipe Configuration File

All Setup CI Job's recipe configuration files are stored in:

1
.configs/monteur/setup/jobs/

These files can have any filename BUT MUST STRICTLY HAVE any of the the following supported file extensions based on its data format of your choice: The file structure of the recipe configuration file is detailed from top to bottom in the following sub-sections, in sequences, and in the recommended TOML format.

Recipe's Metadata Section

The recipe's metadata section consists of the following fields:

1
2
3
4
5
6
[Metadata]
Name = 'Go Programming Language'
Description = """
Setup Go Programming Language for compiling Go source codes.
"""
Type = 'https-download'
  • Name - used for recipe identification, reporting, and referencing usage. Monteur recommends keeping it short, concise and without any weird symbols (e.g. space will be replaced by short dash (-)).

  • Description - mainly for logging and reporting purposes. Describe the details of the recipe.

  • Type - defines the dependency sourcing method. The availability and its working mechanics are detailed in Setup Meta Processing Specification.

Recipe's Variables Section

The Monteur's Variables Processing Specification features. All variables defined in this recipe's configuration file are visible ONLY to this recipe. It is highly recommended to abstract as much variables away from your command algorithm as possible so that your user only has to customize these tables and not messing with your algorithm.

The variables section consists of the following fields:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
...

[Variables]
Version = '1.17.3'
BaseURL = 'https://golang.org/dl/'

[FMTVariables]
SourceDir = '{{- .WorkingDir -}}/public'

...

Recipe's Dependencies Checking Section

The Monteur's Dependencies Checking features. All 3rd-party dependencies are listed and checked here against the running operating system for ensuring consistent performances and executions of this recipe.

The data structure is compliant to Dependencies Checking Specification. Here is a sample for this recipe:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
...

[[Dependencies]]
Name = 'Hugo for documentation purposes'
Condition = 'all-all'
Type = 'command'
Command = 'hugo'

[[Dependencies]]
Name = 'Git for version control'
Condition = 'all-all'
Type = 'command'
Command = 'git'

...

Recipe's Sources Section

The OPTIONAL list of sources' parameters. Its existences is entirely depends on the previous Metadata.Type, where some types requires it while some are not. The entire data structure are compliant to Setup Meta Processing Specification of your selected Metadata.Type.

If needed, the recipe's sources section consists of the following fields:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
[Sources.all-all]
Format = 'tar.gz'
URL = '{{- .BaseURL -}}{{- .Archive -}}'
Archive = 'go{{- .Version -}}.{{- .ComputeSystem -}}.{{- .Format -}}'
Method = 'GET'

[Sources.all-all.Checksum]
Type = 'sha256'
Format = 'hex'
[Sources.all-all.Headers]

[Sources.darwin-amd64.Checksum]
Value = '874bc6f95e07697380069a394a21e05576a18d60f4ba178646e1ebed8f8b1f89'

[Sources.linux-amd64.Checksum]
Value = '231654bbf2dab3d86c1619ce799e77b03d96f9b50770297c8f4dff8836fc8ca2'

...

Recipe's Commands Section

The list of executing commands complying to compliant to Commands Execution Unit (CEU) Specification. The commands are executed as instructed in the key recipe sections, usually either execute as per se after all meta processing OR being used to execute horizontally.

The data structure is entirely based on the Commands Execution Unit (CEU) Specification. An example of this recipe's commands section would be:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
...

[[CMD]]
Name = 'Delete Target for Installation'
Type = 'delete-recursive-quiet'
Condition = ['all-all']
Source = '{{- .BinDir -}}/golang'

[[CMD]]
Name = 'Install Go Programming Language Entire Directory'
Type = 'move'
Condition = ['all-all']
Source = '{{- .WorkingDir -}}/go'
Target = '{{- .BinDir -}}/golang'

...

Recipe's User Config Section

The recipe user config section is the operating system specific user configuration script. The data structure are detailed in Setup Meta Processing Specification.

Here is an example of the recipe's user config section consisting of the following fields:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
[Config]
linux = """
#!/bin/bash
export LOCAL_BIN="${LOCAL_BIN:-{{- .BinDir -}}}"
export GOROOT="${LOCAL_BIN}/golang"
export GOPATH="${LOCAL_BIN}/gopath"
export GOBIN="${GOPATH}/bin"
export GOCACHE="${LOCAL_BIN}/gocache"
export GOENV="${LOCAL_BIN}/goenv"

stop_go() {
        PATH=:${PATH}:
        GOROOT="${GOROOT}/bin"
        PATH=${PATH//:$GOROOT:/:}
        PATH=${PATH//:$GOBIN:/:}
        PATH=${PATH//:$GOPATH:/:}
        PATH=${PATH%:}
        unset GOROOT GOPATH GOBIN GOCACHE GOENV
}

case $1 in
--stop)
        stop_go
        ;;
*)
        export PATH="${PATH}:${GOROOT}/bin:${GOPATH}:${GOBIN}"

        if [ ! -z "$(type -p go)" ] && [ ! -z "$(type -p gofmt)" ]; then
                1>&2 printf "[ DONE  ] localized Go started.\\n"
        else
                1>&2 printf "[ ERROR ] localized Go failed to initalized.\\n"
                stop_go
        fi
        ;;
esac
"""
Currently, this is the last section of the recipe configuration file.

Known Recipes

Instead of working on all the recipes from scratch, Monteur does maintain a number of existing and continuously improved recipes to kick-start your compatible deployment. Here are the available recipes: