Skip to main content

Module artifact

Module artifact 

Source
Expand description

The build artifact: a zip of the daemon binary, a Dockerfile, and — when the caller passes ProjectFiles — the project’s dependency files.

What CreateMicrovmImage’s codeArtifact.uri points at (sandbox.py:523 build_artifact). Two entries always, both carrying a measured constraint, plus an ecosystem-named manifest/lockfile pair when the image bakes an environment layer (#74).

§The execute bit has to be in the zip entry

A build that copies a non-executable binary produces an image whose CMD fails, and the failure surfaces as a run-hook timeout — which says nothing about permissions, and sends the reader to look at the daemon’s startup path instead of at the archive. So the agentd entry sets mode 0o755 explicitly rather than inheriting whatever the host file had.

§The agent token is never in here (TRAP-5’s other half)

The artifact becomes a shared image snapshot: every MicroVM launched from the image sees the same bytes. A per-VM secret in there is a per-VM secret shared with every VM. So the token travels through runHookPayload at launch instead, and this function has no parameter that could carry one — see crate::control::microvm. The test at the bottom of this file scans the produced zip’s raw bytes for a token value to prove the path stays closed, which is a byte scan rather than an API review because the leak would be a value appearing somewhere, not a parameter being declared.

Structs§

BaseImage
A base image: the platform ARN, the Dockerfile FROM that pairs with it, and whether it declares a WORKDIR.
ProjectFiles
A project’s dependency files: the lockfile plus the manifest that owns it.
WrapOptions
What wrap_dockerfile needs besides the task text.

Enums§

Ecosystem
An ecosystem whose dependency files may enter the build artifact (#74).

Constants§

DEFAULT_PROJECT_WORKDIR
Where the environment layer lives when the caller named no workdir of their own.

Functions§

artifact_content_hash
The sha256 of the artifact’s inputs, as lowercase hex.
artifact_content_hash_with_context
artifact_content_hash extended with a build context (IMAGE-6).
build_artifact
Zips binary with dockerfile — and, when given, the project’s dependency files — into the bytes codeArtifact.uri will point at.
build_artifact_with_context
build_artifact plus a build context: the context’s files at their relative paths beside the Dockerfile, which is the build context root, so the Dockerfile’s COPY lines find them (IMAGE-7).
default_dockerfile
A Dockerfile that makes the daemon the container CMD.
dockerfile_agentd_port
The port in a Dockerfile’s last ENV AGENTD_PORT=, or None when it sets none.
dockerfile_cmd
The value of a Dockerfile’s last CMD, or None when it sets none.
dockerfile_entrypoint
The value of a Dockerfile’s last ENTRYPOINT, or None when it sets none.
dockerfile_env_u64
The seconds in a Dockerfile’s last ENV AGENTD_SSE_KEEPALIVE_SECS=, or None when it sets none.
dockerfile_from_ref
The image ref in a Dockerfile’s first FROM, or None when it has none.
require_daemon_cmd
Rejects a Dockerfile whose image would never run the daemon: no CMD, or an ENTRYPOINT that swallows it.
require_keepalive_under_idle_timeout
Rejects a Dockerfile whose AGENTD_SSE_KEEPALIVE_SECS is not shorter than the client’s stream idle timeout.
require_matching_agentd_port
Rejects a Dockerfile whose AGENTD_PORT disagrees with the port the create call sends as hooks.port.
require_matching_from
Rejects a Dockerfile whose FROM is not the selected base image.
require_project_install
Rejects a caller Dockerfile that never mentions the lockfile the request carries.
require_workdir
Rejects working-directory inheritance when nothing declares one.
wrap_dockerfile
A task Dockerfile with the agentd stanza appended: the one call a harness needs to go from the Dockerfile a task brings to one this client can build (#220).
wrap_dockerfile_preserving_user
Preserve the final Dockerfile USER as the default identity for workload execs.