projects

package
v3.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2026 License: BSD-3-Clause Imports: 81 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	ProjectBundleManifest = "arcane-project.json"
	ProjectBundleProject  = "project.tar.gz"
)
View Source
const (
	ArcaneIconLabel      = "com.getarcaneapp.arcane.icon"
	ArcaneIconLightLabel = "com.getarcaneapp.arcane.icon-light"
	ArcaneIconDarkLabel  = "com.getarcaneapp.arcane.icon-dark"

	ProjectTagMaxLength       = 64
	ProjectTagsPerSourceLimit = 50
)
View Source
const (
	ArcaneTrashPrefix    = ".arcane-trash-"
	RestoreScratchPrefix = ".project-restore-"
)
View Source
const (
	GlobalEnvFileName                         = ".env.global"
	EffectiveEnvFileName                      = ".env"
	GitSourceEnvFileName                      = ".env.git"
	OverrideEnvFileName                       = "project.env"
	ProjectEnvModeDirect       ProjectEnvMode = "direct"
	ProjectEnvModeOverride     ProjectEnvMode = "override"
	GlobalEnvNoInjectDirective                = "arcane:noinject"
)
View Source
const (
	DefaultComposeFileName = "compose.yaml"
	// DefaultComposeOverrideFileName is the override filename Arcane writes when a
	// project gains an override but has none on disk. It is deliberately
	// ComposeOverrideFileCandidates[1] ("compose.override.yaml"), NOT [0]
	// ("compose.override.yml"), so the default override extension matches Arcane's
	// ".yaml" base default (DefaultComposeFileName = "compose.yaml"). Do not "fix"
	// this to [0]: `docker compose` has no preference between the two, and keeping
	// ".yaml" avoids a mismatched base/override extension pair.
	DefaultComposeOverrideFileName = "compose.override.yaml"
)
View Source
const (
	JobRunLabel = "com.docker.job.id"
)

Variables

View Source
var (
	ComposeFileCandidates = []string{
		DefaultComposeFileName,
		"compose.yml",
		"docker-compose.yaml",
		"docker-compose.yml",
		"podman-compose.yaml",
		"podman-compose.yml",
	}

	ComposeOverrideFileCandidates = slices.Clone(cli.DefaultOverrideFileNames)
)
View Source
var ErrProjectDirExists = errors.New("project directory already exists")
View Source
var (
	// ReservedRootEnvFiles are the project-root env files the override merge owns; git never writes them raw.
	ReservedRootEnvFiles = []string{EffectiveEnvFileName, GitSourceEnvFileName, OverrideEnvFileName, GlobalEnvFileName}
)

Functions

func ApplyLenientLoaderOptions

func ApplyLenientLoaderOptions(ctx context.Context, opts *loader.Options, composeFile string)

func ApplyOverrideFileChange

func ApplyOverrideFileChange(ctx context.Context, projectsRoot, dir string, overrideContent *string) error

func ApplyRenameVolumeMigration

func ApplyRenameVolumeMigration(ctx context.Context,
	operations types.ProjectRenameRecoveryOperations,
	volumeMigration types.VolumeMigration,
	renameJournal *types.ProjectRenameJournal,
	applied *bool,
) error

func ApplyScalarEdits added in v3.1.0

func ApplyScalarEdits(source []byte, edits []ScalarEdit) []byte

ApplyScalarEdits splices non-overlapping edits into a copy of source.

func BuildAdditiveOverrideEnvContent

func BuildAdditiveOverrideEnvContent(gitContent, localContent string) (string, error)

func BuildArgsFromCompose

func BuildArgsFromCompose(args map[string]*string) map[string]string

func BuildEffectiveEnvContent

func BuildEffectiveEnvContent(gitContent, overrideContent string, lookup EnvMap) (string, error)

func BuildImagePullPlan

func BuildImagePullPlan(project *composeTypes.Project) map[string]ImagePullStep

func BuildImageRefsFromComposeProject

func BuildImageRefsFromComposeProject(project *composeTypes.Project) []string

func BuildLocalImageTag

func BuildLocalImageTag(projectID, projectName, serviceName string) string

func BuildOverrideEnvContent

func BuildOverrideEnvContent(gitContent, effectiveContent string) (string, error)

func BuildPlatformsFromCompose

func BuildPlatformsFromCompose(svc composeTypes.ServiceConfig) []string

func CheckProjectEnvAccess

func CheckProjectEnvAccess(ctx context.Context, projectsDir, dir string) *types.ProjectConfigurationError

func ClassifyProjectVolumes added in v3.2.0

func ClassifyProjectVolumes(project types.Project) []types.ProjectVolume

func CleanupRemovedFiles

func CleanupRemovedFiles(ctx context.Context, projectsRoot, projectPath string, oldFiles, newFiles []string) error

func CloneComposeProject

func CloneComposeProject(project *composeTypes.Project) *composeTypes.Project

func ComposeContentProjectName

func ComposeContentProjectName(composeContent string) string

func ComposeCreate

func ComposeCreate(ctx context.Context, opts types.ComposeCreateOptions) error

func ComposeDown

func ComposeDown(ctx context.Context, opts types.ComposeDownOptions) error

func ComposeEnvFileEntriesFromEnv

func ComposeEnvFileEntriesFromEnv(env EnvMap) []string

func ComposeEnvRequiresDirectorySync

func ComposeEnvRequiresDirectorySync(composePath, overrideFileName string, envContent *string) bool

func ComposeFileEntriesFromEnv

func ComposeFileEntriesFromEnv(env EnvMap) []string

func ComposeFileEnvSelection

func ComposeFileEnvSelection(ctx context.Context, projectsDir, dir string) ([]string, error)

func ComposeGenerate

func ComposeGenerate(ctx context.Context, dockerHost, projectName string, containerIDs []string) (string, error)

func ComposeImageDigest

func ComposeImageDigest(inspect client.ImageInspectResult) string

func ComposeLogs

func ComposeLogs(ctx context.Context, dockerHost, projectName string, out io.Writer, opts types.LogStreamOptions) error

func ComposeRestart

func ComposeRestart(ctx context.Context, target types.ComposeTarget) error

func ComposeRunJob added in v3.1.1

func ComposeRunJob(ctx context.Context, opts types.ComposeRunJobOptions) (int, error)

func ComposeStart added in v3.2.0

func ComposeStart(ctx context.Context, target types.ComposeTarget) error

ComposeStart starts the services' existing containers, leaving their dependencies as they are.

func ComposeStop

func ComposeStop(ctx context.Context, target types.ComposeTarget) error

func ComposeUp

func ComposeUp(ctx context.Context, opts types.ComposeUpOptions) error

func ComposeVolumeConfig added in v3.1.0

func ComposeVolumeConfig(volumeConfig composeTypes.VolumeConfig, key, newName, newComposeName string) composeTypes.VolumeConfig

func ComposeVolumeCreateOptions added in v3.1.0

func ComposeVolumeCreateOptions(config composeTypes.VolumeConfig, oldLabels map[string]string) (client.VolumeCreateOptions, error)

func ComposeVolumeTargetCreateOptions added in v3.2.0

func ComposeVolumeTargetCreateOptions(name string, target types.ComposeVolumeTarget) (client.VolumeCreateOptions, error)

ComposeVolumeTargetCreateOptions creates a restore target as Compose would, or as its own volume when it is external.

func ContainerServices added in v3.2.0

func ContainerServices(containers []container.Summary) []string

ContainerServices returns the Compose service names of the service containers, de-duplicated in first-seen order.

func CreateExactDir

func CreateExactDir(ctx context.Context, projectsRoot, basePath, name string, perm os.FileMode) (path, folderName string, err error)

func CreateNewVolume added in v3.2.0

func CreateNewVolume(ctx context.Context, dockerClient *client.Client, options client.VolumeCreateOptions) error

func CreateUniqueDir

func CreateUniqueDir(ctx context.Context, projectsRoot, basePath, name string, perm os.FileMode, claimed func(dir string) (bool, error)) (path, folderName string, reused bool, err error)

func DefaultSwarmStackEnvTemplate

func DefaultSwarmStackEnvTemplate() string

func DefaultSwarmStackTemplate

func DefaultSwarmStackTemplate() string

func DetectComposeFile

func DetectComposeFile(ctx context.Context, projectsDir, dir string) (string, error)

func DetectComposeOverrideFile

func DetectComposeOverrideFile(ctx context.Context, dir string) string

func DirectorySyncContentsChanged

func DirectorySyncContentsChanged(ctx context.Context, projectPath string, syncFiles []SyncFile, oldSyncedFiles []string, composeFileName string) (bool, error)

func EnsureDefaultTemplates

