Prepare

Monteur provides Prepare CI Job to update the repository for the next cycle of build, package, release, and etc.

The objective of the job is simple: to prepare and update the repository project data for the next build, package, release, and etc.

This job is available since Monteur v0.0.2.

All users has to do is to issue this command:

1
montuer prepare

Job Level Configurations

Montuer does facilitate a job-wide configurations file for configuring Prepare 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/prepare/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 Variables Section

The Monteur's Variables Processing features. All variables defined in this job-wide configuration file only visible to ALL Prepare 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 Prepare CI Job's recipe configuration files are stored in:

1
.configs/monteur/prepare/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 = 'DEB Changelog Update'
Description = """
Generating/Updating .deb persistent changelog files.
"""
Type = 'deb'
  • 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 - denotes the output changelog format. See Changelog Meta Processing Specification for supported formats.

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
11
12
13
14
15
16
17
18
19
20
21
22
...

[Variables]
License = """//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
"""

[FMTVariables]
CodeFilepath = '{{- .RootDir -}}/gopkg/monteur/internal/libmonteur/Version.go'
EditFilepath = '.configs/monteur/app/config/en/metadata.toml'

...

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 = 'Go'
Condition = 'all-all'
Type = 'command'
Command = 'go'

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

...

Recipe's Changelog Meta Section

The Monteur's Changelog Meta Processing feature. This features opreate in a way to source a changelog entry data before executing the recipe's commands, allowing the CI Job recipe full flexibility to obtain pinpoint accuracy.

The data structure is entirely compliant to Changelog Meta Processing Specification of your selected Metadata.Type. If needed, the recipe's changelog meta section consists 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
37
38
39
40
41
42
43
44
45
46
[Changelog]
LineBreak = "\n"
Regex = ''

[[Changelog.CMD]]
Name = "Fetch All Local Remote Branches To The Latest"
Type = 'command'
Condition = [ 'all-all' ]
Source = 'git fetch --all'

[[Changelog.CMD]]
Name = "Get Changelog Data from Git Log Between Branches"
Type = 'command'
Condition = [ 'all-all' ]
Source = """git --no-pager log \
"{{- .ChangelogTo -}}..{{- .ChangelogFrom -}}" \
--pretty="format:%h %s"
"""
Save = "ChangelogEntries"




[Packages.linux-amd64]
OS = [ 'linux' ]
Arch = [ 'amd64' ]
Distribution = [
        'stable',
]
Changelog = '{{- .DataDir -}}/debian/changelog-{{- .PkgArch -}}'

[Packages.linux-arm64]
OS = [ 'linux' ]
Arch = [ 'arm64' ]
Distribution = [
        'stable',
]
Changelog = '{{- .DataDir -}}/debian/changelog-{{- .PkgArch -}}'

[Packages.linux-armhf]
OS = [ 'linux' ]
Arch = [ 'armhf' ]
Distribution = [
        'stable',
]
Changelog = '{{- .DataDir -}}/debian/changelog-{{- .PkgArch -}}'

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
17
18
19
20
21
22
23
24
...

[[CMD]]
Name = 'Delete Existing Version Codes'
Type = 'delete-quiet'
Condition = [ 'all-all' ]
Source = '{{- .CodeFilepath -}}'

[[CMD]]
Name = 'Script Go Codes'
Type = 'script'
Condition = [ 'all-all' ]
Source = """
// Copyright {{ .App.Time.Year }} {{ .App.Contact.Name }} ({{- index .App.Contact.Email 0 -}})
{{ .License }}
// **WARNING**: auto-generated file. Please alter at:
// {{ .EditFilepath }}

package libmonteur

const (
        VERSION = "{{- .App.Version -}}"
)
"""

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: