2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2026-08-03 07:57:00 +00:00
Commit Graph

27338 Commits

Author SHA1 Message Date
Daniel Hilst d621d7fc29 fix(xcat-core): treat signal-killed build workers as failures too
The parallel-build failure gate only inspected $exit_code in run_on_finish. A
ForkManager child killed by a signal -- SIGKILL, or the OOM-killer under the
concurrent build load -- is reaped with $exit_code == 0 but $exit_signal != 0
(and possibly $core_dump). Such a worker therefore was NOT recorded as a
failure, so the parent could still index and GPG-sign a repository that is
missing the package that worker was building -- the exact partial-repo hazard
the gate was added to prevent, via a path it did not cover.

Capture $exit_signal and $core_dump from the run_on_finish callback and fail
the build when any of $exit_code, $exit_signal, or $core_dump is set.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-07-30 19:03:00 -03:00
Daniel Hilst 0c26dc19f5 fix(xcat-core): make parallel buildrpms fail-closed and lock/cleanup-safe
Addresses three concurrency-safety defects raised in review of the parallel
buildrpms.pl work:

1. Per-target build lock was released immediately. The flock filehandle was a
   lexical (my $blk) scoped to the guard block, so it was destroyed -- and the
   lock dropped -- as soon as that block exited, before any worker forked. The
   "intentionally leaked" comment did not match the code. Hold the handle in a
   file-scoped $BUILD_LOCK_FH so the fd (and the lock) live for the whole
   process; forked children inherit the fd but their exits never release it.

2. Build failures were silently swallowed. buildspkgs()/buildpkgs() called
   sh_retry() in void context, so a mock build that failed all retries returned
   non-zero into the void; the child then exited 0 and the parent's run_on_finish
   ignored the exit code. The parent could therefore index and GPG-sign a repo
   that was missing packages and still exit 0. Now sh_retry failures die in the
   child, run_on_finish records any non-zero child, and the run aborts before
   update_repo and again before signing if any child failed -- never publishing
   a partial core.

3. Abort cleanup unmounted unrelated builds. sweep_mock_mounts() lazy-unmounted
   every bind under /var/lib/mock, which on a shared host tears out the live
   chroots of concurrent, unrelated builds. Scope it to this run's own chroots
   (each chroot dir plus its -bootstrap sibling), passed in from abort_builds.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-07-30 16:35:01 -03:00
Daniel Hilst 5d9286cfb7 fix(xcat-core): fold release-alias finalize into merge_core_repos
merge_core_repos already assembles the multi-arch core and runs the full
finalize tail (index -> sign -> final metadata -> write_release_alias, in the
required order so the xCAT-release-latest alias lands AFTER metadata and stays
out of the repo index). The preceding commit restored a separate finalize_core
sub purely to satisfy xcat_release_package.t, which grepped for
'sub finalize_core { ... $dir ... }'. That left two overlapping entry points:
--finalize-core (finalize one pre-assembled dir) and --merge-core-repos
(assemble N per-arch dirs THEN finalize) -- the former a strict subset of the
latter, with no in-tree or CI caller.

Consolidate on the single assemble+finalize path: inline the finalize tail into
merge_core_repos, drop sub finalize_core and the --finalize-core getopt/dispatch,
and update xcat_release_package.t to assert the stable alias is created after the
final metadata pass inside merge_core_repos ($out). Behaviour is unchanged (merge
already wrote the alias); only the redundant finalize_core interface is removed.
xcat_release_package.t 26/26; perl -c clean.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-07-30 13:07:06 -03:00
Daniel Hilst e20853681b fix(xcat-core): restore finalize_core so xCAT-release stable-alias test passes
The CI buildrpms.pl port (d2d98b724) renamed the upstream sub finalize_core($dir)
to merge_core_repos($out) and inlined its index/sign/metadata/alias tail. The
xCAT-release logic (write the xCAT-release-latest stable bootstrap alias AFTER the
final metadata pass, so it stays out of the repo index) was preserved, but the rename
broke xCAT-test/unit/xcat_release_package.t, which statically pins:
  sub finalize_core { ... write_repo_metadata_dir($dir); ... write_release_alias($dir); }