func EnsureDefaultTemplates(ctx context.Context, configuredTemplatesDir string) error

func EnsureServiceImage

func EnsureServiceImage(projectID, projectName, serviceName string, svc composeTypes.ServiceConfig) (string, composeTypes.ServiceConfig, bool)

func EnsureTemplateDir

func EnsureTemplateDir(ctx context.Context, templatesDir, base string) (dir, composePath, envPath string, err error)

func EnvContentChanged

func EnvContentChanged(oldContent, newContent string) bool

func ExistingOrDefaultOverrideName

func ExistingOrDefaultOverrideName(ctx context.Context, dir string) string

func FinalizeRenameAfterCommit

func FinalizeRenameAfterCommit(ctx context.Context,
	operations types.ProjectRenameRecoveryOperations,
	projectID string,
	volumeMigration types.VolumeMigration,
	renameJournal *types.ProjectRenameJournal,
	journalActive *bool,
)

func FindComposeReplica

func FindComposeReplica(containers []container.Summary, labels map[string]string) (container.Summary, bool)

func FindComposeServiceContainerID

func FindComposeServiceContainerID(ctx context.Context, dockerHost, projectName, serviceName string) (string, error)

func FormatDockerPorts

func FormatDockerPorts(ports []container.PortSummary) []string

func FormatPorts

func FormatPorts(publishers []api.PortPublisher) []string

func FreeSpaceBudget added in v3.2.0

func FreeSpaceBudget(ctx context.Context, dir string) (budget, reserve int64, err error)

func GetHostPathForContainerPath

func GetHostPathForContainerPath(ctx context.Context, dockerCli *client.Client, containerPath string) (string, error)

func GetProjectsDirectory

func GetProjectsDirectory(ctx context.Context, projectsDir string) (string, error)

func GetTemplatesDirectory

func GetTemplatesDirectory(ctx context.Context, templatesDir string) (string, error)

func HasComposeRootKeysInFile

func HasComposeRootKeysInFile(ctx context.Context, path string) (bool, error)

func ImageRefsFrom added in v3.2.0

func ImageRefsFrom[T any](services []T, imageRef func(T) string) []string

func ImageRefsFromComposeServices

func ImageRefsFromComposeServices(services composeTypes.Services) []string

func IsFilesystemSnapshotDirName

func IsFilesystemSnapshotDirName(name string) bool

func IsGitOpsScratchDirName

func IsGitOpsScratchDirName(name string) bool

func IsIgnoredProjectDirName

func IsIgnoredProjectDirName(name string) bool

func IsInternalScratchDirName

func IsInternalScratchDirName(name string) bool

func IsProjectDirectoryEntry

func IsProjectDirectoryEntry(ctx context.Context, entry types.Entry, followSymlinks bool) bool

func IsProjectDirectoryPath

func IsProjectDirectoryPath(ctx context.Context, path string, followSymlinks bool) (bool, error)

func IsProjectFile

func IsProjectFile(filename string) bool

func IsSafeSubdirectory

func IsSafeSubdirectory(baseDir, subdir string) bool

func IsWindowsDrivePath

func IsWindowsDrivePath(candidate string) bool

func LabelsFromCompose

func LabelsFromCompose(labels composeTypes.Labels) map[string]string

func ListGlobalComposeContainers

func ListGlobalComposeContainers(ctx context.Context, dockerClient client.APIClient, dockerHost string) ([]container.Summary, error)

func LoadCachedComposeProject

func LoadCachedComposeProject(ctx context.Context,
	projectCache types.ComposeCache[*composeTypes.Project],
	projectID,
	projectPath,
	composePath,
	projectName,
	projectsDirectory string,
	autoInject bool,
	pathMapper *PathMapper) (*composeTypes.Project,
	error,
)

func LoadComposeProject

func LoadComposeProject(ctx context.Context, opts LoadOptions) (project *composeTypes.Project, err error)

func LoadComposeProjectFromContent

func LoadComposeProjectFromContent(ctx context.Context, opts types.ComposeContentOptions) (project *composeTypes.Project, err error)

func MarshalImageRefsJSON

func MarshalImageRefsJSON(refs []string) string

func MaterializeJob added in v3.1.1

func MaterializeJob(project *composeTypes.Project, name string) (*composeTypes.Project, error)

func NamespaceDependents

func NamespaceDependents(model *composeTypes.Project, services []string) []string

func NewComposeCache

