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-arm64linux-armdarwin-amd64darwin-arm64windows-amd64windows-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:
manualEXTERNAL - Perform the packaging manually via the recipe's CEU commands.
Available since Monteur version
v0.0.1.
deb-manualEXTERNAL - Perform the
.debpackaging manually using third-party software likedebuildvia the recipe's CEU commands.Available since Monteur version
v0.0.1.
targzBUILT-IN - Perform the
.tar.gzpackaging using built-intargzfunction.Available since Monteur version
v0.0.1.
zipBUILT-IN - Perform the
.zippackaging using built-inzipfunction.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-amd64for consistency and mental sanity sake.
Example:[Packages.linux-amd64]Available since Monteur version
v0.0.1.
Package.(ID).OSList 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).ArchList 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).NameNaming 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.
debuildhas its own strict naming pattern.Available since Monteur version
v0.0.1.
Package.(ID).DistributionList 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).ChangelogStates 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).BuildSourceDecision to package source codes depending on the packager program.
Value can be either
trueorfalse.Introduced and used by Package API.
Available since Monteur version
v0.0.1.
Package.(ID).SourcePackage 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).TargetRelease 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).FilesThe list of files for packaging in a
KEY:VALUEpattern. TheKEYis the destination while theVALUEis the source of the file.Variables Formatting function is available for formulating the pathing dynamically for both
KEYandVALUEaccordingly.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.LicensePathshall 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.