Documentation
¶
Index ¶
- Constants
- Variables
- func ApplyLenientLoaderOptions(ctx context.Context, opts *loader.Options, composeFile string)
- func ApplyOverrideFileChange(ctx context.Context, projectsRoot, dir string, overrideContent *string) error
- func ApplyRenameVolumeMigration(ctx context.Context, operations types.ProjectRenameRecoveryOperations, ...) error
- func ApplyScalarEdits(source []byte, edits []ScalarEdit) []byte
- func BuildAdditiveOverrideEnvContent(gitContent, localContent string) (string, error)
- func BuildArgsFromCompose(args map[string]*string) map[string]string
- func BuildEffectiveEnvContent(gitContent, overrideContent string, lookup EnvMap) (string, error)
- func BuildImagePullPlan(project *composeTypes.Project) map[string]ImagePullStep
- func BuildImageRefsFromComposeProject(project *composeTypes.Project) []string
- func BuildLocalImageTag(projectID, projectName, serviceName string) string
- func BuildOverrideEnvContent(gitContent, effectiveContent string) (string, error)
- func BuildPlatformsFromCompose(svc composeTypes.ServiceConfig) []string
- func CheckProjectEnvAccess(ctx context.Context, projectsDir, dir string) *types.ProjectConfigurationError
- func ClassifyProjectVolumes(project types.Project) []types.ProjectVolume
- func CleanupRemovedFiles(ctx context.Context, projectsRoot, projectPath string, ...) error
- func CleanupRenameRollbackTargets(ctx context.Context, cleanup *types.ProjectRenameRollbackCleanup, ...) error
- func CloneComposeProject(project *composeTypes.Project) *composeTypes.Project
- func ComposeContentProjectName(composeContent string) string
- func ComposeCreate(ctx context.Context, opts types.ComposeCreateOptions) error
- func ComposeDown(ctx context.Context, opts types.ComposeDownOptions) error
- func ComposeEnvFileEntriesFromEnv(env EnvMap) []string
- func ComposeEnvRequiresDirectorySync(composePath, overrideFileName string, envContent *string) bool
- func ComposeFileEntriesFromEnv(env EnvMap) []string
- func ComposeFileEnvSelection(ctx context.Context, projectsDir, dir string) ([]string, error)
- func ComposeGenerate(ctx context.Context, dockerHost, projectName string, containerIDs []string) (string, error)
- func ComposeImageDigest(inspect client.ImageInspectResult) string
- func ComposeLogs(ctx context.Context, dockerHost, projectName string, out io.Writer, ...) error
- func ComposePs(ctx context.Context, opts types.ComposePsOptions) ([]api.ContainerSummary, error)
- func ComposeRestart(ctx context.Context, target types.ComposeTarget) error
- func ComposeRunJob(ctx context.Context, opts types.ComposeRunJobOptions) (int, error)
- func ComposeStart(ctx context.Context, target types.ComposeTarget) error
- func ComposeStop(ctx context.Context, target types.ComposeTarget) error
- func ComposeUp(ctx context.Context, opts types.ComposeUpOptions) error
- func ComposeVolumeConfig(volumeConfig composeTypes.VolumeConfig, key, newName, newComposeName string) composeTypes.VolumeConfig
- func ComposeVolumeCreateOptions(config composeTypes.VolumeConfig, oldLabels map[string]string) (client.VolumeCreateOptions, error)
- func ComposeVolumeTargetCreateOptions(name string, target types.ComposeVolumeTarget) (client.VolumeCreateOptions, error)
- func ContainerServices(containers []container.Summary) []string
- func CreateExactDir(ctx context.Context, projectsRoot, basePath, name string, perm os.FileMode) (path, folderName string, err error)
- func CreateNewVolume(ctx context.Context, dockerClient *client.Client, ...) error
- func CreateUniqueDir(ctx context.Context, projectsRoot, basePath, name string, perm os.FileMode, ...) (path, folderName string, reused bool, err error)
- func DefaultSwarmStackEnvTemplate() string
- func DefaultSwarmStackTemplate() string
- func DetectComposeFile(ctx context.Context, projectsDir, dir string) (string, error)
- func DetectComposeOverrideFile(ctx context.Context, dir string) string
- func DirectorySyncContentsChanged(ctx context.Context, projectPath string, syncFiles []SyncFile, ...) (bool, error)
- func EnsureDefaultTemplates(ctx context.Context, configuredTemplatesDir string) error
- func EnsureServiceImage(projectID, projectName, serviceName string, svc composeTypes.ServiceConfig) (string, composeTypes.ServiceConfig, bool)
- func EnsureTemplateDir(ctx context.Context, templatesDir, base string) (dir, composePath, envPath string, err error)
- func EnvContentChanged(oldContent, newContent string) bool
- func ExistingOrDefaultOverrideName(ctx context.Context, dir string) string
- func FinalizeRenameAfterCommit(ctx context.Context, operations types.ProjectRenameRecoveryOperations, ...)
- func FindComposeReplica(containers []container.Summary, labels map[string]string) (container.Summary, bool)
- func FindComposeServiceContainerID(ctx context.Context, dockerHost, projectName, serviceName string) (string, error)
- func FormatDockerPorts(ports []container.PortSummary) []string
- func FormatPorts(publishers []api.PortPublisher) []string
- func FreeSpaceBudget(ctx context.Context, dir string) (budget, reserve int64, err error)
- func GetHostPathForContainerPath(ctx context.Context, dockerCli *client.Client, containerPath string) (string, error)
- func GetProjectsDirectory(ctx context.Context, projectsDir string) (string, error)
- func GetTemplatesDirectory(ctx context.Context, templatesDir string) (string, error)
- func HasComposeRootKeysInFile(ctx context.Context, path string) (bool, error)
- func ImageRefsFrom[T any](services []T, imageRef func(T) string) []string
- func ImageRefsFromComposeServices(services composeTypes.Services) []string
- func IsFilesystemSnapshotDirName(name string) bool
- func IsGitOpsScratchDirName(name string) bool
- func IsIgnoredProjectDirName(name string) bool
- func IsInternalScratchDirName(name string) bool
- func IsProjectDirectoryEntry(ctx context.Context, entry types.Entry, followSymlinks bool) bool
- func IsProjectDirectoryPath(ctx context.Context, path string, followSymlinks bool) (bool, error)
- func IsProjectFile(filename string) bool
- func IsSafeSubdirectory(baseDir, subdir string) bool
- func IsWindowsDrivePath(candidate string) bool
- func LabelsFromCompose(labels composeTypes.Labels) map[string]string
- func ListGlobalComposeContainers(ctx context.Context, dockerClient client.APIClient, dockerHost string) ([]container.Summary, error)
- func LoadCachedComposeProject(ctx context.Context, projectCache types.ComposeCache[*composeTypes.Project], ...) (*composeTypes.Project, error)
- func LoadComposeProject(ctx context.Context, opts LoadOptions) (project *composeTypes.Project, err error)
- func LoadComposeProjectFromContent(ctx context.Context, opts types.ComposeContentOptions) (project *composeTypes.Project, err error)
- func MarshalImageRefsJSON(refs []string) string
- func MaterializeJob(project *composeTypes.Project, name string) (*composeTypes.Project, error)
- func NamespaceDependents(model *composeTypes.Project, services []string) []string
- func NewComposeCache[T any](capacity int, clone func(T) T) types.ComposeCache[T]
- func NewComposeVolumeTarget(composeName string, volume types.ProjectVolume, ...) types.ComposeVolumeTarget
- func NewCoordinator(commands types.ComposeCommands) types.ComposeCoordinator
- func NormalizeBuildSelections(services []string) map[string]struct{}
- func NormalizeDeployPullPolicy(policy string) string
- func NormalizeProjectName(name string) string
- func NormalizeProjectTag(name string) (string, error)
- func NormalizeProjectTagColor(color types.ProjectTagColor) (types.ProjectTagColor, error)
- func NormalizeProjectTags(names []string) ([]string, error)
- func NormalizePullPolicy(policy string) string
- func OwnLinks(ctx context.Context, projectPath string, sourceDirs []string, ...) error
- func PackProjectDirectory(ctx context.Context, projectPath string, w io.Writer) error
- func ParseComposeServices(ctx context.Context, composeContent string) []string
- func ParseEnvContent(content string) []types.EnvVariable
- func ParseImageRefsJSON(raw string) []string
- func ParseNoInjectDirectives(content string) map[string]bool
- func PathHasSegment(relPath string, match func(string) bool) bool
- func PlanVolumeMigration(ctx context.Context, cfg VolumeMigrationPlanConfig) (types.VolumeMigration, error)
- func PrepareDeployServiceConfig(projectID, projectName, serviceName string, svc composeTypes.ServiceConfig) (composeTypes.ServiceConfig, string, bool)
- func PrepareServiceBuildRequest(projectID string, project *composeTypes.Project, serviceName string, ...) (buildtypes.BuildRequest, composeTypes.ServiceConfig, bool, error)
- func ProjectBundleVolumeArchive(key string) string
- func ProjectContainerUse(composeName string, containers []container.Summary) ([]container.Summary, map[string]bool)
- func ProjectJobs(project *composeTypes.Project) []types.ProjectJob
- func ProtectedProjectFilePaths(composeFileName string) map[string]bool
- func PullableImageRefs(project *composeTypes.Project) []string
- func ReadComposeOverrideContent(ctx context.Context, dir string) string
- func ReadExternalEnvFile(ctx context.Context, projectPath string) (content []byte, perm os.FileMode, external bool, err error)
- func ReadFolderComposeTemplate(ctx context.Context, baseDir, folder string) (string, *string, string, bool, error)
- func ReadProjectBundle(r io.Reader, visit ProjectBundleVisitor) (types.ProjectManifest, bool, error)
- func ReadProjectBundleManifest(r io.Reader) (types.ProjectManifest, bool)
- func ReadProjectFiles(ctx context.Context, projectPath, composePath string) (composeContent, envContent string, err error)
- func RecoverRenameJournal(ctx context.Context, journal *types.ProjectRenameJournal, ...) error
- func RefreshComposeImageLabel(labels map[string]string, imageDigest string)
- func RemapEscapedRelativeSources(ctx context.Context, pathMapper types.VolumeSourcePathMapper, ...)
- func RemoveProjectFile(ctx context.Context, projectsRoot, dirPath, fileName string) error
- func RemoveStaleComposeFiles(ctx context.Context, projectPath, composeFileName string, syncedFiles []string) error
- func RenameJournalFilesystemSyncPending(phase string) bool
- func ResolveBuildContext(workingDir string, svc composeTypes.ServiceConfig, serviceName string) (string, error)
- func ResolveComposeOverride(exists func(name string) bool, read func(name string) (string, error)) (fileName, content string, found bool, err error)
- func ResolveConfiguredContainerDirectory(ctx context.Context, configuredPath, defaultPath string) string
- func ResolveDirectoryIdentity(path string) (string, error)
- func ResolveEffectiveOverrideForValidation(ctx context.Context, dir string, overrideContent *string) (*string, string)
- func ResolveHostPath(mounts []HostMount, containerPath string) mo.Option[string]
- func ResolvePathWithinDir(baseDir, path string) (string, error)
- func ResolveProjectVolumes(ctx context.Context, opts ResolveProjectVolumesOptions) ([]types.ProjectVolume, map[string]types.Volume, error)
- func ResolveRelativeProjectPaths(project *composeTypes.Project, workdir string)
- func ResolveRemoveOrphans(gitOpsManaged bool, options *types.ProjectDeployOptions) bool
- func ResolveTemplateIconURL(ctx context.Context, composeContent, envContent string) *string
- func RestoreProjectDirectoryBackup(ctx context.Context, projectsDirectory, projectPath string, ...) error
- func RestoreProjectUpdateBackup(ctx context.Context, projectDir string, backup *ProjectUpdateBackup) error
- func RewriteComposeProjectName(ctx context.Context, rewrite ComposeProjectNameRewrite) error
- func RollbackRenamedProjectDirectory(ctx context.Context, oldPath, newPath string) (pathsMissing bool, err error)
- func SanitizeImageComponent(value string) string
- func SanitizeProjectName(name string) string
- func SelectBackupVolumes(included, requested []string) ([]string, error)
- func SelectServices(model *composeTypes.Project, services []string, ...) (*composeTypes.Project, error)
- func SelectedImageRefs(compProj *composeTypes.Project, servicesToUpdate []string) []string
- func ServiceSelected(selected map[string]struct{}, name string) bool
- func SetComposeProjectName(source []byte, name string) ([]byte, error)
- func ShouldPullDeployImage(decision DeployImageDecision, exists bool, lastTagged time.Time) bool
- func Slugify(in string) string
- func StaleComposeFiles(ctx context.Context, projectPath, composeFileName string, syncedFiles []string) ([]string, error)
- func UlimitsFromCompose(ulimits map[string]*composeTypes.UlimitsConfig) map[string]string
- func UnpackProjectDirectory(ctx context.Context, root string, r io.Reader) error
- func ValidateComposeContentForUpdate(ctx context.Context, req ValidateComposeRequest) (err error)
- func ValidateIncludePathForWrite(projectDir, includePath string) (string, error)
- func WithTransientValidationEnvFile(ctx context.Context, projectPath string, effectiveEnvContent *string, ...) (err error)
- func WriteComposeFile(ctx context.Context, write ComposeFileWrite) error
- func WriteComposeOverrideFile(ctx context.Context, projectsRoot, dir string, content *string, ...) error
- func WriteFileWithPerm(ctx context.Context, filePath, content string, perm os.FileMode) error
- func WriteManagedEnvFile(ctx context.Context, projectsDirectory, projectPath, fileName string, ...) error
- func WriteProjectFile(ctx context.Context, projectsRoot, dirPath, fileName, content string) error
- func WriteProjectFiles(ctx context.Context, write ComposeFileWrite, envContent *string) error
- func WriteSyncedDirectory(ctx context.Context, projectsRoot, projectPath string, files []SyncFile) ([]string, error)
- func WriteTemplateFile(ctx context.Context, filePath, content string) error
- func WriteTemplateFiles(ctx context.Context, composePath, envPath, composeContent, envContent string) (*string, error)
- type ArcaneComposeMetadata
- type Client
- type ClientConfig
- type ComposeEnvOptions
- type ComposeFileWrite
- type ComposeProjectNameRewrite
- type DeployImageDecision
- type DiscoverOptions
- type DiscoveredProjectDir
- type EnvLoader
- type EnvMap
- func BuildValidationEnvironment(ctx context.Context, projectsDirectory, projectPath string, ...) (EnvMap, error)
- func ParseProjectEnvContent(content string, contextEnv EnvMap) (EnvMap, error)
- func ParseProjectEnvFile(ctx context.Context, path string, contextEnv EnvMap) (EnvMap, error)
- func ParseValidationEnvFile(ctx context.Context, path string, contextEnv EnvMap) (EnvMap, error)
- type HostMount
- type IconSet
- type ImagePullMode
- type ImagePullStep
- type IncludeFile
- type LoadOptions
- type MissingIncludeStubLoader
- type PathMapper
- type PrepareProjectFunc
- type ProjectBundleVisitor
- type ProjectBundleWriter
- type ProjectEnvMode
- type ProjectEnvState
- type ProjectUpdateBackup
- type ProjectUpdateBackupScope
- type ResolveProjectVolumesOptions
- type ScalarEdit
- type SyncFile
- type ValidateComposeRequest
- type VolumeMigrationPlanConfig
Constants ¶
const ( ProjectBundleManifest = "arcane-project.json" ProjectBundleProject = "project.tar.gz" )
const ( ArcaneIconLabel = "com.getarcaneapp.arcane.icon" ArcaneIconLightLabel = "com.getarcaneapp.arcane.icon-light" ArcaneIconDarkLabel = "com.getarcaneapp.arcane.icon-dark" ProjectTagMaxLength = 64 ProjectTagsPerSourceLimit = 50 )
const ( ArcaneTrashPrefix = ".arcane-trash-" RestoreScratchPrefix = ".project-restore-" )
const ( GlobalEnvFileName = ".env.global" EffectiveEnvFileName = ".env" GitSourceEnvFileName = ".env.git" OverrideEnvFileName = "project.env" ProjectEnvModeDirect ProjectEnvMode = "direct" ProjectEnvModeOverride ProjectEnvMode = "override" GlobalEnvNoInjectDirective = "arcane:noinject" )
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" )
const (
JobRunLabel = "com.docker.job.id"
)
Variables ¶
var ( ComposeFileCandidates = []string{ DefaultComposeFileName, "compose.yml", "docker-compose.yaml", "docker-compose.yml", "podman-compose.yaml", "podman-compose.yml", } ComposeOverrideFileCandidates = slices.Clone(cli.DefaultOverrideFileNames) )
var ErrProjectDirExists = errors.New("project directory already exists")
var ProjectFileCandidates = append( append(slices.Clone(ComposeFileCandidates), ComposeOverrideFileCandidates...), ".env", )
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 ApplyOverrideFileChange ¶
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 BuildImagePullPlan ¶
func BuildImagePullPlan(project *composeTypes.Project) map[string]ImagePullStep
func BuildImageRefsFromComposeProject ¶
func BuildImageRefsFromComposeProject(project *composeTypes.Project) []string
func BuildLocalImageTag ¶
func BuildOverrideEnvContent ¶
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 CleanupRenameRollbackTargets ¶
func CleanupRenameRollbackTargets(ctx context.Context, cleanup *types.ProjectRenameRollbackCleanup, operations types.ProjectRenameRecoveryOperations) error
func CloneComposeProject ¶
func CloneComposeProject(project *composeTypes.Project) *composeTypes.Project
func ComposeCreate ¶
func ComposeCreate(ctx context.Context, opts types.ComposeCreateOptions) error
func ComposeDown ¶
func ComposeDown(ctx context.Context, opts types.ComposeDownOptions) error
func ComposeFileEnvSelection ¶
func ComposeGenerate ¶
func ComposeImageDigest ¶
func ComposeImageDigest(inspect client.ImageInspectResult) string
func ComposeLogs ¶
func ComposePs ¶
func ComposePs(ctx context.Context, opts types.ComposePsOptions) ([]api.ContainerSummary, error)
func ComposeRestart ¶
func ComposeRestart(ctx context.Context, target types.ComposeTarget) error
func ComposeRunJob ¶ added in v3.1.1
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 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
ContainerServices returns the Compose service names of the service containers, de-duplicated in first-seen order.
func CreateExactDir ¶
func CreateNewVolume ¶ added in v3.2.0
func CreateUniqueDir ¶
func DefaultSwarmStackEnvTemplate ¶
func DefaultSwarmStackEnvTemplate() string
func DefaultSwarmStackTemplate ¶
func DefaultSwarmStackTemplate() string
func DetectComposeFile ¶
func EnsureDefaultTemplates ¶
func EnsureServiceImage ¶
func EnsureServiceImage(projectID, projectName, serviceName string, svc composeTypes.ServiceConfig) (string, composeTypes.ServiceConfig, bool)
func EnsureTemplateDir ¶
func EnvContentChanged ¶
func FinalizeRenameAfterCommit ¶
func FinalizeRenameAfterCommit(ctx context.Context, operations types.ProjectRenameRecoveryOperations, projectID string, volumeMigration types.VolumeMigration, renameJournal *types.ProjectRenameJournal, journalActive *bool, )
func FindComposeReplica ¶
func FormatDockerPorts ¶
func FormatDockerPorts(ports []container.PortSummary) []string
func FormatPorts ¶
func FormatPorts(publishers []api.PortPublisher) []string
func FreeSpaceBudget ¶ added in v3.2.0
func GetProjectsDirectory ¶
func GetTemplatesDirectory ¶
func ImageRefsFrom ¶ added in v3.2.0
func ImageRefsFromComposeServices ¶
func ImageRefsFromComposeServices(services composeTypes.Services) []string
func IsGitOpsScratchDirName ¶
func IsIgnoredProjectDirName ¶
func IsProjectDirectoryEntry ¶
func IsProjectDirectoryPath ¶
func IsProjectFile ¶
func IsSafeSubdirectory ¶
func IsWindowsDrivePath ¶
func LabelsFromCompose ¶
func LabelsFromCompose(labels composeTypes.Labels) map[string]string
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 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 NormalizeProjectName ¶
func NormalizeProjectTag ¶
func NormalizeProjectTagColor ¶
func NormalizeProjectTagColor(color types.ProjectTagColor) (types.ProjectTagColor, error)
func NormalizeProjectTags ¶
func NormalizePullPolicy ¶
func PackProjectDirectory ¶ added in v3.1.0
func ParseComposeServices ¶
func ParseEnvContent ¶
func ParseEnvContent(content string) []types.EnvVariable
func ParseImageRefsJSON ¶
func ParseNoInjectDirectives ¶
func PlanVolumeMigration ¶
func PlanVolumeMigration(ctx context.Context, cfg VolumeMigrationPlanConfig) (types.VolumeMigration, error)
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 ProjectContainerUse ¶ added in v3.2.0
func ProjectJobs ¶ added in v3.1.1
func ProjectJobs(project *composeTypes.Project) []types.ProjectJob
func PullableImageRefs ¶
func PullableImageRefs(project *composeTypes.Project) []string
func ReadExternalEnvFile ¶ added in v3.2.0
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 RecoverRenameJournal ¶
func RecoverRenameJournal(ctx context.Context, journal *types.ProjectRenameJournal, projectCommitted bool, operations types.ProjectRenameRecoveryOperations) error
func RemapEscapedRelativeSources ¶
func RemapEscapedRelativeSources( ctx context.Context, pathMapper types.VolumeSourcePathMapper, project *composeTypes.Project, containerWorkingDir string, rawSources map[string]string, includeFileResources bool, )
func RemoveProjectFile ¶
func RemoveStaleComposeFiles ¶
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 ResolveDirectoryIdentity ¶
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 ResolveHostPath ¶
func ResolvePathWithinDir ¶
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 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 SanitizeImageComponent ¶
func SanitizeProjectName ¶
func SelectBackupVolumes ¶ added in v3.2.0
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 SetComposeProjectName ¶ added in v3.1.0
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 StaleComposeFiles ¶
func UlimitsFromCompose ¶
func UlimitsFromCompose(ulimits map[string]*composeTypes.UlimitsConfig) map[string]string
func UnpackProjectDirectory ¶ added in v3.1.0
func ValidateComposeContentForUpdate ¶
func ValidateComposeContentForUpdate(ctx context.Context, req ValidateComposeRequest) (err error)
Missing includes are tolerated here; deployment uses strict executable loading.
func WriteComposeFile ¶
func WriteComposeFile(ctx context.Context, write ComposeFileWrite) error
func WriteFileWithPerm ¶
func WriteManagedEnvFile ¶
func WriteProjectFile ¶
func WriteProjectFiles ¶
func WriteProjectFiles(ctx context.Context, write ComposeFileWrite, envContent *string) error
func WriteSyncedDirectory ¶
func WriteTemplateFile ¶
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 ClientConfig ¶
type ComposeEnvOptions ¶
type ComposeEnvOptions struct {
ConfigFiles []string
Profiles []string
ProjectName string
EnvFiles []string
RemoveOrphans bool
IgnoreOrphans bool
ParallelLimit int
}
func ParseComposeEnvOptions ¶
type ComposeFileWrite ¶
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 DiscoveredProjectDir ¶
func DiscoverProjectDirectories ¶
func DiscoverProjectDirectories(ctx context.Context, opts DiscoverOptions) ([]DiscoveredProjectDir, error)
type EnvLoader ¶
type EnvLoader struct {
// contains filtered or unexported fields
}
func NewEnvLoader ¶
type EnvMap ¶
func ParseProjectEnvContent ¶
func ParseProjectEnvFile ¶
type HostMount ¶
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 ¶
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
type PathMapper ¶
type PathMapper struct {
// contains filtered or unexported fields
}
func NewPathMapper ¶
func NewPathMapper(containerDir, hostDir string) *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 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) 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 ¶
func (ProjectUpdateBackupScope) IsEmpty ¶
func (s ProjectUpdateBackupScope) IsEmpty() bool
type ResolveProjectVolumesOptions ¶ added in v3.2.0
type ScalarEdit ¶ added in v3.1.0
ScalarEdit replaces the source span of one YAML scalar.
func NewScalarEdit ¶ added in v3.1.0
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 ValidateComposeRequest ¶
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
}