func NewComposeCache[T any](capacity int, clone func(T) T) types.ComposeCache[T]

clone, when supplied, isolates stored values from mutations by callers.

func NewComposeVolumeTarget added in v3.2.0

func NewComposeVolumeTarget(composeName string, volume types.ProjectVolume, recordedLabels map[string]string) types.ComposeVolumeTarget

func NewCoordinator

func NewCoordinator(commands types.ComposeCommands) types.ComposeCoordinator

func NormalizeBuildSelections

func NormalizeBuildSelections(services []string) map[string]struct{}

func NormalizeDeployPullPolicy

func NormalizeDeployPullPolicy(policy string) string

func NormalizeProjectName

func NormalizeProjectName(name string) string

func NormalizeProjectTag

func NormalizeProjectTag(name string) (string, error)

func NormalizeProjectTagColor

func NormalizeProjectTagColor(color types.ProjectTagColor) (types.ProjectTagColor, error)

func NormalizeProjectTags

func NormalizeProjectTags(names []string) ([]string, error)

func NormalizePullPolicy

func NormalizePullPolicy(policy string) string
func OwnLinks(ctx context.Context, projectPath string, sourceDirs []string, report func(ctx context.Context, message string)) error

func PackProjectDirectory added in v3.1.0

func PackProjectDirectory(ctx context.Context, projectPath string, w io.Writer) error

func ParseComposeServices

func ParseComposeServices(ctx context.Context, composeContent string) []string

func ParseEnvContent

func ParseEnvContent(content string) []types.EnvVariable

func ParseImageRefsJSON

func ParseImageRefsJSON(raw string) []string

func ParseNoInjectDirectives

func ParseNoInjectDirectives(content string) map[string]bool

func PathHasSegment

func PathHasSegment(relPath string, match func(string) bool) bool

func PrepareDeployServiceConfig

func PrepareDeployServiceConfig(projectID, projectName, serviceName string, svc composeTypes.ServiceConfig) (composeTypes.ServiceConfig, string, bool)

func PrepareServiceBuildRequest

func PrepareServiceBuildRequest(
	projectID string,
	project *composeTypes.Project,
	serviceName string,
	svc composeTypes.ServiceConfig,
	options types.ProjectBuildOptions,
	defaultProvider string,
) (buildtypes.BuildRequest, composeTypes.ServiceConfig, bool, error)

func ProjectBundleVolumeArchive added in v3.2.0

func ProjectBundleVolumeArchive(key string) string

func ProjectContainerUse added in v3.2.0

func ProjectContainerUse(composeName string, containers []container.Summary) ([]container.Summary, map[string]bool)

func ProjectJobs added in v3.1.1

func ProjectJobs(project *composeTypes.Project) []types.ProjectJob

func ProtectedProjectFilePaths

func ProtectedProjectFilePaths(composeFileName string) map[string]bool

func PullableImageRefs

func PullableImageRefs(project *composeTypes.Project) []string

func ReadComposeOverrideContent

func ReadComposeOverrideContent(ctx context.Context, dir string) string

func ReadExternalEnvFile added in v3.2.0

func ReadExternalEnvFile(ctx context.Context, projectPath string) (content []byte, perm os.FileMode, external bool, err error)

func ReadFolderComposeTemplate

func ReadFolderComposeTemplate(ctx context.Context, baseDir, folder string) (string, *string, string, bool, error)

func ReadProjectBundle added in v3.2.0

func ReadProjectBundle(r io.Reader, visit ProjectBundleVisitor) (types.ProjectManifest, bool, error)

func ReadProjectBundleManifest added in v3.2.0

func ReadProjectBundleManifest(r io.Reader) (types.ProjectManifest, bool)

func ReadProjectFiles

func ReadProjectFiles(ctx context.Context, projectPath, composePath string) (composeContent, envContent string, err error)

func RecoverRenameJournal

func RecoverRenameJournal(ctx context.Context, journal *types.ProjectRenameJournal, projectCommitted bool, operations types.ProjectRenameRecoveryOperations) error

func RefreshComposeImageLabel

func RefreshComposeImageLabel(labels map[string]string, imageDigest string)

func RemapEscapedRelativeSources

func RemapEscapedRelativeSources(
	ctx context.Context,
	pathMapper types.VolumeSourcePathMapper,
	project *composeTypes.Project,
	containerWorkingDir string,
	rawSources map[string]string,
	includeFileResources bool,
)

func RemoveProjectFile

func RemoveProjectFile(ctx context.Context, projectsRoot, dirPath, fileName string) error

func RemoveStaleComposeFiles

func RemoveStaleComposeFiles(ctx context.Context, projectPath, composeFileName string, syncedFiles []string) error

func RenameJournalFilesystemSyncPending

func RenameJournalFilesystemSyncPending(phase string) bool

func ResolveBuildContext

func ResolveBuildContext(workingDir string, svc composeTypes.ServiceConfig, serviceName string) (string, error)

The service config must have a non-nil Build field.

func ResolveComposeOverride

func ResolveComposeOverride(exists func(name string) bool, read func(name string) (string, error)) (fileName, content string, found bool, err error)

func ResolveConfiguredContainerDirectory

func ResolveConfiguredContainerDirectory(ctx context.Context, configuredPath, defaultPath string) string

func ResolveDirectoryIdentity

func ResolveDirectoryIdentity(path string) (string, error)

ResolveDirectoryIdentity stays on os.*: it resolves symlinks that may point anywhere on the host to establish directory identity, which the root-confined acfs API cannot do.

func ResolveEffectiveOverrideForValidation

func ResolveEffectiveOverrideForValidation(ctx context.Context, dir string, overrideContent *string) (*string, string)

func ResolveHostPath

func ResolveHostPath(mounts []HostMount, containerPath string) mo.Option[string]

func ResolvePathWithinDir

func ResolvePathWithinDir(baseDir, path string) (string, error)

func ResolveProjectVolumes added in v3.2.0

func ResolveProjectVolumes(ctx context.Context, opts ResolveProjectVolumesOptions) ([]types.ProjectVolume, map[string]types.Volume, error)

func ResolveRelativeProjectPaths

func ResolveRelativeProjectPaths(project *composeTypes.Project, workdir string)

func ResolveRemoveOrphans

func ResolveRemoveOrphans(gitOpsManaged bool, options *types.ProjectDeployOptions) bool

func ResolveTemplateIconURL

func ResolveTemplateIconURL(ctx context.Context, composeContent, envContent string) *string

func RestoreProjectDirectoryBackup

func RestoreProjectDirectoryBackup(ctx context.Context, projectsDirectory, projectPath string, backup *ProjectUpdateBackup) error

func RestoreProjectUpdateBackup

func RestoreProjectUpdateBackup(ctx context.Context, projectDir string, backup *ProjectUpdateBackup) error

func RewriteComposeProjectName added in v3.1.0

func RewriteComposeProjectName(ctx context.Context, rewrite ComposeProjectNameRewrite) error

RewriteComposeProjectName sets the top-level `name` of every Compose file the project loads and COMPOSE_PROJECT_NAME in its .env, when present, to the requested name. Files outside the project directory are left alone.

func RollbackRenamedProjectDirectory

func RollbackRenamedProjectDirectory(ctx context.Context, oldPath, newPath string) (pathsMissing bool, err error)

func SanitizeImageComponent

func SanitizeImageComponent(value string) string

func SanitizeProjectName

func SanitizeProjectName(name string) string

func SelectBackupVolumes added in v3.2.0

func SelectBackupVolumes(included, requested []string) ([]string, error)

func SelectServices

func SelectServices(model *composeTypes.Project, services []string, options ...composeTypes.DependencyOption) (*composeTypes.Project, error)

func SelectedImageRefs

func SelectedImageRefs(compProj *composeTypes.Project, servicesToUpdate []string) []string

func ServiceSelected

func ServiceSelected(selected map[string]struct{}, name string) bool

func SetComposeProjectName added in v3.1.0

func SetComposeProjectName(source []byte, name string) ([]byte, error)

SetComposeProjectName replaces the value of every top-level `name` in source, leaving all other bytes untouched. Sources without one are returned as is.

func ShouldPullDeployImage

func ShouldPullDeployImage(decision DeployImageDecision, exists bool, lastTagged time.Time) bool

func Slugify

func Slugify(in string) string

func StaleComposeFiles

func StaleComposeFiles(ctx context.Context, projectPath, composeFileName string, syncedFiles []string) ([]string, error)

func UlimitsFromCompose

func UlimitsFromCompose(ulimits map[string]*composeTypes.UlimitsConfig) map[string]string

func UnpackProjectDirectory added in v3.1.0

func UnpackProjectDirectory(ctx context.Context, root string, r io.Reader) error

