Commit Graph

1531 Commits

Author SHA1 Message Date
41a8d03dd2 internal/pkg: cure completion verbose messages
This reports cure completions to the user.

Signed-off-by: Ophestra <cat@gensokyo.uk>
2026-01-12 21:56:00 +09:00
610572d0e6 internal/pkg: optionally named static file
These are generally for generating configuration files or build scripts, naming them is quite useful.

Signed-off-by: Ophestra <cat@gensokyo.uk>
2026-01-12 04:34:50 +09:00
29951c5174 internal/pkg: caller-supplied reporting name for exec
This does not have a reasonable way of inferring the underlying name. For zero value it falls back to base of executable pathname.

Signed-off-by: Ophestra <cat@gensokyo.uk>
2026-01-12 04:17:47 +09:00
91c3594dee internal/pkg: append user-facing name in messages
This makes verbose messages much more useful.

Signed-off-by: Ophestra <cat@gensokyo.uk>
2026-01-12 03:53:19 +09:00
7ccc2fc5ec internal/pkg: exec with specific timeout
This change also updates the documentation of NewExec.

Signed-off-by: Ophestra <cat@gensokyo.uk>
2026-01-11 17:46:04 +09:00
63e137856e internal/pkg: do not discard the result of compact
This result was mistakenly unused resulting in incorrect identifiers for artifacts with duplicate dependencies.

Signed-off-by: Ophestra <cat@gensokyo.uk>
2026-01-11 04:40:24 +09:00
e1e46504a1 container/check: return error backed by string type
The struct turned out not necessary during initial implementation but was not unwrapped into its single string field. This change replaces it with the underlying string and removes the indirection.

Signed-off-by: Ophestra <cat@gensokyo.uk>
2026-01-11 04:23:55 +09:00
ec9343ebd6 container/check: intern absolute pathnames
This improves performance in heavy users like internal/pkg.

Signed-off-by: Ophestra <cat@gensokyo.uk>
2026-01-11 04:18:11 +09:00
423808ac76 nix: use package from module in default
This makes overriding hakurei easier. Also avoids building hakurei twice since nix does that for some reason.

Signed-off-by: Ophestra <cat@gensokyo.uk>
2026-01-11 03:50:08 +09:00
2494ede106 container/init: configure interface lo
This enables loopback networking when owning the net namespace.

Signed-off-by: Ophestra <cat@gensokyo.uk>
2026-01-11 03:36:20 +09:00
da3848b92f internal/pkg: compare interfaces for host net
An upcoming improvement in the container init makes the current host net check return the same result for both cases. This change

Signed-off-by: Ophestra <cat@gensokyo.uk>
2026-01-11 00:30:32 +09:00
34cb4ebd3b internal/pkg: pass context to file cure
This removes the left over embedded contexts.

Signed-off-by: Ophestra <cat@gensokyo.uk>
2026-01-09 05:31:38 +09:00
f712466714 internal/pkg: move dependency flooding to cache
This imposes a hard upper limit to concurrency during dependency satisfaction and moves all dependency-related code out of individual implementations of Artifact. This change also includes ctx and msg as part of Cache.

Signed-off-by: Ophestra <cat@gensokyo.uk>
2026-01-09 05:20:34 +09:00
f2430b5f5e internal/pkg: use short wait delay
The cure is condemned at the point of cancellation and all of its state is destroyed by the deferred cleanup, so it makes little sense to wait for it much.

Signed-off-by: Ophestra <cat@gensokyo.uk>
2026-01-08 18:58:51 +09:00
863e6f5db6 internal/pkg: use correct artifact count
This updates buffer sizes and counters to use correct total artifact count.

Signed-off-by: Ophestra <cat@gensokyo.uk>
2026-01-08 08:45:37 +09:00
23df2ab999 internal/pkg: place ephemeral upperdir in tmp
This enables the use of directories made writable this way as scratch space.

Signed-off-by: Ophestra <cat@gensokyo.uk>
2026-01-08 08:23:16 +09:00
7bd4d7d0e6 internal/pkg: support explicit overlay mount
This removes all but the /work/ auto overlay behaviour and enables much greater flexibility. This also renames ExecContainerPath to ExecPath so it is easier to type.

