AbstractOptionalattributes: AttributesExecute the Action as defined.
A helper function for failing on error only if strict mode is enabled. This is intended only for CI environments testing Actions themselves.
Fetches the executable at the URL determined by the source-* inputs and
other facts, chmods it, and returns the path to the executable on disk.
The ID of this Action, which every execution phase of it shares.
Each phase reports a trace of its own.
This ID is what puts the phases of one Action together, as
detsys.cross_phase_id.
The Action's state carries it from one phase to the next.
The diagnostics endpoint for the programs this Action runs, such as
nix-installer and magic-nix-cache.
This library reports nothing there. Its own telemetry is OpenTelemetry; see getTelemetryEnvironment for putting a child process's telemetry in this run's trace.
The variant of a feature flag this run resolved, if the check-in returned one.
Each variant this Action asks for becomes an attribute of the run, under
detsys.feature., so the telemetry can be sliced by the flags that
changed what the run did.
The ID of this workflow job, which every Action of the job shares.
Each execution phase of each Action reports a trace of its own, and each
program a phase runs reports its own data.
This ID is what puts that data together: it is on the spans and the log
records of every participant, as detsys.invocation_id.
A job runs each Action as a process of its own.
Thus the Actions can only agree on the ID through the job's environment.
The first Action to run makes the ID and exports it as
$DETSYS_INVOCATION_ID.
Each later step finds it there: the other Actions, and the programs the
workflow runs, such as Nix.
The environment variables that let a child process add data to this
Action's trace: the current $TRACEPARENT, the invocation ID, and the
OTLP export settings.
Add these variables to the environment of each child process to trace.
A child that inherits this process's environment already has the OTLP
settings and the invocation ID; only $TRACEPARENT changes as the run
proceeds.
The result is empty if the OpenTelemetry export is off. Thus it is always safe to add them.
The W3C traceparent identifying the span currently in progress.
Hand this to a child process -- as $TRACEPARENT -- so that its own
OpenTelemetry data joins this Action's trace. Returns undefined when
OpenTelemetry export is disabled for this run.
AbstractmainThe main execution phase.
AbstractpostThe post execution phase.
Describe this run with an attribute.
The attribute lands on the phase's root span, not on whichever span happens to be active, because it describes the run as a whole. Set it whenever the value becomes known: attributes set before the span opens are replayed onto it.
Namespace your keys, as OpenTelemetry expects: detsys.nix.version, not
nix_version.
Attach a file to the telemetry for this run, to be emitted if the Action fails.
The file at location doesn't need to exist when stapleFile is called.
Each attachment becomes one OpenTelemetry log record, correlated to the phase's span: the file's contents as the body if it can be read, the reason it could not be read otherwise.
Unpacks the closure returned by fetchArtifact(), imports the
contents into the Nix store, and returns the path of the executable at
/nix/store/STORE_PATH/bin/${bin}.
Record that something happened, as a span event.
The event lands on whichever span is active, so that it sits on the operation that produced it, and on the phase's root span when there is no nested span in progress.
Namespace your attribute keys, as OpenTelemetry expects.