func ValidateComposeContentForUpdate

func ValidateComposeContentForUpdate(ctx context.Context, req ValidateComposeRequest) (err error)

Missing includes are tolerated here; deployment uses strict executable loading.

func ValidateIncludePathForWrite

func ValidateIncludePathForWrite(projectDir, includePath string) (string, error)

func WithTransientValidationEnvFile

func WithTransientValidationEnvFile(ctx context.Context, projectPath string, effectiveEnvContent *string, run func() error) (err error)

func WriteComposeFile

func WriteComposeFile(ctx context.Context, write ComposeFileWrite) error

func WriteComposeOverrideFile

func WriteComposeOverrideFile(ctx context.Context, projectsRoot, dir string, content *string, fileName string) error

func WriteFileWithPerm

func WriteFileWithPerm(ctx context.Context, filePath, content string, perm os.FileMode) error

func WriteManagedEnvFile

func WriteManagedEnvFile(ctx context.Context, projectsDirectory, projectPath, fileName string, unreadable bool, content string) error

func WriteProjectFile

func WriteProjectFile(ctx context.Context, projectsRoot, dirPath, fileName, content string) error

func WriteProjectFiles

func WriteProjectFiles(ctx context.Context, write ComposeFileWrite, envContent *string) error

func WriteSyncedDirectory

func WriteSyncedDirectory(ctx context.Context, projectsRoot, projectPath string, files []SyncFile) ([]string, error)

func WriteTemplateFile

func WriteTemplateFile(ctx context.Context, filePath, content string) error

func WriteTemplateFiles

func WriteTemplateFiles(ctx context.Context, composePath, envPath, composeContent, envContent string) (*string, error)

Types

type ArcaneComposeMetadata

type ArcaneComposeMetadata struct {
	ServiceIconSets          map[string]IconSet
	ProjectIcon              IconSet
	ProjectURLS              []types.ProjectURL
	ProjectTags              []types.ProjectTagOption
	ComposeFiles             []string
	EnvFiles                 []string
	ProjectTagsAuthoritative bool
}

func ComposeCacheDependencies

func ComposeCacheDependencies(
	ctx context.Context,
	model *composeTypes.Project,
	dependencies types.ComposeDependencies,
	composePath, projectsDirectory string,
	autoInject bool,
) ([]string, []string, ArcaneComposeMetadata, bool)

func ParseArcaneComposeMetadata

func ParseArcaneComposeMetadata(ctx context.Context, composeFilePath, projectsDirectory string, autoInjectEnv bool) (ArcaneComposeMetadata, error)

When projectsDirectory is set, Arcane's project env loading is used so .env.global is available.

type Client

type Client struct {
	// contains filtered or unexported fields
}

func NewClient

func NewClient(ctx context.Context, config ClientConfig) (*Client, error)

func (*Client) Close

func (c *Client) Close() error

type ClientConfig

type ClientConfig struct {
	AuthConfigs    map[string]registry.AuthConfig
	DockerHost     string
	MaxConcurrency int
	Timeout        time.Duration
	AcceptPrompts  bool
	DemuxLogs      bool
}

type ComposeEnvOptions

type ComposeEnvOptions struct {
	ConfigFiles   []string
	Profiles      []string
	ProjectName   string
	EnvFiles      []string
	RemoveOrphans bool
	IgnoreOrphans bool
	ParallelLimit int
}

func ParseComposeEnvOptions

func ParseComposeEnvOptions(ctx context.Context, workdir string, env EnvMap) (ComposeEnvOptions, error)

type ComposeFileWrite

type ComposeFileWrite struct {
	ProjectsRoot       string
	GlobalEnvDirectory string
	DirPath            string
	Content            string
	FileName           string
}

type ComposeProjectNameRewrite added in v3.1.0

type ComposeProjectNameRewrite struct {
	ProjectsDirectory string
	ProjectPath       string
	ComposeFile       string
	Name              string
}

ComposeProjectNameRewrite points a project's literal Compose name sources at Name.

type DeployImageDecision

type DeployImageDecision struct {
	StaleAfter              time.Duration
	Build                   bool
	PullAlways              bool
	PullIfMissing           bool
	PullIfStale             bool
	FallbackBuildOnPullFail bool
	RequireLocalOnly        bool
}

func DecideDeployImageAction

func DecideDeployImageAction(svc composeTypes.ServiceConfig, pullPolicyOverride string) DeployImageDecision

