2
0
mirror of https://github.com/xcat2/xcat-dep.git synced 2026-11-30 06:12:16 +00:00
Commit Graph

43 Commits

Author SHA1 Message Date
Daniel Hilst dd233b3331 fix(nfslock): a cleanup that cannot finish destroys the lock it was freeing
release deleted the owner metadata and marked the guard released before it
knew the removal could finish. With a live attached worker the rmdir failed
on the non-empty directory, and the lock was left holding workers and no
owner. acquire refuses that for ever, correctly, because there is nothing
to validate, and the guard was already marked released, so nothing retried.
A lock still HELD is better: it is refused with a reason, and it recovers
when its owner dies.

_remove had the same ordering. It deleted the metadata, then failed on the
workers directory, reported "kept", and left the same wreck. A take-over
recovers a dead owner's lock with completed worker records by itself, so
the sweep was leaving that lock in a worse state than doing nothing.

Both now clear the records of completed workers first, then ask whether the
directory holds anything besides its metadata, and delete the metadata only
when it does not. _only_metadata asks that question, because the unlink
cannot be undone.

release retries while something still blocks the removal, and marks the
guard released only when nothing is left on disk. DESTROY and the signal
handler that calls release_build_locks can therefore finish the job once
the workers are gone.

sweep_stranded's signature and its report fields are unchanged.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-23 01:00:41 -03:00
Daniel Hilst 2fa0e8b1c8 fix(nfslock): a dead owner does not mean the work it started has stopped
The ownership identity is one process, and what a lock protects outlives
it. A build wrapper starts each command in its own process group, so
SIGKILL on the wrapper leaves that group running. acquire proved the owner
dead and took the lock, and two builds then wrote one checkout. The build
wrapper's own cancellation path keeps the lock when a group survives
cleanup, and this recovery undid that retention: it read a dead owner and
took the lock the retention had kept.

A holder now ATTACHES each process group it starts and DETACHES it once
the group is gone. attach records lock.d/workers/<pgid>.<leader pstart>.
An owner is recoverable only when it is provably dead AND every attached
group is gone, so the retention is a fact recovery reads rather than a
directory it has to guess about.

A group is gone only when kill(0, -pgid) answers ESRCH, which is the test
the cancellation path already uses before it releases. The two now agree.
Reaping the LEADER is not enough, because its children inherit the group,
so the test is on the group and not on the leader's pid. detach applies the
same test and refuses while any process is in the group.

Reuse windows. The entry name carries the leader's start time, so removing
a record by name cannot remove that of a later group which reused the pgid.
The group test itself cannot tell a recycled pgid from the original group
and reads live for both, which costs a wait rather than admitting a second
writer. Neither can tell a worker that left its group by calling setpgid
itself; the cancellation path has the same limit, and the two agree.

An exclusive claim on the root does not override a live group. The claim
asserts no build is running, and a live group is evidence that one is.

release drops the records of groups that are gone and keeps the rest, so a
worker killed before its reap cannot make a lock unreleasable, and a live
one stops the release because rmdir refuses a non-empty directory.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-22 14:43:01 -03:00
Daniel Hilst 429d993d54 test(xcat-dep): nothing shows that a dead owner's workers still hold the lock
The ownership identity is one process. What a lock protects outlives it: a
build wrapper starts each command in its OWN process group, so SIGKILL on
the wrapper leaves that group running. An owner proven dead therefore says
nothing about the work it started, and recovery admits a second writer. No
check covered it, because every holder the existing checks kill has no
worker under it.

attach, detach and live_workers arrive here with the checks that drive
them. A caller records each process group it starts, and a group is gone
only when kill(0, -pgid) answers ESRCH, which is the test the build
wrapper's own cancellation path already uses before it releases.

BOTH halves are asserted, and the second is the one that keeps the first
honest: a lock that recovers nothing at all satisfies "the second build
stays blocked" perfectly. So the worker exits and the same lock must then
be recovered.

Three more checks pin what "the group" means. A group outlives its leader,
because children inherit it, so a check reaps the leader and asserts the
group still counts as live. detach must refuse while any process is in the
group, which makes the retention a property of what is on disk rather than
of which call site remembered to run. And an exclusive claim on the root
does not override a live group: the claim asserts no build is running, and
a live group is evidence one is.

