Documentation
¶
Overview ¶
Package executionenv defines the private, versioned host-side execution-provider protocol. It is intentionally not part of the public Harness API.
Index ¶
- Constants
- func DecodeStrict(data []byte, dst any) error
- type AttachEnvironmentRequest
- type AttachEnvironmentResponse
- type CommandQueryRequest
- type CommandStartRequest
- type CommandStartResponse
- type CommandState
- type CommandStatusResponse
- type EmptyResponse
- type EnsureEnvironmentResponse
- type EnvironmentRef
- type Error
- type ErrorCode
- type ExecutorEnvelope
- type ExecutorRequest
- type ExecutorResponse
- type FileInfo
- type FileRequest
- type FileResponse
- type GrepMatch
- type Operation
- type Owner
- type ReferenceIntent
- type ReferenceReleaseRequest
- type ReferenceRequest
- type ReferenceState
- type RequestContext
- type RetireEnvironmentRequest
- type RunClaim
- type RunClaimRequest
Constants ¶
const ( ProtocolVersion = "execution-grpc/1" MaxMessageBytes = 8 << 20 MaxJSONBody = 8 << 20 // credential-free provider-to-workload stdin framing only MaxFileBytes = 5 << 20 MaxCommandBytes = 1 << 20 MaxPathBytes = 4096 MaxIdentityBytes = 1024 MaxBindingBytes = 253 MaxListEntries = 10_000 )
Private protocol bounds.
const ( MinRunTTL = 30 * time.Second MaxRunTTL = 5 * time.Minute DefaultRunTTL = time.Minute DefaultRenewInterval = 20 * time.Second )
const PurposeSession = "session"
PurposeSession is the supported attachment purpose.
Variables ¶
This section is empty.
Functions ¶
func DecodeStrict ¶
DecodeStrict decodes exactly one bounded JSON value for the credential-free provider-to-workload stdin protocol, without unknown or duplicate fields.
Types ¶
type AttachEnvironmentRequest ¶
type AttachEnvironmentRequest struct {
Context RequestContext `json:"context"`
Purpose string `json:"purpose"`
}
AttachEnvironmentRequest requests exact reattachment to an existing environment.
type AttachEnvironmentResponse ¶
type AttachEnvironmentResponse struct {
Environment EnvironmentRef `json:"environment"`
Epoch uint64 `json:"epoch"`
Ready bool `json:"ready"`
GrantGeneration uint64 `json:"grant_generation"`
}
AttachEnvironmentResponse returns exact attachment state.
type CommandQueryRequest ¶
type CommandQueryRequest struct {
Context RequestContext `json:"context"`
CommandID string `json:"command_id"`
Offset int64 `json:"offset,omitempty"`
}
CommandQueryRequest identifies one command for status or cancellation.
type CommandStartRequest ¶
type CommandStartRequest struct {
Context RequestContext `json:"context"`
Command string `json:"command"`
TimeoutMillis int64 `json:"timeout_ms,omitempty"`
}
CommandStartRequest starts one bounded foreground shell command.
type CommandStartResponse ¶
type CommandStartResponse struct {
CommandID string `json:"command_id"`
State CommandState `json:"state"`
Result CommandStatusResponse `json:"result"`
}
CommandStartResponse returns the command identity and terminal result.
type CommandState ¶
type CommandState string
CommandState classifies command lifecycle and fencing outcomes.
const ( CommandRunning CommandState = "running" CommandSucceeded CommandState = "succeeded" CommandFailed CommandState = "failed" CommandCancelled CommandState = "cancelled" CommandFenceUnknown CommandState = "fence_unknown" )
Command states.
type CommandStatusResponse ¶
type CommandStatusResponse struct {
CommandID string `json:"command_id"`
State CommandState `json:"state"`
ExitCode int `json:"exit_code,omitempty"`
Stdout []byte `json:"stdout,omitempty"`
Stderr []byte `json:"stderr,omitempty"`
NextOffset int64 `json:"next_offset,omitempty"`
Truncated bool `json:"truncated,omitempty"`
TerminalReceipt string `json:"terminal_receipt,omitempty"`
}
CommandStatusResponse carries bounded output and terminal proof.
type EmptyResponse ¶
type EmptyResponse struct{}
EmptyResponse is the successful response for operations without a payload.
type EnsureEnvironmentResponse ¶
type EnsureEnvironmentResponse struct {
Environment EnvironmentRef `json:"environment"`
Epoch uint64 `json:"epoch"`
Ready bool `json:"ready"`
GrantGeneration uint64 `json:"grant_generation"`
}
EnsureEnvironmentResponse returns allocation identity and readiness.
type EnvironmentRef ¶
EnvironmentRef is the provider-private durable environment identity.
type Error ¶
type Error struct {
Code ErrorCode `json:"code"`
Message string `json:"message"`
Retryable bool `json:"retryable,omitempty"`
}
Error is a bounded structured private-protocol failure.
type ErrorCode ¶
type ErrorCode string
ErrorCode is a stable private-protocol error classification.
const ( CodeInvalidArgument ErrorCode = "invalid_argument" CodeUnauthenticated ErrorCode = "unauthenticated" CodePermissionDenied ErrorCode = "permission_denied" CodeNotFound ErrorCode = "not_found" CodeAlreadyExists ErrorCode = "already_exists" CodeConflict ErrorCode = "conflict" CodeVersionMismatch ErrorCode = "version_mismatch" CodeDirectoryNotEmpty ErrorCode = "directory_not_empty" CodeNotReady ErrorCode = "not_ready" CodeFenceUnknown ErrorCode = "fence_unknown" CodeResourceExhausted ErrorCode = "resource_exhausted" CodeInternal ErrorCode = "internal" )
Private-protocol error codes.
type ExecutorEnvelope ¶
type ExecutorEnvelope struct {
Response *ExecutorResponse `json:"response,omitempty"`
Error *Error `json:"error,omitempty"`
}
ExecutorEnvelope provides a terminal, credential-free result over pods/exec.
type ExecutorRequest ¶
type ExecutorRequest struct {
Operation Operation `json:"operation"`
Path string `json:"path,omitempty"`
Destination string `json:"destination,omitempty"`
Pattern string `json:"pattern,omitempty"`
Data []byte `json:"data,omitempty"`
Version string `json:"version,omitempty"`
Limit int `json:"limit,omitempty"`
Command string `json:"command,omitempty"`
CommandID string `json:"command_id,omitempty"`
TimeoutMillis int64 `json:"timeout_ms,omitempty"`
}
ExecutorRequest is the credential-free provider-to-workload stdin protocol. It deliberately cannot select an environment, root, Pod, image, argv, or process environment.
type ExecutorResponse ¶
type ExecutorResponse struct {
FileResponse
Command *CommandStatusResponse `json:"command,omitempty"`
}
ExecutorResponse carries one credential-free helper result.
type FileInfo ¶
type FileInfo struct {
Name string `json:"name"`
Size int64 `json:"size"`
Mode uint32 `json:"mode"`
ModTime time.Time `json:"mod_time"`
IsDir bool `json:"is_dir"`
}
FileInfo is bounded filesystem metadata returned by the helper.
type FileRequest ¶
type FileRequest struct {
Context RequestContext `json:"context"`
Operation Operation `json:"operation"`
Path string `json:"path"`
Destination string `json:"destination,omitempty"`
Pattern string `json:"pattern,omitempty"`
Data []byte `json:"data,omitempty"`
Version string `json:"version,omitempty"`
Limit int `json:"limit,omitempty"`
}
FileRequest carries one bounded, authorized filesystem operation.
type FileResponse ¶
type FileResponse struct {
Data []byte `json:"data,omitempty"`
Version string `json:"version,omitempty"`
Info *FileInfo `json:"info,omitempty"`
Entries []FileInfo `json:"entries,omitempty"`
Paths []string `json:"paths,omitempty"`
Matches []GrepMatch `json:"matches,omitempty"`
AuthorityTarget string `json:"authority_target,omitempty"`
AuthorityWorkspace string `json:"authority_workspace,omitempty"`
}
FileResponse carries the result of one filesystem operation.
type GrepMatch ¶
type GrepMatch struct {
Path string `json:"path"`
Line int `json:"line"`
Text string `json:"text"`
}
GrepMatch is one bounded textual grep result.
type Operation ¶
type Operation string
Operation identifies one provider or workload-helper operation.
const ( OpAttach Operation = "attach" OpAcquireRun Operation = "run.acquire" OpRenewRun Operation = "run.renew" OpReleaseRun Operation = "run.release" OpReferenceCommit Operation = "reference.commit" OpReferenceAbort Operation = "reference.abort" OpReferenceReserve Operation = "reference.reserve" OpReferenceDeletePrepare Operation = "reference.delete.prepare" OpReferenceDeleteConfirm Operation = "reference.delete.confirm" OpReferenceDeleteCancel Operation = "reference.delete.cancel" OpReferenceRelease Operation = "reference.release" OpRetire Operation = "retire" OpFileRead Operation = "file.read" OpFileResolveAuthority Operation = "file.resolve_authority" OpFileStat Operation = "file.stat" OpFileCreate Operation = "file.create" OpFileReplace Operation = "file.replace" OpFileList Operation = "file.list" OpFileRemove Operation = "file.remove" OpFileRename Operation = "file.rename" OpFileCopy Operation = "file.copy" OpFileGlob Operation = "file.glob" OpFileGrep Operation = "file.grep" OpCommandStart Operation = "command.start" OpCommandStatus Operation = "command.status" OpCommandCancel Operation = "command.cancel" OpCommandStream Operation = "command.stream" )
Supported private-protocol operations.
type ReferenceIntent ¶
type ReferenceIntent struct {
Environment EnvironmentRef
Owner Owner
BindingID string
State ReferenceState
OperationID string
SourceBindingID string
CreatedAt time.Time
}
type ReferenceReleaseRequest ¶
type ReferenceReleaseRequest struct {
Context RequestContext `json:"context"`
}
ReferenceReleaseRequest releases one durable binding reference.
type ReferenceRequest ¶
type ReferenceRequest struct {
Environment EnvironmentRef
Owner Owner
BindingID string
SourceBindingID string
OperationID string
}
type ReferenceState ¶
type ReferenceState string
const ( ReferencePendingCreate ReferenceState = "PendingCreate" ReferencePublished ReferenceState = "Published" ReferencePendingDelete ReferenceState = "PendingDelete" )
type RequestContext ¶
type RequestContext struct {
Environment EnvironmentRef `json:"environment"`
Owner Owner `json:"owner"`
BindingID string `json:"binding_id"`
RunID string `json:"run_id"`
ClaimID string `json:"claim_id"`
Epoch uint64 `json:"epoch"`
GrantGeneration uint64 `json:"grant_generation"`
}
RequestContext carries the exact authorization binding for an operation.
type RetireEnvironmentRequest ¶
type RetireEnvironmentRequest struct {
Environment EnvironmentRef `json:"environment"`
Owner Owner `json:"owner"`
ExpectedEpoch uint64 `json:"expected_execution_epoch"`
ExpectedPodUID string `json:"expected_pod_uid"`
ExpectedPVCUID string `json:"expected_pvc_uid"`
OperationID string `json:"operation_id"`
}
RetireEnvironmentRequest requests controlled retirement without PVC deletion.