type DiscoverOptions

type DiscoverOptions struct {
	Root               string
	GlobalEnvDirectory string
	SkipDirectories    string
	MaxDepth           int
	FollowSymlinks     bool
}

type DiscoveredProjectDir

type DiscoveredProjectDir struct {
	DirName string
	Path    string
}

func DiscoverProjectDirectories

func DiscoverProjectDirectories(ctx context.Context, opts DiscoverOptions) ([]DiscoveredProjectDir, error)

type EnvLoader

type EnvLoader struct {
	// contains filtered or unexported fields
}

func NewEnvLoader

func NewEnvLoader(projectsDir, workdir string, autoInjectEnv bool) *EnvLoader

func (*EnvLoader) LoadEnvironment

func (l *EnvLoader) LoadEnvironment(ctx context.Context) (envMap, injectionVars EnvMap, err error)

type EnvMap

type EnvMap = map[string]string

func BuildValidationEnvironment

func BuildValidationEnvironment(ctx context.Context, projectsDirectory, projectPath string, effectiveEnvContent *string) (EnvMap, error)

func ParseProjectEnvContent

func ParseProjectEnvContent(content string, contextEnv EnvMap) (EnvMap, error)

func ParseProjectEnvFile

func ParseProjectEnvFile(ctx context.Context, path string, contextEnv EnvMap) (EnvMap, error)

func ParseValidationEnvFile

func ParseValidationEnvFile(ctx context.Context, path string, contextEnv EnvMap) (EnvMap, error)

type HostMount

type HostMount struct {
	Destination string // container-side mount path, e.g. "/app/data/projects/homeassistant"
	Source      string // host-side path, e.g. "/home/user/homeassistant"
}

func GetCurrentContainerMounts

func GetCurrentContainerMounts(ctx context.Context, dockerCli *client.Client) ([]HostMount, error)

type IconSet

type IconSet = iconcatalog.IconSet

func FindArcaneIconSet

func FindArcaneIconSet(labels any) IconSet

type ImagePullMode

type ImagePullMode int
const (
	ImagePullModeNever ImagePullMode = iota
	ImagePullModeIfMissing
	ImagePullModeRefresh
	ImagePullModeAlways
)

type ImagePullStep

type ImagePullStep struct {
	Mode         ImagePullMode
	RefreshAfter time.Duration
}

func ResolveServiceImagePullMode

func ResolveServiceImagePullMode(svc composeTypes.ServiceConfig) ImagePullStep

type IncludeFile

type IncludeFile struct {
	Path         string `json:"path"`
	RelativePath string `json:"relative_path"`
	Content      string `json:"content"`
}

func ParseIncludes

func ParseIncludes(ctx context.Context, composeFilePath string, envMap EnvMap, includeContent bool) ([]IncludeFile, error)

func ParseIncludesFromContent

func ParseIncludesFromContent(ctx context.Context, composeFilePath string, content []byte, envMap EnvMap, includeContent bool) ([]IncludeFile, error)

type LoadOptions

type LoadOptions struct {
	PathMapper        *PathMapper
	EnvOverride       EnvMap
	ConfigureLoader   func(*loader.Options)
	Dependencies      *types.ComposeDependencies
	Prepare           PrepareProjectFunc
	ComposeFile       string
	ProjectName       string
	ProjectsDirectory string
	Services          []string
	AutoInjectEnv     bool
	Lenient           bool
}

type MissingIncludeStubLoader

type MissingIncludeStubLoader struct {
	// contains filtered or unexported fields
}

func (*MissingIncludeStubLoader) Accept

func (l *MissingIncludeStubLoader) Accept(localPath string) bool

func (*MissingIncludeStubLoader) Cleanup

func (l *MissingIncludeStubLoader) Cleanup()

func (*MissingIncludeStubLoader) Dir

func (l *MissingIncludeStubLoader) Dir(localPath string) string

func (*MissingIncludeStubLoader) Load

func (l *MissingIncludeStubLoader) Load(ctx context.Context, filePath string) (string, error)

type PathMapper

type PathMapper struct {
	// contains filtered or unexported fields
}

func NewPathMapper

func NewPathMapper(containerDir, hostDir string) *PathMapper

func NewPathMapperForConfiguredDirectory

func NewPathMapperForConfiguredDirectory(ctx context.Context, configuredPath, defaultDir string, dockerClient *client.Client) *PathMapper

func NewPathMapperFromMounts