so 'assembled core repository creates the stable alias after final metadata' failed
(1 of 26), turning xcat_pr_test red on PR #7701.

Restore finalize_core($dir) as the shared finalize primitive (index -> sign ->
final metadata -> stable alias) and have merge_core_repos delegate to it on the
assembled multi-arch dir. Re-expose the --finalize-core CLI (single already-populated
dir) it also feeds. Behaviour is unchanged for both --merge-core-repos (CI) and
--finalize-core; only the shared code path is named again. xcat_release_package.t now
26/26; perl -c clean.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-07-30 12:13:13 -03:00
Daniel Hilst 75fd87e707 fix(xcat-core): clean mock buildroot before each build (--init), not reuse-dirty
buildrpms.pl built every package with mock -N (--no-clean), reusing the per-package
<pkg>-<target><ext> chroot across runs for flat disk. But a build aborted or killed
mid-flight leaves that chroot half-initialised with a corrupt rpmdb; the NEXT run
reused it and failed (cannot open Packages database .../usr/lib/sysimage/rpm),
producing an incomplete core (e.g. missing xCAT-test) that fails the deploy-time
completeness gate.

Re-init the buildroot (mock --init) right before building each package, after the
diskcache skip so it only runs when actually building. --init restores from mock's
root-cache tarball (cheap) so disk stays flat and builds stay fast; -N is kept on the
srpm/binary calls so they still reuse the freshly initialised root within the run.
This stabilises builds against corrupt state left by any previous failed/aborted build.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-07-29 09:51:27 -03:00
Daniel Hilst d2d98b7248 fix(xcat-core): port CI buildrpms.pl (parallel builds, multi-arch merge) into tree
The 3 EL CD pipelines (xcat-core-devel-cd, xcat-core-stable-cd, xcat-dep-el-cd)
overlaid a pinned $CI/buildrpms.pl at build time because the tree's buildrpms.pl
lacked the options they depend on:
  - a per-target flock guard alongside --mock-uniqueext, so concurrent same-target
    builds do not corrupt each other's /var/lib/mock chroot namespace;
  - --native-only (build only arch-native pkgs on the secondary arch) plus
    --merge-core-repos/--output-dir/--input-core-repos, replacing --finalize-core,
    to assemble one signed flat multi-arch core from per-arch build outputs;
  - sh_retry() to absorb transient mock/nspawn flakes;
  - a single --target guard and graceful mock cancellation
    (sweep_mock_mounts/abort_builds) that unmounts chroots on abort.

The xCAT-release repository package (master/2.19 only) is preserved: its
write_release_alias() is invoked from the new merge_core_repos() and per-target.

