Package Meta Processing
Monteur has a special metadata processing function for keeping its CI Job sane and maintainable. The inner mechanics are explained here!
The Problem
It was all started with a very messy mathematical problem. Say
a build variant linux-amd64
is required to be
packaged into 3 different distribution channels:
.appimage
.deb
.tar.gz
1 x 3 = 3
SAME CI job
recipe files.
Now, try to deploy a full list of build variants for the same list of channels above, let's say:
linux-arm64
linux-arm
darwin-amd64
darwin-arm64
windows-amd64
windows-arm64
6 x 3 = 18
SAME CI job
recipe files! If we scale things in a mathematical way, that's
a total of m x n
duplicated CI job recipe files for
a project supporting m
number of build variants for
n
of distribution channels.
That is A LOT of duplications which is extra ordinary scary and unmaintainable! This means that we need a solution to scale the CI Job not just horizontally across each different distribution channel but also vertically across each build variant.
The Solution
To solve the problem above, Monteur uses this Package Meta Processing approach to facilitate the vertically scaling for any amount of build variants. The idea is to:
Keep the CI Job recipe specific to the distribution channel (means scaling horizontally).
Each recipe lists out all the build variant and package them repeatedly based on the recipe (means scaling vertically).
Current Deployment
Currently, this function is deployed in the following CI Jobs:
Built-In Packagers
Monteur offers a list of built-in packagers to provider
cross-platform supports as far as possible for applicable CI Job
like
Package CI Job. To select a packager in the recipe,
simply set Metadata.Type
as shown below:
|
|
Currently, these are the available packagers:
manual
EXTERNAL - Perform the packaging manually via the recipe's CEU commands.
Available since Monteur version
v0.0.1
.
deb-manual
EXTERNAL - Perform the
.deb
packaging manually using third-party software likedebuild
via the recipe's CEU commands.Available since Monteur version
v0.0.1
.
targz
BUILT-IN - Perform the
.tar.gz
packaging using built-intargz
function.Available since Monteur version
v0.0.1
.
zip
BUILT-IN - Perform the
.zip
packaging using built-inzip
function.Available since Monteur version
v0.0.1
.
Data Structure
To operate this function, Monteur uses a single unified data
structure. Please keep in mind that not all fields are used in a
CI Job recipe. You should consult the CI Job's documentation for
specific fields' availability and purpose.
The full data structure is shown below:
|
|
Package.(ID)
Label of the package. the
(ID)
can be anything as long as period (.
) is not used.(ID)
data map is used to uniquely sort each package to a single entry. That being said, any same(ID)
data structure comes later will overwrite its existing entry.Recommends to use Platform Identification IDs as
(ID)
likelinux-amd64
for consistency and mental sanity sake.
Example:[Packages.linux-amd64]
Available since Monteur version
v0.0.1
.
Package.(ID).OS
List of supported operating system. The FIRST value is given priority for any single value filling.
Can be used as
.PkgOS
(first value) in Variables Formatting for supported fields.Available since Monteur version
v0.0.1
.
Package.(ID).Arch
List of supported CPU architecture. The FIRST value is given priority for any single value filling.
Can be used as
.PkgArch
(first value) in Variables Formatting for supported fields.Available since Monteur version
v0.0.1
.
Package.(ID).Name
Naming pattern for the package's filename without the file extension.
Variables Formatting function is available for formulating the pattern dynamically.
Depending on the packaging program, this field can be overwritten (e.g.
debuild
has its own strict naming pattern.Available since Monteur version
v0.0.1
.
Package.(ID).Distribution
List of distribution series in a distribution channel. Example:
stable
,unstable
,experimental
,debian
,ubuntu
,bullseye
, and etc.When in doubt, stick to:
stable
,unstable
, andexperimental
.Introduced and used by Release API.
Available since Monteur version
v0.0.1
.
Package.(ID).Changelog
States the location of the changelog data file.
Variables Formatting function is available for formulating the pathing dynamically.
Introduced and used by Package API.
Available since Monteur version
v0.0.1
.
Package.(ID).BuildSource
Decision to package source codes depending on the packager program.
Value can be either
true
orfalse
.Introduced and used by Package API.
Available since Monteur version
v0.0.1
.
Package.(ID).Source
Package filepath.
Variables Formatting function is available for formulating the pathing dynamically.
Introduced and used by Release API.
Available since Monteur version
v0.0.1
.
Package.(ID).Target
Release destination directory.
Variables Formatting function is available for formulating the pathing dynamically.
Introduced and used by Release API.
Available since Monteur version
v0.0.1
.
Package.(ID).Files
The list of files for packaging in a
KEY:VALUE
pattern. TheKEY
is the destination while theVALUE
is the source of the file.Variables Formatting function is available for formulating the pathing dynamically for both
KEY
andVALUE
accordingly.For safety reason, files are copied over instead of move.
Should the destination has a different filename, the copied file shall be renamed accordingly.
Example, for
'{{- .PackageDir -}}/License.pdf' = '{{- .LicensePath -}}'
, a file located in.LicensePath
shall be copied into.PackageDir/
directory and renamed asLicense.pdf
.Introduced and used by Package API.
Available since Monteur version
v0.0.1
.
Epilogue
That's all for Monteur's Package Meta Processing function. If you have any question, please feel free to raise your question at our Issues Section.