Dagger.ModuleSource (dagger v1.0.0-beta.11)

Copy Markdown View Source

The source needed to load and run a module, along with any metadata about the source such as versions/urls/etc.

Summary

Functions

Load the source as a module. If this is a local source, the parent directory must have been provided during module source creation

A human readable ref string representation of this module source.

The blueprint referenced by the module source.

The client-facing introspection schema JSON file for this module source.

The ref to clone the root of the git repo from. Only valid for git sources.

The resolved commit of the git repo this source points to.

The clients generated for the module.

Whether an existing module config file was found.

The full directory loaded for the module source, including the source code as a subdirectory.

The dependencies of the module source.

A content-hash of the module source. Module sources with the same digest will output the same generated context and convert into the same module instance.

The directory containing the module configuration and source code (source code may be in a subdir).

The engine version of the module.

Return the supplied workspace with this module's generated context applied.

Generate this module's transitive local dependency closure and return the staged changes as a single changeset against the unstaged workspace root.

The generated files and directories made on top of the module source's context directory, returned as a Changeset.

The generated files and directories made on top of the module source's context directory.

The URL to access the web view of the repository (e.g., GitHub, GitLab, Bitbucket).

The URL to the source's git repo in a web browser. Only valid for git sources.

A unique identifier for this ModuleSource.

The introspection schema JSON file for this module source.

The kind of module source (currently local, git or dir).

The full absolute path to the context directory on the caller's host filesystem that this module source is loaded from. Only valid for local module sources.

The name of the module, including any setting via the withName API.

The original name of the module as read from the module config file (or set for the first time with the withName API).

The original subpath used when instantiating this module source, relative to the context directory.

The pinned version of this module source.

The import path corresponding to the root of the git repo this source points to. Only valid for git sources.

The SDK configuration of the module.

The path, relative to the context directory, that contains the module config.

The path to the directory containing the module's source code, relative to the context directory.

Forces evaluation of the module source, including any loading into the engine and associated validation.

The toolchains referenced by the module source.

The module's dagger.json with any in-memory edits from with* APIs applied, as a diff relative to the source's context directory.

User-defined defaults read from local .env files

The specified version of the git repo this source points to.

Set a blueprint for the module source.

Update the module source with a new client to generate.

Append the provided dependencies to the module source's dependency list.

Upgrade the engine version of the module to the given value.

Enable the experimental features for the module source.

Update the module source with additional include patterns for files+directories from its context that are required for building it

Update the module source with a new name.

Update the module source with a new SDK.

Update the module source with a new source subpath.

Add toolchains to the module source.

Update the blueprint module to the latest version.

Update one or more module dependencies.

Update one or more toolchains.

Update one or more clients.

Remove the current blueprint from the module source.

Remove a client from the module source.

Remove the provided dependencies from the module source's dependency list.

Disable experimental features for the module source.

Remove the provided toolchains from the module source.

Types

t()

@type t() :: %Dagger.ModuleSource{client: term(), query_builder: term()}

Functions

as_module(module_source)

@spec as_module(t()) :: Dagger.Module.t()

Load the source as a module. If this is a local source, the parent directory must have been provided during module source creation

as_string(module_source)

@spec as_string(t()) :: {:ok, String.t()} | {:error, term()}

A human readable ref string representation of this module source.

blueprint(module_source)

This function is deprecated. Legacy dagger.json field. Generic module loading no longer honors it; use workspace modules in dagger.toml instead. .
@spec blueprint(t()) :: t()

The blueprint referenced by the module source.

client_schema_introspection_json(module_source)

@spec client_schema_introspection_json(t()) :: Dagger.File.t()

The client-facing introspection schema JSON file for this module source.

This is the schema consumed by client codegen: unlike introspectionSchemaJSON (the module-facing schema), it hides no core types and installs this module (reached via dag.<moduleName>) so a generated client can bind it. The module's dependencies are excluded: a client is generated for a single module plus core, not its dependency graph.

clone_ref(module_source)

@spec clone_ref(t()) :: {:ok, String.t()} | {:error, term()}

The ref to clone the root of the git repo from. Only valid for git sources.

commit(module_source)

@spec commit(t()) :: {:ok, String.t()} | {:error, term()}

The resolved commit of the git repo this source points to.

config_clients(module_source)

@spec config_clients(t()) :: {:ok, [Dagger.ModuleConfigClient.t()]} | {:error, term()}

The clients generated for the module.

config_exists(module_source)

@spec config_exists(t()) :: {:ok, boolean()} | {:error, term()}

