feature

package
v1.3.0-rc.16 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 18, 2026 License: MPL-2.0 Imports: 34 Imported by: 0

Documentation

Index

Constants

View Source
const CollectionLayerMediaType = "application/vnd.devcontainers.collection.layer.v1+json"
View Source
const DEVCONTAINER_MANIFEST_MEDIATYPE = "application/vnd.devcontainers"
View Source
const FEATURE_BASE_DOCKERFILE = `
FROM $_DEV_CONTAINERS_BASE_IMAGE AS dev_containers_target_stage

USER root

COPY ./` + config.DevsyContextFeatureFolder + `/ /tmp/build-features/
RUN chmod -R 0755 /tmp/build-features && ls /tmp/build-features

#{featureLayer}

ARG _DEV_CONTAINERS_IMAGE_USER=root
USER $_DEV_CONTAINERS_IMAGE_USER
`

Variables

This section is empty.

Functions

func FetchOCIManifest added in v1.1.0

func FetchOCIManifest(ref name.Reference) (*v1.Manifest, error)

func GetFeatureEnvVariables added in v1.1.0

func GetFeatureEnvVariables(feature *config.FeatureConfig, featureOptions any) []string

func GetFeatureInstallWrapperScript added in v1.1.0

func GetFeatureInstallWrapperScript(
	idWithoutVersion string,
	feature *config.FeatureConfig,
	options []string,
) string

func IsSecretOption added in v1.1.0

func IsSecretOption(option config.FeatureConfigOption) bool

IsSecretOption returns true if the given option has type "secret".

func LoadOCIAnnotations added in v1.1.0

func LoadOCIAnnotations(featureFolder string) map[string]string

func ProcessFeatureID

func ProcessFeatureID(
	id string,
	devContainerConfig *config.DevContainerConfig,
	forceBuild bool,
) (string, error)

func PullFeatureToTemp added in v1.1.0

func PullFeatureToTemp(ref name.Reference, id string) (string, error)

func ResolveFeatureOrder added in v1.1.0

func ResolveFeatureOrder(
	devContainerConfig *config.DevContainerConfig,
) ([]*config.FeatureSet, error)

ResolveFeatureOrder parses the features in a DevContainerConfig, resolves their dependencies, and returns them in topological install order.

func ResolveSecretOptions added in v1.1.0

func ResolveSecretOptions(
	featureID string,
	featureCfg *config.FeatureConfig,
	userOptions map[string]any,
	opts *SecretOptions,
) (map[string]any, error)

ResolveSecretOptions resolves secret-typed options for a feature. For each option with type "secret", it checks (in order): user-provided value, environment variable, secrets file, default value. Returns an error if a secret is required but not provided.

func ValidateFeatureOptions added in v1.1.0

func ValidateFeatureOptions(
	featureID string,
	featureCfg *config.FeatureConfig,
	userOptions any,
) error

ValidateFeatureOptions checks that user-provided option values satisfy the type and enum constraints declared in the feature configuration.

Types

type BuildInfo

type BuildInfo struct {
	FeaturesFolder          string
	DockerfileContent       string
	OverrideTarget          string
	DockerfilePrefixContent string
	BuildArgs               map[string]string
}

type Collection added in v1.1.0

type Collection struct {
	Features []CollectionFeature `json:"features"`
}

func FetchCollection added in v1.1.0

func FetchCollection(registry, namespace string) (*Collection, error)

type CollectionFeature added in v1.1.0

type CollectionFeature struct {
	ID               string         `json:"id"`
	Version          string         `json:"version"`
	Name             string         `json:"name"`
	Description      string         `json:"description"`
	DocumentationURL string         `json:"documentationURL,omitempty"`
	Options          map[string]any `json:"options,omitempty"`
	Deprecated       bool           `json:"deprecated,omitempty"`
}

func ListCollectionFeatures added in v1.1.0

func ListCollectionFeatures(registry, namespace string) ([]CollectionFeature, error)

type ExtendedBuildInfo

type ExtendedBuildInfo struct {
	Features          []*config.FeatureSet
	FeaturesBuildInfo *BuildInfo

	MetadataConfig *config.ImageMetadataConfig
	MetadataLabel  string
}

func GetExtendedBuildInfo

func GetExtendedBuildInfo(params *ExtendedBuildParams) (*ExtendedBuildInfo, error)

type ExtendedBuildParams added in v1.1.0

type ExtendedBuildParams struct {
	Ctx                *config.SubstitutionContext
	ImageBuildInfo     *config.ImageBuildInfo
	Target             string
	DevContainerConfig *config.SubstitutedConfig
	ForceBuild         bool
	SecretOpts         *SecretOptions
}

type SecretOptions added in v1.1.0

type SecretOptions struct {
	SecretsFile string
	Prompter    SecretPrompter
}

SecretOptions holds configuration for resolving secret-typed feature options.

type SecretPrompter added in v1.1.0

type SecretPrompter interface {
	PromptSecret(featureID, optionName string) (string, error)
}

SecretPrompter prompts the user for a secret value. Implementations should mask input when running interactively, or handle non-interactive mode (e.g. emit a warning and return an empty string).

type TerminalSecretPrompter added in v1.1.0

type TerminalSecretPrompter struct {
	IsTerminal func() bool
}

TerminalSecretPrompter prompts for secrets interactively when stdin is a terminal, and emits a warning in non-interactive mode.

func (*TerminalSecretPrompter) PromptSecret added in v1.1.0

func (p *TerminalSecretPrompter) PromptSecret(featureID, optionName string) (string, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL