Documentation
¶
Index ¶
- Constants
- Variables
- func BaseVersion(version string) string
- func CheckMaxVersionCompatibility(version string, maxVersion string) bool
- func CheckVersionCompatibility(version string, minVersion string) bool
- func ContextWithClientMetadata(ctx context.Context, clientMetadata *ClientMetadata) context.Context
- func FullVersion() string
- func NormalizeVersion(version string) string
- func RipgrepNoFilesSearched(stderr string) bool
- type ClientMetadata
- type ExtraModule
- type LocalExportOpts
- type LocalImportOpts
- type LocalSearchOpts
- type LocalSearchResult
- type LocalSearchSubmatch
Constants ¶
const ( EngineImageRepo = "registry.dagger.io/engine" Package = "github.com/dagger/dagger" DefaultEngineSockAddr = distconsts.DefaultEngineSockAddr DaggerNameEnv = "_EXPERIMENTAL_DAGGER_ENGINE_NAME" DaggerVersionEnv = "_EXPERIMENTAL_DAGGER_VERSION" DaggerTagEnv = "_EXPERIMENTAL_DAGGER_TAG" DaggerMinimumVersionEnv = "_EXPERIMENTAL_DAGGER_MIN_VERSION" CloudRunnerHostPrefix = "dagger-cloud://" DefaultCloudRunnerHost = CloudRunnerHostPrefix + "default-engine-config.dagger.cloud" )
const ( StdinPrefix = "\x00," StdoutPrefix = "\x01," StderrPrefix = "\x02," ResizePrefix = "resize," ExitPrefix = "exit," )
const ( HTTPProxyEnvName = "HTTP_PROXY" HTTPSProxyEnvName = "HTTPS_PROXY" FTPProxyEnvName = "FTP_PROXY" NoProxyEnvName = "NO_PROXY" AllProxyEnvName = "ALL_PROXY" SessionAttachablesEndpoint = "/sessionAttachables" InitEndpoint = "/init" QueryEndpoint = "/query" ShutdownEndpoint = "/shutdown" // Buildkit-interpreted session keys, can't change SessionIDMetaKey = "X-Docker-Expose-Session-Uuid" SessionNameMetaKey = "X-Docker-Expose-Session-Name" SessionMethodNameMetaKey = "X-Docker-Expose-Session-Grpc-Method" )
const ( OTelTraceParentEnv = "TRACEPARENT" OTelTracesExporterEnv = "OTEL_TRACES_EXPORTER" OTelExporterProtocolEnv = "OTEL_EXPORTER_OTLP_PROTOCOL" OTelExporterEndpointEnv = "OTEL_EXPORTER_OTLP_ENDPOINT" OTelTracesProtocolEnv = "OTEL_EXPORTER_OTLP_TRACES_PROTOCOL" OTelTracesEndpointEnv = "OTEL_EXPORTER_OTLP_TRACES_ENDPOINT" OTelTracesLiveEnv = "OTEL_EXPORTER_OTLP_TRACES_LIVE" OTelLogsProtocolEnv = "OTEL_EXPORTER_OTLP_LOGS_PROTOCOL" OTelLogsEndpointEnv = "OTEL_EXPORTER_OTLP_LOGS_ENDPOINT" OTelMetricsProtocolEnv = "OTEL_EXPORTER_OTLP_METRICS_PROTOCOL" OTelMetricsEndpointEnv = "OTEL_EXPORTER_OTLP_METRICS_ENDPOINT" )
const ( EngineVersionMetaKey = "X-Dagger-Engine" ClientMetadataMetaKey = "X-Dagger-Client-Metadata" // socket session attachable keys SocketURLEncodedKey = "X-Dagger-Socket-URLEncoded" )
Variables ¶
var ( // Version is the engine/CLI semver, derived from internal/version.Version // (which embeds the VERSION file at build time) with a "v" prefix. It is no // longer injected via -ldflags: the binary self-reports from embedded VERSION. // // DAGGER_VERSION overrides at init for tests. Version string // Tag is the default engine image tag. It defaults to Version. // // DAGGER_TAG overrides at init for tests. Tag string // MinimumEngineVersion is used by the client to determine the minimum // allowed engine version that can be used by that client. MinimumEngineVersion = "v0.19.0" // MinimumClientVersion is used by the engine to determine the minimum // allowed client version that can connect to that engine. MinimumClientVersion = "v0.19.0" // MinimumModuleVersion is used by the engine to determine the minimum // allowed module engine version that can connect to this engine. // // Set to v0.9.9, because this was when the engineVersion field was // introduced - if it's present and not a dev version, it must be higher // than v0.9.9. MinimumModuleVersion = "v0.9.9" // MinimumDefaultFunctionCachingModuleVersion is the minimum module version at which // we will enable default function caching behavior. MinimumDefaultFunctionCachingModuleVersion = "v0.19.4" // MinimumDangV2ModuleVersion is the minimum module engine version that gets // Dang v2 semantics (`.{ }` is dot-block application, `.{{ }}` is // selection); older modules keep Dang v1 semantics (`.{ }` is selection). MinimumDangV2ModuleVersion = "v0.21.5" )
var ProxyEnvNames = []string{ HTTPProxyEnvName, HTTPSProxyEnvName, FTPProxyEnvName, NoProxyEnvName, AllProxyEnvName, }
Functions ¶
func BaseVersion ¶ added in v0.12.4
func CheckMaxVersionCompatibility ¶ added in v0.12.4
func CheckVersionCompatibility ¶ added in v0.11.7
func ContextWithClientMetadata ¶ added in v0.8.0
func ContextWithClientMetadata(ctx context.Context, clientMetadata *ClientMetadata) context.Context
func FullVersion ¶
func FullVersion() string
func NormalizeVersion ¶ added in v0.12.4
func RipgrepNoFilesSearched ¶
RipgrepNoFilesSearched reports whether ripgrep's stderr says it exited only because every candidate file was excluded by a filter (globs, ignore rules, hidden-file rules), rather than because something actually went wrong.
ripgrep exits 2 with "No files were searched, which means ripgrep probably applied a filter you didn't expect." even though "the filter matched nothing" is a perfectly ordinary outcome of a search - e.g. a --glob naming a file that doesn't exist in the tree being searched. Since search results from one tree get merged with results from others (workspace overlays, cache mounts), treating this as fatal loses matches that do exist in the other trees.
Types ¶
type ClientMetadata ¶ added in v0.8.0
type ClientMetadata struct {
// ClientID is unique to each client, randomly generated each time a client initializes.
// It's also used as the *buildkit* session ID (as opposed to the dagger session ID), which
// is created for each client.
ClientID string `json:"client_id"`
// ClientSecretToken is a secret token that is unique to every client.
// Every request w/ that client ID must also include the same token.
ClientSecretToken string `json:"client_secret_token"`
// SessionID is the id of the dagger session that a client and any of its nested
// module clients connect to
SessionID string `json:"session_id"`
// ClientHostname is the hostname of the client that made the request. It's
// used to help identify clients in the logs more clearly; nothing functional.
ClientHostname string `json:"client_hostname"`
// ClientStableID is an ID that's persisted in a client's XDG state directory.
// It's currently used to identify clients that are executing on the same host in order to
// tell buildkit which filesync cache ref to re-use when syncing dirs+files to the engine.
ClientStableID string `json:"client_stable_id"`
// ClientVersion is the version string of the client that make the request.
ClientVersion string `json:"client_version"`
// (Optional) Pipeline labels for e.g. vcs info like branch, commit, etc.
Labels map[string]string `json:"labels"`
// Interactive mode
Interactive bool `json:"interactive"`
// InteractiveCommand changes the command that is run in interactive mode.
InteractiveCommand []string `json:"interactive_command"`
// Import configuration for Buildkit's remote cache
UpstreamCacheImportConfig []*controlapi.CacheOptionsEntry `json:"upstream_cache_import_config"`
// Export configuration for Buildkit's remote cache
UpstreamCacheExportConfig []*controlapi.CacheOptionsEntry `json:"upstream_cache_export_config"`
// Dagger Cloud Org
CloudOrg string `json:"cloud_org"`
// Disable analytics
DoNotTrack bool `json:"do_not_track"`
// SSH auth socket path
SSHAuthSocketPath string `json:"ssh_auth_socket_path"`
// Modules permitted to access LLM APIs or "all" to bypass restrictions for any loaded module.
AllowedLLMModules []string `json:"allowed_llm_modules"`
// Disable lazy loading on module runtime.
EagerRuntime bool `json:"eager_runtime"`
// If set, the auth for cloud requests; used for PARC and scale-out
CloudAuth *auth.Cloud `json:"cloud_auth,omitempty"`
// If true, this client enables scaling checks out to cloud engines
EnableCloudScaleOut bool `json:"enable_cloud_scale_out,omitempty"`
// if set, this client is another engine scaling out to the current one, and the current
// one has this ID. Should be included in OTEL span sttrs so we can correlate spans to engine.
// TODO: This is a bit convoluted; it would be nicer if an engine could figure out its own ID
// rather than being told what it is by the client connecting to it.
CloudScaleOutEngineID string `json:"cloud_scale_out_engine_id,omitempty"`
// ExtraModules specifies additional modules to load at connect time.
// When Entrypoint is true, the module's main-object methods are proxied onto
// the Query root in addition to its namespaced constructor.
ExtraModules []ExtraModule `json:"extra_modules,omitempty"`
// LoadWorkspaceModules opts this client into loading workspace modules.
// When false, only the core API is exposed by default.
LoadWorkspaceModules bool `json:"load_workspace_modules,omitempty"`
// SingleQuery declares that this client will send at most one GraphQL query
// request before disconnecting. The engine may use the query document to
// optimize session initialization.
SingleQuery bool `json:"single_query,omitempty"`
// SkipWorkspaceModules is a legacy compatibility input. New clients should
// use LoadWorkspaceModules instead.
SkipWorkspaceModules bool `json:"skip_workspace_modules,omitempty"`
// SuppressCompatWorkspaceWarning disables the user-facing warning emitted
// when a legacy dagger.json is projected into a compat workspace.
SuppressCompatWorkspaceWarning bool `json:"suppress_compat_workspace_warning,omitempty"`
// Workspace explicitly declares the workspace binding for this client.
// When unset, the engine applies default workspace binding behavior.
Workspace *string `json:"workspace,omitempty"`
// WorkspaceEnv explicitly selects the workspace environment overlay for
// this client. When unset, no environment overlay is applied.
WorkspaceEnv *string `json:"workspace_env,omitempty"`
// UserConfigPath is the caller-host path to the user-level Dagger config
// file (~/.config/dagger/config.toml). The engine reads it through the
// caller host session to apply user-level workspace overrides. When unset,
// no user-level config is consulted.
UserConfigPath string `json:"user_config_path,omitempty"`
// WorkspaceModuleScope hints at the workspace module this client's first
// schema introspection targets: the leading CLI command token, unresolved
// (it may name a module, an entrypoint-proxied function, or a typo). The
// engine may use it to defer loading unrelated workspace modules for the
// first request whose only full-schema demand is currentTypeDefs. An
// unrecognized token falls back to the entrypoint module when one is
// configured, else to loading everything; deferred modules load on demand
// from later requests.
WorkspaceModuleScope string `json:"workspace_module_scope,omitempty"`
// UseRecipeIDsByDefault asks id() to return recipe-form IDs unless the
// request explicitly passes a recipe argument. This is engine-internal
// nested-client state and must not be forwarded through client headers.
UseRecipeIDsByDefault bool `json:"-"`
// Profile enables engine wall-clock profiling (wcprof) for the duration
// of this client's work. Experimental; the recorded events are retrieved
// via the engine debug endpoints.
Profile bool `json:"profile,omitempty"`
}
func ClientMetadataFromContext ¶ added in v0.8.0
func ClientMetadataFromContext(ctx context.Context) (*ClientMetadata, error)
func ClientMetadataFromHTTPHeaders ¶ added in v0.11.8
func ClientMetadataFromHTTPHeaders(h http.Header) (*ClientMetadata, error)
func (ClientMetadata) AppendToHTTPHeaders ¶ added in v0.11.8
func (m ClientMetadata) AppendToHTTPHeaders(h http.Header) http.Header
type ExtraModule ¶ added in v0.20.4
type ExtraModule struct {
Ref string `json:"ref"`
Name string `json:"name,omitempty"`
Entrypoint bool `json:"entrypoint,omitempty"`
}
ExtraModule specifies a module to load at connect time in addition to (or instead of) workspace modules.
type LocalExportOpts ¶ added in v0.8.0
type LocalExportOpts struct {
Path string `json:"path"`
IsFileStream bool `json:"is_file_stream"`
FileOriginalName string `json:"file_original_name"`
AllowParentDirPath bool `json:"allow_parent_dir_path"`
FileMode os.FileMode `json:"file_mode"`
// whether to just merge in contents of a directory to the target on the host
// or to replace the target entirely such that it matches the source directory,
// which includes deleting any files that are not in the source directory
Merge bool
RemovePaths []string `json:"remove_paths"`
}
func LocalExportOptsFromContext ¶ added in v0.8.0
func LocalExportOptsFromContext(ctx context.Context) (*LocalExportOpts, error)
func (LocalExportOpts) AppendToOutgoingContext ¶ added in v0.8.0
func (o LocalExportOpts) AppendToOutgoingContext(ctx context.Context) context.Context
func (*LocalExportOpts) FromGRPCMD ¶ added in v0.11.2
func (o *LocalExportOpts) FromGRPCMD(md metadata.MD) error
func (LocalExportOpts) ToGRPCMD ¶ added in v0.8.0
func (o LocalExportOpts) ToGRPCMD() metadata.MD
type LocalImportOpts ¶ added in v0.8.0
type LocalImportOpts struct {
Path string `json:"path"`
UseGitIgnore bool `json:"use_gitignore"`
IncludePatterns []string `json:"include_patterns"`
ExcludePatterns []string `json:"exclude_patterns"`
FollowPaths []string `json:"follow_paths"`
ReadSingleFileOnly bool `json:"read_single_file_only"`
MaxFileSize int64 `json:"max_file_size"`
StatPathOnly bool `json:"stat_path_only"`
StatReturnAbsPath bool `json:"stat_return_abs_path"`
StatResolvePath bool `json:"stat_resolve_path"`
GetAbsPathOnly bool `json:"get_abs_path_only"`
GlobPattern string `json:"glob_pattern"`
SearchOpts *LocalSearchOpts `json:"search_opts,omitempty"`
}
func LocalImportOptsFromContext ¶ added in v0.8.0
func LocalImportOptsFromContext(ctx context.Context) (*LocalImportOpts, error)
func (LocalImportOpts) AppendToOutgoingContext ¶ added in v0.8.0
func (o LocalImportOpts) AppendToOutgoingContext(ctx context.Context) context.Context
func (*LocalImportOpts) FromGRPCMD ¶ added in v0.11.2
func (o *LocalImportOpts) FromGRPCMD(md metadata.MD) error
func (LocalImportOpts) ToGRPCMD ¶ added in v0.8.0
func (o LocalImportOpts) ToGRPCMD() metadata.MD
type LocalSearchOpts ¶
type LocalSearchOpts struct {
Pattern string `json:"pattern"`
Literal bool `json:"literal,omitempty"`
Multiline bool `json:"multiline,omitempty"`
Dotall bool `json:"dotall,omitempty"`
Insensitive bool `json:"insensitive,omitempty"`
SkipIgnored bool `json:"skip_ignored,omitempty"`
SkipHidden bool `json:"skip_hidden,omitempty"`
FilesOnly bool `json:"files_only,omitempty"`
Limit *int `json:"limit,omitempty"`
Paths []string `json:"paths,omitempty"`
Globs []string `json:"globs,omitempty"`
}
LocalSearchOpts configures a client-side search (ripgrep/grep).
type LocalSearchResult ¶
type LocalSearchResult struct {
FilePath string `json:"file_path"`
LineNumber int `json:"line_number"`
AbsoluteOffset int `json:"absolute_offset"`
MatchedLines string `json:"matched_lines"`
Submatches []LocalSearchSubmatch `json:"submatches,omitempty"`
}
LocalSearchResult is a search match returned from a client-side search.
type LocalSearchSubmatch ¶
type LocalSearchSubmatch struct {
Text string `json:"text"`
Start int `json:"start"`
End int `json:"end"`
}
LocalSearchSubmatch is a sub-match within a search result.
Directories
¶
| Path | Synopsis |
|---|---|
|
distconsts
module
|
|
|
Package ebpf provides eBPF-based tracing utilities for the Dagger engine.
|
Package ebpf provides eBPF-based tracing utilities for the Dagger engine. |
|
filetracer
Package filetracer provides an eBPF-based tracer for file operations performed by the dagger-engine process.
|
Package filetracer provides an eBPF-based tracer for file operations performed by the dagger-engine process. |
|
ovltracer
Package ovltracer provides an eBPF-based tracer for catching overlayfs "in-use" errors (EBUSY).
|
Package ovltracer provides an eBPF-based tracer for catching overlayfs "in-use" errors (EBUSY). |
|
session
|
|
|
sources
|
|
|
Package vcs exposes functions for resolving import paths and using version control systems, which can be used to implement behavior similar to the standard "go get" command.
|
Package vcs exposes functions for resolving import paths and using version control systems, which can be used to implement behavior similar to the standard "go get" command. |
|
Package wcprof implements cheap wall-clock profiling for the engine.
|
Package wcprof implements cheap wall-clock profiling for the engine. |