Porting them in-tree lets CI drop the $CI/buildrpms.pl pin and run the three
pipelines in parallel without the cross-job serialize lock.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-07-28 19:56:56 -03:00
Daniel Hilst e10fb869cb Merge pull request #7699 from VersatusHPC/fix/rhels9-ppc64le-pkglist-trailing-blank
fix(xcat-core): drop trailing blank line in rhels9 ppc64le pkglist
2026-07-28 17:40:46 -03:00
Daniel Hilst e3f3862280 fix(xcat-core): drop trailing blank line in rhels9 ppc64le pkglist
PR #7677 added xCAT-server/share/xcat/netboot/rh/compute.rhels9.ppc64le.pkglist
with a stray empty line at the end of the file. The reviewer asked for it to be
removed before merge, but it slipped through. A trailing blank line in a pkglist
is meaningless and inconsistent with the rest of the netboot package lists, so
remove it.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-07-28 16:44:22 -03:00
Daniel Hilst c811f2b1bd Merge pull request #7677 from VersatusHPC/fix/xcat-core-matrix-build
fix(xcat-core) Fixes to get internal CI green
2026-07-28 16:33:08 -03:00
Vinícius Ferrão 036bb24c87 fix(packaging): preserve xcatd init state on Debian (#7615)
* refactor(packaging): share precise systemd state detection

* test(packaging): cover precise systemd state detection

* test(packaging): allow explicit Debian init mode

* fix(packaging): honor explicit Debian init targets

* test(packaging): cover Debian init target detection

* fix(packaging): add Debian xcatd init state helper

* test(packaging): cover Debian xcatd init state helper

* test(packaging): allow delegated SysV registration

* fix(packaging): preserve Debian xcatd conffile lifecycle

* test(packaging): mirror explicit Debian init mode

* test(packaging): cover Debian xcatd conffile lifecycle

* fix(packaging): contain init state file umask

* test(packaging): cover init state permissions

* fix(packaging): contain preinstall context umask

* test(packaging): cover preinstall umask containment

* fix(packaging): detect all systemd enablement links

* test(packaging): cover all systemd enablement links

* test(packaging): allow shared purge state path

* refactor(packaging): reuse Debian init state path

* fix(packaging): detect runtime systemd masks

* test(packaging): cover runtime systemd masks

* test(packaging): model Debian SysV registration

* refactor(packaging): reuse shared init state detection

* test(packaging): enforce shared Debian state probes

* test(packaging): allow explicit unregistered masks

* fix(packaging): preserve Debian SysV registration state

* test(packaging): cover Debian SysV registration states

* fix(packaging): clean failed Debian state writes

* test(packaging): cover failed Debian state writes

* fix(packaging): retain unregistered systemd provenance

* test(packaging): cover unregistered systemd upgrades

* fix(packaging): fail closed on shared state errors

* test(packaging): cover shared state detector failures

* test(packaging): mirror native xcatd runlevels

* fix(packaging): recover rejected SysV layouts

* test(packaging): cover rejected SysV layouts

* test(packaging): cover SysV rebuild retries

* refactor(packaging): reuse systemctl readiness guard

* test(packaging): enforce shared systemctl guard
2026-07-28 19:31:36 +00:00
Daniel Hilst b5510dd017 Merge pull request #7696 from VersatusHPC/fix/buildrpms-release-alias
fix(buildrpms): only write xCAT-release-latest alias when the rpm exists
2026-07-28 15:56:10 -03:00
Daniel Hilst 9e7b281519 Merge pull request #7640 from VersatusHPC/refactor/openbmc-reuse-retry-after
refactor(openbmc): reuse retry scheduler for 503 responses
2026-07-28 15:53:10 -03:00
Daniel Hilst 18ef026fc5 Merge pull request #7638 from VersatusHPC/harvest/apache-security-hardening
fix(httpd): harden the xCAT Apache configuration
2026-07-28 11:05:42 -03:00
Daniel Hilst cf159d31aa Merge pull request #7691 from VersatusHPC/harvest/pxelinux
fix(xnba): warn instead of failing when pxelinux.0 is unavailable
2026-07-28 11:03:39 -03:00
Daniel Hilst b4a5a86b4b Merge pull request #7665 from VersatusHPC/harvest/genesis-ib-support
fix(genesis): find the boot NIC over InfiniBand (IPoIB)
2026-07-28 11:01:51 -03:00
Vinícius Ferrão 951562a45a test(httpd): require SLES service unit 2026-07-27 17:19:27 -03:00
Vinícius Ferrão ae0d790adb fix(xcatsn): name SLES Apache service unit 2026-07-27 17:19:27 -03:00
Vinícius Ferrão ddf4d35194 docs(httpd): align hardening guidance with defaults 2026-07-27 17:19:27 -03:00
Vinícius Ferrão f8267cb8f3 test(httpd): cover package activation across distros 2026-07-27 17:19:27 -03:00
Vinícius Ferrão 4c82e02a7b fix(httpd): reload hardened config after RPM upgrades 2026-07-27 17:19:26 -03:00
Vinícius Ferrão 06eced0951 test(httpd): verify security response headers
Signed-off-by: Vinícius Ferrão <2031761+viniciusferrao@users.noreply.github.com>
2026-07-27 17:18:57 -03:00
Vinícius Ferrão f6ba29ef80 build(spec): activate the hardened Apache headers on SUSE
The security response headers added to xcat.conf are wrapped in
<IfModule mod_headers.c>, so they only take effect where mod_headers is loaded.
EL loads it by default and the Debian postinst enables it with a2enmod, but SUSE
apache2 does not load it by default, so the headers stayed inactive there. Enable
it in the RPM %post for the apache2 case, guarded so it is a no-op on EL (where
a2enmod is absent and mod_headers is already loaded).

Verified on openSUSE Leap 15.6: mod_headers is off by default, the hardened
config still starts, and after a2enmod the served response carries all four
security headers. The need to load mod_headers on SUSE was identified in the
lenovobuild branch (660df81379 / xcat.conf.apach24.sles), here done via
a2enmod rather than a separate config file.

Co-authored-by: Jarrod Johnson <10814490+jjohnson42@users.noreply.github.com>
2026-07-27 17:18:57 -03:00
Vinícius Ferrão 9261a765bd fix(httpd): harden the xCAT Apache configuration
Add standard security response headers (X-Frame-Options, X-Content-Type-
Options, Content-Security-Policy, X-Permitted-Cross-Domain-Policies) to the
/install and /tftpboot directories, mask the server banner with
"ServerTokens Prod", and drop the Includes (SSI) and MultiViews options from
those file-serving directories. Indexes on /install/postscripts, /install/post
and the doc directory are left intact so directory browsing still works where
xCAT relies on it.

The Header directives are wrapped in <IfModule mod_headers.c> so a server
whose mod_headers is not loaded still starts cleanly instead of failing on an
unknown directive. On Debian/Ubuntu, where mod_headers is not enabled by
default, the xCAT and xCATsn package postinst scripts run "a2enmod headers"
before restarting Apache so the headers take effect there as well; on
RHEL/SLES the module is loaded by default and needs no action.

Recovered from the unmerged lenovobuild branch (originals 7ee0c129, 85c8bc09,
d4d1783a), adapted: the deprecated X-XSS-Protection header and the
mod_allowmethods-dependent AllowMethods directive are omitted, and the Header
directives use "set" rather than "append".

Co-authored-by: Jarrod Johnson <10814490+jjohnson42@users.noreply.github.com>
2026-07-27 17:18:57 -03:00
Vinícius Ferrão c4ea5e284f docs(xnba): update missing pxelinux warning 2026-07-27 16:32:40 -03:00
Daniel Hilst eb76ddfbb6 Merge pull request #7673 from VersatusHPC/refactor/network-address-accumulation
refactor(network): centralize address accumulation
2026-07-27 15:32:09 -03:00
Daniel Hilst c8562284ee Merge pull request #7672 from VersatusHPC/harvest/blade-findme-nodetype
fix(blade): only scan a node MPA during discovery if it is a blade
2026-07-27 15:30:16 -03:00
Daniel Hilst 5fb329d2dc Merge pull request #7671 from VersatusHPC/harvest/bmcsetup-robustness
fix(bmcsetup): settle after IBM port change and support long BMC passwords
2026-07-27 15:28:14 -03:00
Daniel Hilst aeaf4df315 Merge pull request #7676 from VersatusHPC/harvest/sle-root-partition-max
fix(sle): give the SUSE root partition the whole disk (align with RHEL/Ubuntu)
2026-07-27 15:22:58 -03:00
Vinícius Ferrão 1f56331435 test(xnba): cover conditional pxelinux warnings
Signed-off-by: Vinícius Ferrão <2031761+viniciusferrao@users.noreply.github.com>
2026-07-27 15:22:12 -03:00
Vinícius Ferrão 42e8ef64cc fix(xnba): warn only when pxelinux is required
Signed-off-by: Vinícius Ferrão <2031761+viniciusferrao@users.noreply.github.com>
2026-07-27 15:22:12 -03:00
Daniel Hilst 7ebb7ffc9a Merge pull request #7678 from VersatusHPC/refactor/ipmi-sha1-fallback
refactor(ipmi): centralize RMCP+ SHA1 fallback
2026-07-27 15:22:01 -03:00
Vinícius Ferrão 1d6ed6a4eb test(genesis): cover InfiniBand module packaging
Signed-off-by: Vinícius Ferrão <2031761+viniciusferrao@users.noreply.github.com>
2026-07-27 15:19:33 -03:00
Vinícius Ferrão 844a5ca2fa fix(genesis): include InfiniBand kernel modules
Signed-off-by: Vinícius Ferrão <2031761+viniciusferrao@users.noreply.github.com>
2026-07-27 15:19:33 -03:00
Daniel Hilst d4d9d5c859 Merge pull request #7690 from VersatusHPC/harvest/port80
fix(netboot): omit the default HTTP port from generated boot URLs
2026-07-27 15:15:18 -03:00
Daniel Hilst c7c548fbb3 Merge pull request #7628 from VersatusHPC/harvest/xnba-ipxe-mac-format
fix(xnba): use the iPXE-native MAC format on the BIOS boot path
2026-07-27 15:12:06 -03:00
Daniel Hilst e2c57c636d Merge pull request #7647 from VersatusHPC/refactor/probe-netplan-command-capture
refactor(probe): reuse command capture for netplan
2026-07-27 12:27:36 -03:00
Daniel Hilst 4e891c4eaa Merge pull request #7692 from VersatusHPC/harvest/genimagenote
fix(genimage): explain the harmless bus messages from the image chroot
2026-07-27 11:28:42 -03:00
Daniel Hilst 433bdf015b Merge pull request #7693 from VersatusHPC/harvest/cfglocorig
fix(xcatserver): keep the server-provided cfgloc before rewriting host=
2026-07-27 11:27:38 -03:00
Daniel Hilst f28ad8587e Merge pull request #7694 from VersatusHPC/harvest/grub2-protocol-regex
fix(grub2): anchor the netboot protocol validation regex
2026-07-27 11:24:20 -03:00
Daniel Hilst 5bae5b2700 Merge pull request #7675 from VersatusHPC/harvest/reboot-systemd-timer-suse
fix(postscripts): schedule the reboot with a systemd timer on SUSE
2026-07-27 11:21:49 -03:00
Vinícius Ferrão 3967b83290 Merge pull request #7622 from VersatusHPC/harvest/xcatconfig-upgrade-log-stderr 2026-07-27 11:14:36 -03:00
Vinícius Ferrão 5c7230f0f8 Merge pull request #7623 from VersatusHPC/harvest/buildcore-describe-tags 2026-07-27 11:14:12 -03:00
Daniel Hilst e5bc261811 Merge pull request #7667 from VersatusHPC/harvest/ipmi-fpc-neverwait
fix(ipmi): never rate-limit packets to an FPC during reseat
2026-07-27 11:11:52 -03:00
Daniel Hilst 8fc3a309a0 Merge pull request #7670 from VersatusHPC/harvest/macmap-cumulus-breakout
fix(MacMap): discover nodes on Cumulus breakout ports (swpNsM)
2026-07-27 11:09:39 -03:00
Daniel Hilst a7455df957 Merge pull request #7649 from VersatusHPC/harvest/pasu-onecli-output-filter
fix(pasu): filter more OneCLI status banner lines from command output
2026-07-27 11:04:44 -03:00
Daniel Hilst caffd43e2d Merge pull request #7660 from VersatusHPC/harvest/ipmi-lenovo-recognition
fix(ipmi): recognize additional Lenovo IMM firmware prefixes and energy code
2026-07-27 10:55:02 -03:00
Daniel Hilst 34fd97ae63 Merge pull request #7666 from VersatusHPC/harvest/esx-esxboot-fallback
fix(esx): stage esxboot-x64.efi from the install media if missing
2026-07-27 10:39:05 -03:00
Daniel Hilst 38c0674394 Merge pull request #7663 from VersatusHPC/harvest/bmcsetup-walker-pass
fix(bmcsetup): support Intel Walker Pass (S9200WK) BMC LAN
2026-07-27 10:35:59 -03:00
Daniel Hilst 90b63577f5 Merge pull request #7664 from VersatusHPC/harvest/getinstdisk-vroc
fix(getinstdisk): use an Intel RSTe/VROC RAID when no other disk is found
2026-07-27 10:34:30 -03:00
Daniel Hilst 2533c4ac62 Merge pull request #7635 from VersatusHPC/harvest/rinv-deterministic-sort
fix(rinv): sort FRU output deterministically
2026-07-27 08:26:08 -03:00