Against the unfixed predicate 8 of the 75 checks fail.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-22 14:42:17 -03:00
Daniel Hilst af2a271fdd fix(nfslock): reclaiming a borrow by path can put two processes in one lock
_reap_borrow validated a borrow's metadata and then removed the borrow by
path. rmdir names a path and not the inode that was validated, so a
contender stopped between the two steps removes whatever is at the path
when it resumes. Measured: it validated inode 157 and removed inode
33554970, a borrow a live taker held. Both contenders then took the lock,
and the ordered pair of children in the test reports 11 where it must
report 01.

The borrow is now numbered. lock.borrow is generation 0 and lock.borrow.N
is generation N, the taker is whoever holds the highest generation, and a
transition whose taker is provably dead is ended by creating the NEXT
generation rather than by removing the one that was validated. mkdir is
exclusive, so one contender wins a generation, and a process removes only
a generation it created and still holds. No process can delete another
process's claim, which is the property the old shape could not have.

The rule that reclaimed a borrow with no metadata, when two attempts found
it unchanged, is withdrawn. Its argument covered a healthy participant, not
one that pauses: a live taker can wait any length of time between its mkdir
and its first write, and superseding it puts two processes in the
transition. A generation with no valid metadata now blocks, and
sweep_stranded removes it under an exclusive claim on the root, which is
the disposition a lock.d with no metadata already has.

acquire set identity before writing the replacement lock metadata. A write
that left partial metadata and threw therefore gave DESTROY a lock to
release, and release retried for ever because lock.d existed and its
metadata could not be validated. identity is now set only after that write
succeeds, so a failed acquire leaves the destructor nothing to act on, and
release stops after R retries.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-22 13:35:38 -03:00
Daniel Hilst 5018b90829 test(xcat-dep): nothing shows that reclaiming a borrow keeps one taker
_reap_borrow validates a borrow and then removes it by path. rmdir names a
path, not the inode that was validated, so a contender stopped between
those two steps removes whatever is at the path when it resumes. That can
be a live taker's borrow, and two processes then take over one lock. No
check covered it, because the existing ones drive one process at a time.

The new checks fork Perl children and stop them at named points in the
protocol, through an _at hook this commit adds to the module. The
interleaving is a pipe barrier and not a delay, so a fast machine cannot
hide the defect, and every child is reaped with its stdio detached. A
contender that validated the borrow is released only after another one
holds it, which is the order that reaches the defect: released together,
the two race one mkdir, which is exclusive either way.

A second check covers a live taker that has not written its metadata yet.
An earlier revision reclaimed a borrow that two attempts found unchanged,
and that rule cannot cover this case, because a live participant can pause
for any length of time between two writes.

Two more cover the destructor. An acquire whose commit write fails must
return that write error and leave nothing for DESTROY to clean up, and
release must stop after R retries rather than wait for metadata that
cannot be validated. The sleep stub is capped, so a retry loop that lost
its bound fails a named check instead of hanging the suite.

Against the unfixed protocol 17 of the 56 checks fail, the ordered pair
reporting that both contenders took the lock.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-22 13:35:25 -03:00
Daniel Hilst 56e28d4dbb fix(nfslock): a borrow with no metadata strands its lock for ever
The borrow now carries metadata, so a taker that dies holding one is
recovered. A borrow with NO metadata is not: _reap_borrow returns
"invalid", acquire skips steps 4 to 7 for as long as the borrow exists, and
the dead owner is never evicted. That is the state the earlier protocol
left, because it wrote nothing into the borrow, and the state a death
between mkdir and the first write leaves today. Every later acquire waits
out its retries and tells the operator to remove the lock by hand.

No participant holds a metadata-less borrow for longer than two file reads,
and two attempts of one acquire are at least T seconds apart, so a
metadata-less borrow that both attempts find unchanged is held by nobody.
_reap_borrow removes that one. A borrow whose metadata file exists but does
not validate may be a half-finished write and is still left alone.

A lock.d with no metadata is a separate case. The build lock in xcat-core
wrote none and held lock.d for the whole build, so no fact on disk tells
that holder from a dead one, and acquire must keep refusing it.
sweep_stranded removes it, and only with exclusive => 1, where the caller
has already claimed the root and no build can be running.

The refusal said "Trying to unlock <path> failed", which is the reverse of
what it was doing, and gave a caller nothing to distinguish an exhausted
retry budget from a mkdir that failed outright. It now reads "Cannot lock
<path>: still held after N retries by <owner>".

The Copies header called the xcat-dep path "this file, the original",
which is false in the two copies that vendor it, and it did not say where
sweep_stranded is called from.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-22 10:19:48 -03:00
Daniel Hilst ba87367a7b fix(xcat-dep): a taker that dies holding lock.borrow blocks the lock for ever
Step 3 of the NFS lock protocol is mkdir(lock.borrow) and nothing recovers that
directory. A take-over killed between step 3 and step 7 leaves it behind, so
every later acquire fails step 3, skips steps 4 to 7, never evicts the dead
owner, and ends by telling the operator to remove the lock by hand. Assumption
5 made this impossible by fiat; Jenkins SIGTERM and the OOM-killer make it
routine.

The borrow now carries the same metadata as the lock, written before the death
check, which is where a signal lands. A borrow whose metadata proves its taker
dead is removed and the acquire retries; one that names a live process, or that
cannot be validated, is left alone. So the rule that recovers a dead owner now
recovers a dead taker, and staleness is still never inferred from metadata that
cannot be validated. release takes the same two steps at step 9, where a killed
taker blocked the release instead.

A guard also never released at scope exit, because the module had no DESTROY.
The lock was then held to the end of the process and no take-over could recover
it either, its owner being alive. Every caller here keeps its guards in an array
for that reason, which hid the leak. release now returns early unless this
acquisition holds the lock, because acquire blesses the object before it holds
anything and an acquire that dies would otherwise enter the wait loop in
release and never leave it.

sweep_stranded moves here from the xcat-core-ci-cd copy, which had it alone, so
the hole it covers stayed open in this copy and in xcat-core's. Its matcher read
'.lock' and '.lock.borrow', which covered mockbuild-all.pl's cell locks and
missed cluster-test.pl's .build.lock.d and sbuild-all.pl's
.sbuild-all.<arch>.nfslock. It now matches all three spellings. A borrow the
earlier protocol left carries no metadata, so the sweeper remains the only way
to clear those.

The header records that three repos vendor this file and that the copies must
stay identical.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-22 07:29:16 -03:00
Vinícius Ferrão 48dac0217a feat(uftp): build uftp for the openEuler targets
The openEuler targets did not build uftp, and openEuler does not ship
UFTP, so xCAT could not distribute openEuler stateless images over UFTP.

The native openEuler profile of mockbuild-all.pl now runs the uftp
builder, and every openEuler section of packages-manifest.conf lists
uftp=5.0.4. The ppc64le target resolves its manifest through the native
input catalog, so the catalog declares uftp as an owner that builds as
UID 1000, like ipmitool-xcat, and the catalog loader accepts that owner.

The spec needs gcc, make and openssl-devel, which the OS repository of
every openEuler release has. That is the only repository of the ppc64le
target. The 20.03 and 22.03 builds link OpenSSL 1.1.1.
2026-10-21 11:39:14 -03:00
Daniel Hilst 3a8017eee6 Merge pull request #89 from VersatusHPC/fix/genesis-oe-source-dir-rename
fix(xcat-dep): the OpenEmbedded Genesis build cannot find the builder in xcat-core master
2026-10-16 11:03:44 -03:00
Daniel Hilst c0af7aeffb fix(xcat-dep): the OpenEmbedded Genesis build cannot find the builder in xcat-core master
Every OpenEmbedded Genesis build fails against xcat-core master:

    xcat-core source is missing xCAT-genesis-builder/oe/build

xcat-core 2a7364476 renamed xCAT-genesis-builder to xCAT-genesis-base and
updated the readers inside xcat-core. genesis-openembedded/build names the old
directory in four places, so it rejects the checkout before it builds anything.
The build jobs for EL and for Ubuntu both exit 2 on it.

A dep build serves two kinds of checkout at once. A released core still carries
the old name, and master carries the new one, so neither name can replace the
other. XCAT::GenesisRelease::oe_source_dir takes whichever directory holds a
complete pair of build and export scripts, prefers the new name when a checkout
has both, and names every path it looked for when a checkout has neither. The
script resolves the directory once and uses it for the architecture probe, the
build and the export.

Half a directory is not a directory. The build runs both scripts, so a prefix
that carries only one is skipped here instead of failing later at the second
run_command, with a message that names the wrong thing.