func NewPathMapperFromMounts(mounts []HostMount) *PathMapper

func (*PathMapper) ContainerToHost

func (pm *PathMapper) ContainerToHost(containerPath string) (string, bool, error)

func (*PathMapper) TranslateVolumeSources

func (pm *PathMapper) TranslateVolumeSources(project *composeTypes.Project, translateFileResources bool) error

type PrepareProjectFunc

type PrepareProjectFunc func(ctx context.Context, project *composeTypes.Project) error

type ProjectBundleVisitor added in v3.2.0

type ProjectBundleVisitor func(manifest types.ProjectManifest, name string, size int64, body io.Reader) error

type ProjectBundleWriter added in v3.2.0

type ProjectBundleWriter struct {
	// contains filtered or unexported fields
}

func NewProjectBundleWriter added in v3.2.0

func NewProjectBundleWriter(w io.Writer, manifest types.ProjectManifest) (*ProjectBundleWriter, error)

func (*ProjectBundleWriter) Add added in v3.2.0

func (w *ProjectBundleWriter) Add(name string, size int64, body io.Reader) error

func (*ProjectBundleWriter) Close added in v3.2.0

func (w *ProjectBundleWriter) Close() error

type ProjectEnvMode

type ProjectEnvMode string

type ProjectEnvState

type ProjectEnvState struct {
	Mode                ProjectEnvMode
	EditableFileName    string
	EditableContent     string
	EffectiveContent    string
	DirectContent       string
	GitContent          string
	OverrideContent     string
	HasEffective        bool
	HasGitSource        bool
	HasOverride         bool
	EffectiveUnreadable bool
	GitSourceUnreadable bool
	OverrideUnreadable  bool
}

func ReadProjectEnvState

func ReadProjectEnvState(ctx context.Context, projectPath string) (ProjectEnvState, error)

type ProjectUpdateBackup

type ProjectUpdateBackup struct {
	BackupDir     string
	FileEntries   []string
	DirEntries    []string
	AbsentEntries []string    // did not exist at backup time -> removed on restore
	RenamedDirs   [][2]string // undone via inverse rename on restore
	Skipped       []string    // unreadable, skipped; preserved on restore
	TopLevelFiles bool
	// contains filtered or unexported fields
}

func BackupProjectDirectory

func BackupProjectDirectory(ctx context.Context, projectsDirectory, projectPath, pattern string, scope ProjectUpdateBackupScope) (*ProjectUpdateBackup, func(), error)

func BackupProjectUpdateScope

func BackupProjectUpdateScope(ctx context.Context, projectDir, backupDir string, scope ProjectUpdateBackupScope) (*ProjectUpdateBackup, error)

type ProjectUpdateBackupScope

type ProjectUpdateBackupScope struct {
	Paths         []string
	RenamedDirs   [][2]string
	TopLevelFiles bool
}

func (ProjectUpdateBackupScope) IsEmpty

func (s ProjectUpdateBackupScope) IsEmpty() bool

type ResolveProjectVolumesOptions added in v3.2.0

type ResolveProjectVolumesOptions struct {
	Inspect     func(ctx context.Context, name string) (types.Volume, bool, error)
	InUse       map[string]bool
	BackupStore string
	Project     types.Project
}

type ScalarEdit added in v3.1.0

type ScalarEdit struct {
	Text       []byte
	Start, End int
}

ScalarEdit replaces the source span of one YAML scalar.

func NewScalarEdit added in v3.1.0

func NewScalarEdit(source []byte, node *yaml.Node, value string) (ScalarEdit, error)

NewScalarEdit locates node's single-line scalar text in source so it can be replaced without re-encoding, which would drop comments and formatting.

type SyncFile

type SyncFile struct {
	RelativePath string
	Content      []byte
	Executable   bool
}

type ValidateComposeRequest

type ValidateComposeRequest struct {
	ProjectsDirectory string
	ProjectPath       string
	ProjectName       string
	ComposeContent    string
	EnvContent        *string
	OverrideContent   *string
	OverrideFileName  string
	Lenient           bool
}

type VolumeMigrationPlanConfig added in v3.2.0

type VolumeMigrationPlanConfig struct {
	DockerClient   *client.Client
	UsageCache     *docker.VolumeUsageCache
	ComposeProject *composeTypes.Project
	OldComposeName string
	NewComposeName string
	ToolsImage     string
}

Jump to

Keyboard shortcuts

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