utils

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2026 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const ShellToUse = "sh"
View Source
const TarGzExtension = ".tar.gz"

Variables

This section is empty.

Functions

func ExtractFromArchive added in v0.10.0

func ExtractFromArchive(archiveFileName, matchPrefix, targetPath string, ignoreAbsPath bool, ignoreFileErrorList []string) error

ExtractFromArchive extracts entries from a .tar.gz archive whose names match matchPrefix into targetPath. Pass matchPrefix="" to extract everything.

When ignoreAbsPath is false, entries with absolute paths are rejected. When ignoreAbsPath is true, absolute entry paths are normalised — the leading separator is stripped and the entry is extracted relative to targetPath.

func FileExists

func FileExists(name string) bool

Reports whether a file exists.

func FindLagoonSyncOnEnv

func FindLagoonSyncOnEnv() (string, bool)

func GetServices added in v0.10.0

func GetServices(dockerComposeFilePath string) (map[string]Service, error)

GetServices attempts to generate a list of services from a docker-compose file

func HideSpinner added in v0.8.1

func HideSpinner()

func LoadDockerCompose added in v0.9.0

func LoadDockerCompose(path string) (map[string]Service, error)

func LogDebugInfo

func LogDebugInfo(message string, output interface{})

func LogError added in v0.8.0

func LogError(message string, output interface{})

func LogExecutionStep

func LogExecutionStep(message string, output interface{})

func LogFatalError

func LogFatalError(message string, output interface{})

func LogProcessStep

func LogProcessStep(message string, output interface{})

func LogWarning

func LogWarning(message string, output interface{})

func RemoteShellout added in v0.8.0

func RemoteShellout(command string, service string, remoteUser string, remoteHost string, remotePort string, privateKeyfile string, skipSshAgent bool) (error, string)

func SetColour added in v0.7.0

func SetColour(c bool)

func SetShowSpinner added in v0.8.1

func SetShowSpinner(spin bool)

func Shellout

func Shellout(command string) (error, string, string)

func ShowSpinner added in v0.8.1

func ShowSpinner()

func SliceContains added in v0.9.0

func SliceContains(slice []string, s string) bool

Types

type ApiConn added in v0.8.0

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

func (*ApiConn) GetProjectEnvironmentDeployTargets added in v0.8.0

func (r *ApiConn) GetProjectEnvironmentDeployTargets(projectName string) (*[]schema.Environment, error)

func (*ApiConn) GetServicesForEnvironment added in v0.10.0

func (r *ApiConn) GetServicesForEnvironment(projectName, environmentName string) ([]schema.EnvironmentService, error)

func (*ApiConn) Init added in v0.8.0

func (r *ApiConn) Init(graphqlEndpoint, sshkeyPath, sshHost, sshPort string) error

type Archive added in v0.10.0

type Archive struct {
	ArchiveFilename string        `yaml:"archivefilename"` // Used primarily internally for creating the archive.
	Items           []ArchiveItem `yaml:"items"`
	Version         string        `yaml:"version,omitempty"`
}

func ExtractManifest added in v0.10.0

func ExtractManifest(archiveFileName string) (*Archive, error)

func InitArchive added in v0.10.0

func InitArchive(filename, version string) (*Archive, error)

func (*Archive) AddItem added in v0.10.0

func (a *Archive) AddItem(syncher, fileName string, data map[string]string) error

func (*Archive) WriteArchive added in v0.10.0

func (a *Archive) WriteArchive() error

type ArchiveItem added in v0.10.0

type ArchiveItem struct {
	Syncher  string            `yaml:"syncher"`        // which syncher we need to use to pull/push the data
	Filename string            `yaml:"filename"`       // the resulting file
	Data     map[string]string `yaml:"data,omitempty"` // any data we need to pass to the syncer
}

type Build added in v0.9.0

type Build struct {
	Context    string `yaml:"context"`
	Dockerfile string `yaml:"dockerfile"`
}

Build represents the build configuration for a service

type DockerCompose added in v0.9.0

type DockerCompose struct {
	Services map[string]*Service `yaml:"services"`
}

DockerCompose represents the root structure of a docker-compose.yml file

type ExtractError added in v0.10.0

type ExtractError struct {
	EntryType byte
	Name      string
	Err       error
}

ExtractError is returned by ExtractFromArchive when an individual archive entry cannot be extracted. EntryType is the tar type flag (e.g. tar.TypeReg, tar.TypeDir) and Name is the resolved destination path.

func (*ExtractError) Error added in v0.10.0

func (e *ExtractError) Error() string

func (*ExtractError) Unwrap added in v0.10.0

func (e *ExtractError) Unwrap() error

type Service added in v0.9.0

type Service struct {
	Labels  map[string]string `yaml:"labels"`
	Name    string
	Type    string
	Volumes map[string]string
}

Service represents a single service definition in docker-compose.yml

func (*Service) UnmarshalYAML added in v0.9.0

func (s *Service) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML implements custom unmarshaling for Service to handle malformed YAML

Jump to

Keyboard shortcuts

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