t/genesis_oe_source_dir.t covers both names, a checkout with both, a checkout
with neither, an incomplete pair and a caller that needs one script. Against the
directory list before this change, four of its ten assertions fail.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-13 11:12:03 -03:00
Daniel Hilst 6c9e905373 Merge master into fix/openeuler-ppc64le-net-dns
Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-09 10:40:43 -03:00
Daniel Hilst 3254455ff2 fix(xcat-dep): openEuler ppc64le has no ipxe-xcat and xCAT cannot install
dnf install xCAT on an openEuler 24.03 ppc64le management node stops with
"nothing provides ipxe-xcat >= 2.0.0-1 needed by xCAT-2.20.0". xCAT and
xCATsn require ipxe-xcat by name on ppc64le, both EL ppc64le sections of
packages-manifest.conf list it, and the openEuler section does not, so
mockbuild-all.pl never builds it and the dep repository never carries it.

Declare the package in four places, because each one refuses it
separately: the manifest section, the openEuler target profile that
selects which dep builders run, the native input catalog that resolves an
owner for every manifest name, and the catalog owner allow-list.
ipxe-xcat.spec is BuildArch noarch with no BuildRequires and no compile
step, so the owner builds as uid 1000 like grub2-xcat.

elilo-xcat and conserver-xcat stay out. No core rpm requires either one:
xCAT uses goconserver for consoles, and elilo is an EFI loader for
architectures this cell does not serve.

t/openeuler.t covers both halves and fails without this change.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-07 10:16:17 -03:00
Daniel Hilst d26549495b fix(xcat-dep): the openEuler native builds need procenv on the build host
Every native prerequisite after procenv itself died before rpmbuild started:

  FileNotFoundError: [Errno 2] No such file or directory: '/usr/bin/procenv'

mock's procenv plugin executes ["/usr/bin/procenv"] on the build host, not in the
chroot, so the build needed a host package that neither this repository nor
xcat-core-ci-cd declares. The plugin is pure provenance: it writes procenv.log into
the result directory and nothing reads it. mock ships it off.

native_overlay_text now leaves procenv_enable at mock's default for every overlay,
so a native build depends on nothing outside the two repositories.

The procenv node stays in the inputs: mock appends procenv to the buildroot's
preexisting_deps whenever the plugin is on, so the package is still what makes the
plugin usable if the host is ever provisioned for it.

openeuler_native_procenv_plugin.t passes with this commit and failed two checks
without it. Measured on xcat-master-ppc: run 264b installed
procenv-0.60-1.ppc64le into the docbook-style-dsssl chroot and failed on the same
line, which is what showed the chroot was never the problem.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-07 10:16:17 -03:00
Daniel Hilst e5ceff876b test(xcat-dep): the openEuler native overlays enable a plugin the host cannot run
Every openEuler ppc64le native prerequisite after procenv itself fails before
rpmbuild starts:

  FileNotFoundError: [Errno 2] No such file or directory: '/usr/bin/procenv'

raised from mock's procenv plugin prebuild hook. The plugin runs ["/usr/bin/procenv"]
through mockbuild.util.do with no chroot prefix, so it executes the BUILD HOST's copy,
and xcat-master-ppc has none. The plugin also appends procenv to the buildroot's
preexisting_deps itself, so the chroot already gets the package: a run that installed
it, with "Installing : procenv-0.60-1.ppc64le" in root.log, failed on the same line.

mock ships procenv_enable False. The overlays turn it on, which makes every native
build depend on a host package that neither repository declares, for a procenv.log
that nothing reads.

The overlay text was built inline in native_overlay, so there was nothing a unit test
could call. native_overlay_text in XCAT::NativeInputs now renders one overlay and
reproduces today's values exactly, and native_overlay writes what it returns.

openeuler_native_procenv_plugin.t asserts the plugin is left at its default in all
three overlays, that the prerequisite repository and the bind mount survive, and that
the uid split does not move. Two of its eleven checks fail on this commit, which is
the defect.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-07 10:16:16 -03:00
Daniel Hilst 781dc1edf7 fix(xcat-dep): openEuler ppc64le ships Net::DNS 1.40 with known CVEs
The openeuler-24.03-ppc64le catalog pins perl-Net-DNS-1.40-1.oe2403
from openEuler 24.03 LTS GA as a publisher input. That release has
CVE-2026-64193 and CVE-2026-64194. The GA srpm carries no fix, and
load_inputs accepts only GA rpms as publisher inputs.

Build perl-Net-DNS for this target from perl-Net-DNS/Net-DNS.spec,
the 1.57 release that rocky-10-riscv64-xcat already builds. The
catalog now declares perl-Net-DNS as an owner, load_inputs allows that
owner, and the manifest pins 1.57. The spec BuildRequires all resolve
from the openEuler 24.03 LTS OS repository.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-05 15:50:58 -03:00
Daniel Hilst 779403852c fix(xcat-dep): publisher keyring can reuse a directory the build did not create
trust_dbpath named the keyring after a hash of the staging directory and
did not create it. A directory or symlink that another user put at that
predictable name under the local root became the rpmkeys --dbpath for
the publisher key.

trust_dbpath now creates a fresh 0700 directory with tempdir under the
same root, so XCAT_DEP_TRUST_TMP still selects it. CLEANUP removes it
when the creating process exits. stage_inputs and build_native_inputs
run in that process, so the keyring stays in place for every
verify_input of the run.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-02 13:11:57 -03:00
Daniel Hilst 717f6dc5b1 fix(xcat-dep): no openEuler target builds, for three independent reasons
openeuler-20.03sp4-x86_64 and openeuler-22.03sp4-x86_64 build nothing. Both exit 3
at "Could not find included config file:
/etc/mock/templates/openeuler-20.03-sp4.tpl", and both targets report that every
build step failed. mock-core-configs names its openEuler templates by release
alone, openeuler-20.03.tpl and openeuler-22.03.tpl, and each already sets
releasever to the newest service pack. The two configurations spelled the service
pack into the template name, which matches no file in any mock package.
openeuler-24.03sp4-x86_64.cfg already includes openeuler-24.03.tpl, which is why
that target builds.

The ppc64le target fails before any package is built, for two further reasons.

rpmkeys --dbpath cannot import the publisher key: rpm takes an fcntl transaction
lock on <dbpath>/.rpm.lock, the staging directory is NFS mounted local_lock=none,
and that lock answers errno 524 there. The keyring database moves to local
temporary storage, keyed on the staging directory so two targets of one run do not
share it. The staged source RPMs and the gpg home do not move.

A verified publisher RPM is rejected as unreadable: reject_elf_payload read the
exit status of rpm2cpio as the verdict on the payload, and on rpm 4.19 rpm2cpio
writes the whole payload and still exits 1 with nothing on stderr. The cpio walk
moves into scan_cpio_for_elf, which returns its own answer. A truncated stream
never reaches the trailer and still dies, which is the case the exit status stood
in for, and verify_input has already matched the sha256 and run rpmkeys --checksig
before this point.

Each fix has a test that fails without it. openeuler_mock_template_include.t reads
the configurations only. openeuler_native_trust_dbpath.t and
openeuler_native_cpio_scan.t run no rpmkeys and no rpm2cpio: the second builds its
cpio streams in Perl and refuses an ELF member, a truncated stream, data after the
trailer and a stream that is not cpio, each by name.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-01 18:19:06 -03:00
Vinícius Ferrão 5a625e94dd Merge master into openEuler support 2026-09-28 23:56:29 -03:00
Daniel Hilst 38301490fa fix(xcat-dep): print the lock log line without changing autoflush
_log set $| on the caller's selected handle for each line. The caller
owns its buffering, so the lock log only prints the line.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-09-28 11:39:21 -03:00
Daniel Hilst f9b9f1ac46 feat(xcat-dep): log each NFS lock event to the build log
A build log did not show when a lock was taken, waited on, taken over
or released, so the lock order of the parallel dep builds could not be
read from their logs.

XCAT::NFSLock now prints one line per event to the selected output
handle, with the UTC time in milliseconds, the host, the pid, the event,
the label and the lock path. The events are acquired, took-over, wait,
released and release-skipped. quiet => 1 turns the log off for a lock.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-09-28 11:38:30 -03:00
Daniel Hilst f23a4e8786 fix(xcat-dep): lock takeover relies on rename and on lock.break
XCAT::NFSLock recovered a dead owner's lock under a second lock,
lock.break. A process that died after it created lock.break left it in
place, and every later acquire timed out even when both processes were
dead. The lock and its record were also put in place with rename, which
replaces an empty directory, so acquire took over a lock.d that had no
owner record.

The lock now follows the NFS lock protocol at the top of NFSLock.pm. It
uses mkdir, rmdir, unlink and plain writes, and no rename. lock.d/metadata
holds the owner identity and a hash, and invalid metadata only causes a
retry. Takeover and release both hold lock.borrow, beside lock.d. Only a
process on the owner's machine takes over a lock, after it reads the
same identity twice and proves that owner dead. acquire retries R times
with a wait of T +/- jitter, and --try-unlock-timeout maps to R.

Records written by the previous format are invalid metadata and are not
taken over. A process that dies while it holds lock.borrow still blocks
the lock. The protocol assumes that this does not happen.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-09-28 10:06:35 -03:00
Daniel Hilst e2bc5493de feat(xcat-dep): add XCAT::NFSLock, a lock for the shared NFS tree
The dep builds lock trees on a shared NFS tree that the hypervisors
re-export. The kernel refuses flock and fcntl locks to clients of a
re-export, so every such lock fails with errno 524.

XCAT::NFSLock builds a lock as a directory under a private name, with an
owner record and the caller's metadata, and renames it into place. The
record holds the machine id, boot id, pid, process start time and a
random token. The owner removes the lock, or a process on the owner's
host that proves the owner dead: another boot, no such pid, or a pid
with another start time. That process takes a breaker lock and proves
the owner dead again before it removes the lock. Removal renames the
lock away first. Any other acquire waits up to a timeout, retrying every
3 s by default, then fails with the mv command that moves the lock away.
A lock left by mockbuild-all.pl before this module is taken when its
pid is gone on this host.

t/nfslock.t covers each rule without NFS.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-09-26 08:39:49 -03:00
Vinícius Ferrão 724602f485 fix(openeuler): integrate current dependency build and signing paths
Merge current master into the openEuler dependency branch. Preserve native
inputs and publisher signatures with the upstream timeout and keyring
helpers. Use the native repository path when carrying skipped builds.

Cover signed carry-over and mixed publisher/build-key verification.
2026-09-22 19:33:13 -03:00
Vinícius Ferrão 0c0dfb787e feat(openeuler): build native dependency packages 2026-09-21 18:23:51 -03:00
Daniel Hilst acb7311d0b Merge pull request #68 from VersatusHPC/feat/genesis-s390x
feat(genesis): package s390x images
2026-09-11 18:52:19 -03:00
Vinícius Ferrão 754567ec6c fix(xcat-dep): clear the build process group when its leader dies
run_bounded signalled the process group on a timeout and on a cancellation, but
not when the leader itself died. A SIGKILL, or the OOM killer, takes the shell
and leaves schroot and qemu in the group, holding the chroot and writing into
staging after the call reports the build finished.

Those processes are not children of this one, so there is nothing to wait for.
Signal the group on the way out.
2026-09-06 15:55:23 -03:00
Vinícius Ferrão ccbf05e758 fix(xcat-dep): record a worker the kernel killed as failed
A child killed by a signal leaves 0 in the high byte of its wait status. The
per-codename worker loop read only that byte, so a cancelled or OOM-killed
codename was counted as built, and the run could reach validation with the
staging tree that worker never finished.

One helper decodes a wait status for both the worker loop and run_bounded, and
reports 128 plus the signal for a child the kernel killed.
2026-09-06 15:39:03 -03:00
Vinícius Ferrão 0e3e2461c3 fix(genesis): centralize package name prefixes 2026-09-06 11:43:10 -03:00
Vinícius Ferrão d063e86860 fix(genesis): validate repository manifests early 2026-09-06 11:30:42 -03:00
Vinícius Ferrão 6828df8d67 fix(genesis): order release capability checks 2026-09-06 11:15:33 -03:00
Vinícius Ferrão bea6826ac5 fix(genesis): preserve release compatibility 2026-09-06 10:54:28 -03:00
Vinícius Ferrão 476024485c fix(xcat-dep): block cancellation across worker registration
The forwarding handler was in place before the fork, but the parent recorded the
worker pid after it. A signal in between reached a handler that did not know the
worker, so the orchestrator died while the worker kept building for hours and
held the per-architecture lock.

The mask discipline run_bounded already used is now a pair of helpers, and the
worker loop blocks the handled signals across both the fork and the
registration. The worker resets the inherited handlers before restoring the mask.
2026-09-06 03:21:53 -03:00
Vinícius Ferrão 88412a8a83 fix(xcat-dep): block cancellation across the fork
The handlers were installed after fork(), so a signal arriving in between killed
the wrapper under its inherited handler and left the new process group running.
INT, TERM and HUP are now blocked around the fork and delivered once the handler
is in place. The child restores the mask before exec, or the build would inherit
a blocked TERM and ignore the signal the forwarding depends on.
2026-09-06 02:44:58 -03:00
Vinícius Ferrão 4345371142 fix(xcat-dep): forward cancellation to the forked build workers
Both orchestrators fork a worker per codename or per build step, so a signal
sent to the orchestrator never reached the builds: run_bounded's forwarding
covers the build inside one worker, not the workers themselves. The
orchestrator exited and released its locks while its workers kept building,
and the next run raced processes it could not see.

One handler now passes INT, TERM and HUP to the live workers, waits for them
and re-raises the signal, shared by the sbuild loop and both ForkManager pools.
2026-09-06 01:52:17 -03:00
Vinícius Ferrão 7fc348eb09 fix(xcat-dep): give an unbounded build its own process group
With no deadline the helper called system(), which leaves the build in the
orchestrator's process group and installs no signal handler. A cancellation
then killed the orchestrator, which released its locks while the build kept
writing into staging, and a build killed by a signal was reported as rc=0.
Both paths now fork; a timeout of 0 removes the deadline, nothing else.
2026-09-06 01:52:17 -03:00
Vinícius Ferrão 1c223b881c fix(xcat-dep): reap the build when the orchestrator is signalled
The bounded build ran in its own process group, but a signal to the
orchestrator was not forwarded to it. On cancellation the orchestrator
exited and released its locks while schroot, mock and qemu kept running and
writing into staging, so the next run raced an orphan it could not see.
INT, TERM and HUP now reap the group before the process dies by the same
signal, which keeps the exit status honest.
2026-09-06 00:24:13 -03:00
Daniel Hilst b435ae4bad fix(xcat-dep): an emulated build that deadlocks hangs the pipeline forever
Every per-package build ran through a bare system() call with no wall-clock
bound. Under qemu-user a build can deadlock -- a riscv64 goconserver `go build`
held both Go pids in futex_wait for 26 minutes with no CPU ticks and no open
socket -- and the step then never returns. The pipeline does not go red; it
stops, and a stopped run reads as "still running".

XCAT::BuildUtils::run_bounded runs the command in its own process group, kills
that group when a budget expires, and prints first what the manual
investigation had to collect by hand: the process tree, each pid's kernel wchan
and stack, its open socket count, and the CPU ticks the group used across a
20-second sample. Zero ticks names a deadlock; ticks name a build that is only
slow. BuildUtils::build_deb_in_chroot bounds every Ubuntu package build, and
mockbuild-all.pl bounds the dep and perl steps of a forcearch target.

The budget is 900 seconds for a native build and ten times that for a foreign
architecture, because qemu-user under TCG runs at roughly a tenth of native
speed. Both sit about five times above the slowest build measured on
xcat-master-ub: 3 minutes native, and 26 minutes for riscv64 ipmitool-xcat on
resolute with four codenames building at once. Native mock steps stay unbounded
-- no measurement of them exists, and a guessed budget would turn a trusted
cell red. sbuild-all.pl --build-timeout and mockbuild-all.pl --build-timeout
override the default; 0 removes the bound.

t/build_timeout.t fails without this change: run_bounded never returns and the
test reports the hang instead of blocking.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-09-06 00:24:11 -03:00
Vinícius Ferrão 2a434beaad fix(genesis): validate release manifests 2026-09-04 16:16:23 -03:00
Vinícius Ferrão 87d0e347e3 feat(genesis): package s390x images 2026-09-04 13:59:45 -03:00
Vinícius Ferrão 54be752006 fix(mockbuild): fail when every build step of the invocation failed
Tolerating individual dep-builder failures is deliberate: some packages are el-
or arch-pinned and are expected to fail on some targets. Tolerating all of them
is not -- it means the builder is unusable, the invocation produced nothing, and
whatever the run publishes came from somewhere other than this build.

Count the failures on both the serial and the parallel path and stop when they
account for every attempted step, before collection can take an earlier run's
artifacts for this one's. The rule itself lives in BuildUtils, where it can be
exercised without a builder.
2026-08-24 13:57:26 -03:00
Vinícius Ferrão 542ec87d8f fix(genesis): return the verified checksum snapshot 2026-08-22 19:33:02 -03:00
Vinícius Ferrão f91f5ff929 fix(genesis): share copied package verification 2026-08-22 19:27:24 -03:00
Vinícius Ferrão 69a00bf43f refactor(genesis): share release build helpers 2026-08-22 19:24:45 -03:00