Signed-off-by: Ophestra <cat@gensokyo.uk>
2026-01-08 07:55:09 +09:00
b3c30bcc51 internal/pkg: set container WaitDelay
This prevents a container from blocking forever after context is canceled.

Signed-off-by: Ophestra <cat@gensokyo.uk>
2026-01-08 06:23:57 +09:00
38059db835 internal/pkg: make tar temporary directory writable
This allows it to be renamed to work directory.

Signed-off-by: Ophestra <cat@gensokyo.uk>
2026-01-08 04:32:14 +09:00
409fd3149e internal/pkg: reserve kind range
This is useful for custom implementations of Artifact.

Signed-off-by: Ophestra <cat@gensokyo.uk>
2026-01-08 01:21:51 +09:00
4eea136308 internal/pkg: do not connect stdin
This introduces external state when verbose.

Signed-off-by: Ophestra <cat@gensokyo.uk>
2026-01-07 23:17:58 +09:00
c86ff02d8d internal/pkg: tar optional file
This allows tar to take a single-file directory Artifact as input.

Signed-off-by: Ophestra <cat@gensokyo.uk>
2026-01-07 22:16:26 +09:00
e8dda70c41 internal/pkg: return reader for files
This improves efficiency for cache hits.

Signed-off-by: Ophestra <cat@gensokyo.uk>
2026-01-07 21:36:47 +09:00
7ea4e8b643 internal/pkg: support tarball compressed via bzip2
Signed-off-by: Ophestra <cat@gensokyo.uk>
2026-01-07 20:18:28 +09:00
5eefebcb48 internal/pkg: reject entry types disallowed in the cache
These are not encoded in the format, they are rejected here to serve as a check for cache since checksum is computed for every directory.

Signed-off-by: Ophestra <cat@gensokyo.uk>
2026-01-07 03:22:44 +09:00
8e08e8f518 internal/pkg: automatic overlay mount on work
This directly submits the upperdir to cache. It is primarily used in bootstrapping where tools are limited and should not be used unless there is a very good reason to.

Signed-off-by: Ophestra <cat@gensokyo.uk>
2026-01-07 03:14:33 +09:00
54da6ce03d internal/pkg: respect mount order for overlay temp
Setting it up after everything else prevents covering files in /tmp.

Signed-off-by: Ophestra <cat@gensokyo.uk>
2026-01-07 01:03:49 +09:00
3a21ba1bca internal/pkg: implement file artifact
This is an Artifact implementing File, backed by a constant, caller-supplied byte slice.

Signed-off-by: Ophestra <cat@gensokyo.uk>
2026-01-07 00:39:29 +09:00
45301559bf internal/pkg: fail on empty output directory
This works around the fact that execArtifact always creates the work directory when setting up the bind mount.

Signed-off-by: Ophestra <cat@gensokyo.uk>
2026-01-07 00:04:32 +09:00
0df87ab111 internal/pkg: automatic overlay mount on tmp
This sets up the last Artifact to target /tmp as a writable overlay mount backed by the host side temp directory. This is useful for an Artifact containing source code to be built for another Artifact for example.

Signed-off-by: Ophestra <cat@gensokyo.uk>
2026-01-06 23:45:08 +09:00
aa0a949cef internal/pkg: do not clear execute bit
Only write should be cleared here, clearing execute causes execArtifact to be unable to start anything since no Artifact is able to produce an executable file.

Signed-off-by: Ophestra <cat@gensokyo.uk>
2026-01-06 22:31:44 +09:00
ce0064384d internal/pkg: automatic overlay mount on root
This makes it possible to use an Artifact as root without arranging for directory creation in the Artifact ahead of time.

Signed-off-by: Ophestra <cat@gensokyo.uk>
2026-01-06 22:19:47 +09:00
53d80f4b66 internal/pkg/testdata: check network
This validates hostNet state.

Signed-off-by: Ophestra <cat@gensokyo.uk>
2026-01-06 21:32:10 +09:00
156096ac98 internal/pkg: known checksum exec artifact
This optionally attaches an output checksum to an execArtifact and enables host networking for the resulting container.

Signed-off-by: Ophestra <cat@gensokyo.uk>
2026-01-06 20:58:34 +09:00
ceb75538cf internal/pkg: update http checksum signature
This was using the old pre-KnownChecksum function signature. It did not affect correctness since httpArtifact performs internal validation to avoid the strict mode vfs roundtrip, but it prevented content-addressed cache hits.

Signed-off-by: Ophestra <cat@gensokyo.uk>
2026-01-06 18:24:31 +09:00
0741a614ed internal/pkg: relocate testtool workaround
This can be reused in other test cases.

Signed-off-by: Ophestra <cat@gensokyo.uk>
2026-01-06 18:06:56 +09:00
e7e9b4caea internal/pkg: exec nil path check during cure
This results in os.ErrInvalid instead of a panic, which hopefully improves user experience.

Signed-off-by: Ophestra <cat@gensokyo.uk>
2026-01-06 17:46:12 +09:00
f6d32e482a internal/pkg: ensure parent for non-directory entries
This works around streams containing out of order entries.

Signed-off-by: Ophestra <cat@gensokyo.uk>
2026-01-06 05:55:24 +09:00
79adf217f4 internal/pkg: implement exec artifact
This runs a program in a container environment. Artifacts can be made available to the container, they are cured concurrently and mounted in order.

Signed-off-by: Ophestra <cat@gensokyo.uk>
2026-01-06 05:05:34 +09:00
8efffd72f4 internal/pkg: destroy temp during deferred cleanup
This avoids missing the cleanup when cure returns an error.

Signed-off-by: Ophestra <cat@gensokyo.uk>
2026-01-06 04:24:54 +09:00
86ad8b72aa internal/pkg: expose cure through cure context
This allows a curing Artifact to cure Artifact it depends on.

Signed-off-by: Ophestra <cat@gensokyo.uk>
2026-01-06 01:04:06 +09:00
e91049c3c5 internal/pkg: pass cure context as single value
This cleans up the function signature and makes backwards compatible API changes possible.

Signed-off-by: Ophestra <cat@gensokyo.uk>
2026-01-06 00:56:49 +09:00
3d4d32932d internal/pkg: verify checksum after uneventful scrub
This checks that scrub did not condemn any entry without reporting it.

Signed-off-by: Ophestra <cat@gensokyo.uk>
2026-01-05 22:54:16 +09:00
0ab6c13c77 internal/pkg: consistency check for on-disk cache
This change adds a method to check on-disk cache consistency and destroy inconsistent entries as they are encountered. This primarily helps verify artifact implementation correctness, but can also repair a cache that got into an inconsistent state from curing a misbehaving artifact, without having to destroy the entire cache.

Signed-off-by: Ophestra <cat@gensokyo.uk>
2026-01-05 05:30:29 +09:00
834cb0d40b internal/pkg: override "." for directory checksum
This makes the checksum consistent with the final resting state of artifact directories without incurring the cost of an extra pair of chown syscalls.

Signed-off-by: Ophestra <cat@gensokyo.uk>
2026-01-05 04:00:13 +09:00
7548a627e5 internal/pkg: delete stale done channels
There is no reason to keep these around.

Signed-off-by: Ophestra <cat@gensokyo.uk>
2026-01-05 02:12:34 +09:00
b98d27f773 internal/pkg: expand single directory tarball
This enables much cleaner use of their output without giving up any meaningful data.

Signed-off-by: Ophestra <cat@gensokyo.uk>
2026-01-05 01:43:23 +09:00
f3aa31e401 internal/pkg: temporary scratch space for cure
This allows for more flexibility during implementation. The use case that required this was for expanding single directory tarballs.

Signed-off-by: Ophestra <cat@gensokyo.uk>
2026-01-05 01:39:18 +09:00
4da26681b5 internal/pkg: compute http identifier from url
The previous implementation exposes arbitrary user input to the cache as an identifier, which is highly error-prone and can cause the cache to enter an inconsistent state if the user is not careful. This change replaces the implementation to compute identifier late, using url string as params.

Signed-off-by: Ophestra <cat@gensokyo.uk>
2026-01-05 00:43:21 +09:00
4897b0259e internal/pkg: improve artifact interface
This moves all cache I/O code to Cache. Artifact now only contains methods for constructing their actual contents.

Signed-off-by: Ophestra <cat@gensokyo.uk>
2026-01-05 00:01:23 +09:00