Whether an existing module config file was found.

context_directory(module_source)

@spec context_directory(t()) :: Dagger.Directory.t()

The full directory loaded for the module source, including the source code as a subdirectory.

dependencies(module_source)

@spec dependencies(t()) :: {:ok, [t()]} | {:error, term()}

The dependencies of the module source.

digest(module_source)

@spec digest(t()) :: {:ok, String.t()} | {:error, term()}

A content-hash of the module source. Module sources with the same digest will output the same generated context and convert into the same module instance.

directory(module_source, path)

@spec directory(t(), String.t()) :: Dagger.Directory.t()

The directory containing the module configuration and source code (source code may be in a subdir).

engine_version(module_source)

@spec engine_version(t()) :: {:ok, String.t()} | {:error, term()}

The engine version of the module.

generate(module_source, workspace)

@spec generate(t(), Dagger.Workspace.t()) :: Dagger.Workspace.t()

Return the supplied workspace with this module's generated context applied.

The workspace change baseline is preserved, so a later Workspace.changes call includes this generation together with any other edits made by the caller.

generate_local_dependencies(module_source, workspace)

@spec generate_local_dependencies(t(), Dagger.Workspace.t()) :: Dagger.Changeset.t()

Generate this module's transitive local dependency closure and return the staged changes as a single changeset against the unstaged workspace root.

Each local dependency is generated by its own SDK against a workspace scoped to it, carrying the dependency's own already-generated dependencies. Remote (git) dependencies are assumed committed and skipped. Overlay the result onto the workspace before generating this module; it is not this module's own generated code.

generated_context_changeset(module_source)

@spec generated_context_changeset(t()) :: Dagger.Changeset.t()

The generated files and directories made on top of the module source's context directory, returned as a Changeset.

generated_context_directory(module_source)

@spec generated_context_directory(t()) :: Dagger.Directory.t()

The generated files and directories made on top of the module source's context directory.

html_repo_url(module_source)

@spec html_repo_url(t()) :: {:ok, String.t()} | {:error, term()}

The URL to access the web view of the repository (e.g., GitHub, GitLab, Bitbucket).

html_url(module_source)

@spec html_url(t()) :: {:ok, String.t()} | {:error, term()}

The URL to the source's git repo in a web browser. Only valid for git sources.

id(module_source)

@spec id(t()) :: {:ok, String.t()} | {:error, term()}

A unique identifier for this ModuleSource.

introspection_schema_json(module_source)

@spec introspection_schema_json(t()) :: Dagger.File.t()

The introspection schema JSON file for this module source.

This file represents the schema visible to the module's source code, including all core types and those from the dependencies.

Note: this is in the context of a module, so some core types may be hidden.

kind(module_source)

@spec kind(t()) :: {:ok, Dagger.ModuleSourceKind.t()} | {:error, term()}

The kind of module source (currently local, git or dir).

local_context_directory_path(module_source)

@spec local_context_directory_path(t()) :: {:ok, String.t()} | {:error, term()}

The full absolute path to the context directory on the caller's host filesystem that this module source is loaded from. Only valid for local module sources.

module_name(module_source)

@spec module_name(t()) :: {:ok, String.t()} | {:error, term()}

The name of the module, including any setting via the withName API.

module_original_name(module_source)

@spec module_original_name(t()) :: {:ok, String.t()} | {:error, term()}

The original name of the module as read from the module config file (or set for the first time with the withName API).

original_subpath(module_source)

@spec original_subpath(t()) :: {:ok, String.t()} | {:error, term()}

The original subpath used when instantiating this module source, relative to the context directory.

pin(module_source)

@spec pin(t()) :: {:ok, String.t()} | {:error, term()}

The pinned version of this module source.

repo_root_path(module_source)

@spec repo_root_path(t()) :: {:ok, String.t()} | {:error, term()}

The import path corresponding to the root of the git repo this source points to. Only valid for git sources.

sdk(module_source)

@spec sdk(t()) :: {:ok, Dagger.SDKConfig.t() | nil} | {:error, term()}

The SDK configuration of the module.

source_root_subpath(module_source)

@spec source_root_subpath(t()) :: {:ok, String.t()} | {:error, term()}

The path, relative to the context directory, that contains the module config.

source_subpath(module_source)

@spec source_subpath(t()) :: {:ok, String.t()} | {:error, term()}

The path to the directory containing the module's source code, relative to the context directory.

sync(module_source)

@spec sync(t()) :: {:ok, t()} | {:error, term()}

Forces evaluation of the module source, including any loading into the engine and associated validation.

toolchains(module_source)

This function is deprecated. Legacy dagger.json field. Generic module loading no longer honors it; use workspace modules in dagger.toml instead. .
@spec toolchains(t()) :: {:ok, [t()]} | {:error, term()}

The toolchains referenced by the module source.

updated_config_directory(module_source)

@spec updated_config_directory(t()) :: Dagger.Directory.t()

The module's dagger.json with any in-memory edits from with* APIs applied, as a diff relative to the source's context directory.

Unlike generatedContextDirectory, this does not run codegen and does not validate the engine version against the running engine, so it can be used to declare an engine requirement newer than the running engine. Loading or serving such a module still fails at moduleSource.asModule.

user_defaults(module_source)

@spec user_defaults(t()) :: Dagger.EnvFile.t()

User-defined defaults read from local .env files

version(module_source)

@spec version(t()) :: {:ok, String.t()} | {:error, term()}

The specified version of the git repo this source points to.

with_blueprint(module_source, blueprint)

This function is deprecated. Legacy dagger.json field. Generic module loading no longer honors it; use workspace modules in `dagger.toml` instead. .
@spec with_blueprint(t(), t()) :: t()

Set a blueprint for the module source.

with_client(module_source, generator, output_dir)

@spec with_client(t(), String.t(), String.t()) :: t()

Update the module source with a new client to generate.

with_dependencies(module_source, dependencies)

@spec with_dependencies(t(), [String.t()]) :: t()

Append the provided dependencies to the module source's dependency list.

with_engine_version(module_source, version)

@spec with_engine_version(t(), String.t()) :: t()

Upgrade the engine version of the module to the given value.

with_experimental_features(module_source, features)

@spec with_experimental_features(t(), [Dagger.ModuleSourceExperimentalFeature.t()]) ::
  t()

Enable the experimental features for the module source.

with_includes(module_source, patterns)

@spec with_includes(t(), [String.t()]) :: t()

Update the module source with additional include patterns for files+directories from its context that are required for building it

with_name(module_source, name)

@spec with_name(t(), String.t()) :: t()

Update the module source with a new name.

with_sdk(module_source, source)

@spec with_sdk(t(), String.t()) :: t()

Update the module source with a new SDK.

with_source_subpath(module_source, path)

@spec with_source_subpath(t(), String.t()) :: t()

Update the module source with a new source subpath.

with_toolchains(module_source, toolchains)

This function is deprecated. Legacy dagger.json field. Generic module loading no longer honors it; use workspace modules in `dagger.toml` instead. .
@spec with_toolchains(t(), [String.t()]) :: t()

Add toolchains to the module source.

with_update_blueprint(module_source)

This function is deprecated. Legacy dagger.json field. Generic module loading no longer honors it; use workspace modules in `dagger.toml` instead. .
@spec with_update_blueprint(t()) :: t()

Update the blueprint module to the latest version.

with_update_dependencies(module_source, dependencies)

@spec with_update_dependencies(t(), [String.t()]) :: t()

Update one or more module dependencies.

with_update_toolchains(module_source, toolchains)

This function is deprecated. Legacy dagger.json field. Generic module loading no longer honors it; use workspace modules in `dagger.toml` instead. .
@spec with_update_toolchains(t(), [String.t()]) :: t()

Update one or more toolchains.

with_updated_clients(module_source, clients)

@spec with_updated_clients(t(), [String.t()]) :: t()

Update one or more clients.

without_blueprint(module_source)

This function is deprecated. Legacy dagger.json field. Generic module loading no longer honors it; use workspace modules in `dagger.toml` instead. .
@spec without_blueprint(t()) :: t()

Remove the current blueprint from the module source.

without_client(module_source, path)

@spec without_client(t(), String.t()) :: t()

Remove a client from the module source.

without_dependencies(module_source, dependencies)

@spec without_dependencies(t(), [String.t()]) :: t()

Remove the provided dependencies from the module source's dependency list.

without_experimental_features(module_source, features)

@spec without_experimental_features(t(), [Dagger.ModuleSourceExperimentalFeature.t()]) ::
  t()

Disable experimental features for the module source.

without_toolchains(module_source, toolchains)

This function is deprecated. Legacy dagger.json field. Generic module loading no longer honors it; use workspace modules in `dagger.toml` instead. .
@spec without_toolchains(t(), [String.t()]) :: t()

Remove the provided toolchains from the module source.