Skip to content

feat(packaging): add the shared nfpm and check-descriptions actions - #13

Merged
kduret merged 6 commits into
mainfrom
MON-216366-shared-nfpm-action
Nov 30, 2026
Merged

kduret merged 6 commits into
mainfrom
MON-216366-shared-nfpm-action

Conversation

@kduret

@kduret kduret commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

Description

Two more actions for the packaging package. First, packaging/nfpm, the shared version of the local package-nfpm / package actions (6 repositories, 15 variants once their maintained branches are counted). Both go in the same packaging 1.0.0 release as parse-distrib.

  • Builds one rpm or deb per nfpm configuration matching a pattern, caches the packages and optionally uploads them as an artifact.
  • It relies on what nfpm does itself instead of editing the configurations with sed: configurations read ${COMMIT_HASH} and their other values as variables (with expand: true on the contents entries using one in a path), the key file variable decides the signature, and --target writes the packages in the working directory.
  • The one thing written in a configuration is @APACHE_USER@ / @APACHE_GROUP@: nfpm does not read the owner of a file from the environment.
  • Inputs beyond the obvious ones: deb_release, deb_copyright and allow_unsigned. What a single repository needs stays in its workflows; the README lists, per repository, the inputs and the changes its switch needs.

The switch of a repository therefore changes its configurations too (@COMMIT_HASH@ to ${COMMIT_HASH}, and for a few @luaver@ or @PHP_MIN_VERSION@ to variables), in the same pull request as its workflows.

Second, packaging/check-descriptions: the check-package-descriptions.py script that centreon, centreon-collect and centreon-modules each carry (identical on 11 branches), moved here unchanged. Every nfpm package must have its own synopsis and rpm summary. It needs PyYAML: it uses the one of the runner, installs a pinned version in a temporary environment when there is none, and fails with a clear message when it cannot.

Behavior changes of packaging/nfpm a reviewer cannot guess from the diff:

  • The signing key file is written outside the workspace and removed when the step ends; the local copies left key.gpg in the workspace.
  • An rpm without a signing key fails the step, with a clear message; allow_unsigned: "true" builds it unsigned instead, which centreon needs for the pull requests coming from forks. The key is only written for an rpm build.
  • nfpm runs in the directory of the configuration, as in the Centreon repositories: relative paths of a configuration start there.
  • An @UPPERCASE@ placeholder left in a configuration fails the step in every repository; centreon-agent had no such check.
  • package_extension and stability are no longer inputs. NEXT_MAJOR_VERSION needs no branch-specific code: six months later before 26.10, the next month since.
  • Every deb takes the same distribution suffix. centreon-stream-connector-scripts used its own: its debs become <release>+deb12u1 instead of <release>~bookworm, which Debian sorts as newer for the same release.
  • nfpm 2.39.0 or later is required, and an older one fails the step: it is the first version reading variables in a description (2.38.0 and before ship ${COMMIT_HASH} as is). The repositories use 2.41.0 to 2.43.4, except centreon-stream-connector-scripts (2.35.2), which upgrades when it switches.
  • The packages are cached with actions/cache/save v6.1.0; the callers restore them with older versions of the action.

Equivalence with the local copies:

  • Each of the 15 variants (develop, dev-26.10.x, dev-25.10.x, dev-24.10.x of centreon, centreon-collect, centreon-modules; develop of centreon-plugins, centreon-stream-connector-scripts, centreon-agent) was run next to this script with a stand-in of nfpm, on 7 distributions, 4 stabilities and several versions, the configurations of the shared side being written the new way.
  • 1218 cases, 62994 values compared (the variables given to nfpm, the configurations once their variables are resolved, the files next to them, the signing key of the rpm builds, the packages): no difference, apart from centreon-stream-connector-scripts: its new LUA_VERSION variable, and the suffix of its debs, changed on purpose.
  • Checked with nfpm 2.41.0, 2.41.1 and 2.43.4 (2.39.0: the description only): description and contents paths with expand: true are expanded, the owner of a file is not, empty key variables build an unsigned rpm, and a passphrase-protected key gives an rpm carrying RSA and PGP signatures.

Tests and checks:

  • 30 bats tests on the nfpm script, 14 on the description check.
  • lint builds a real, unsigned package with nfpm 2.43.4 inside Debian and AlmaLinux containers, cache step included, and runs the description check on the package definition of this repository.

Not covered here, to check when the callers switch:

  • A build signed with the real key, the artifact upload, and the restore of the cache by the delivery jobs.
  • Container jobs on the self-hosted runners.

Fixes: MON-216366

Builds rpm or deb packages from nfpm configurations, caches them and
optionally uploads them. It relies on the variable expansion, the signing
rule and the target option of nfpm instead of editing the configurations.
@kduret kduret added enhancement New feature or request gha labels Nov 27, 2026
@kduret
kduret marked this pull request as ready for review November 27, 2026 13:36
@kduret
kduret requested review from a team as code owners November 27, 2026 13:36
tuntoja
tuntoja previously approved these changes Nov 30, 2026
@kduret
kduret dismissed stale reviews from tuntoja and mushroomempires via e35db83 November 30, 2026 08:04
The check of centreon, centreon-collect and centreon-modules, unchanged:
every nfpm package must have its own synopsis and rpm summary.
@kduret kduret changed the title feat(packaging): add the shared nfpm action feat(packaging): add the shared nfpm and check-descriptions actions Nov 30, 2026
Same errors as the Python script, without PyYAML nor the temporary
environment that installed it.
@kduret
kduret merged commit df0e2b2 into main Nov 30, 2026
6 of 12 checks passed
@kduret
kduret deleted the MON-216366-shared-nfpm-action branch November 30, 2026 08:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request gha

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants