build

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2025 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetDefaultTagFormat

func GetDefaultTagFormat() string

GetDefaultTagFormat returns the default tag format

func SanitizeServiceName

func SanitizeServiceName(serviceName string) string

SanitizeServiceName sanitizes a service name for use in tags

func SanitizeStackName

func SanitizeStackName(stackName string) string

SanitizeStackName sanitizes a stack name for use in tags

Types

type BuildLogger

type BuildLogger interface {
	LogService(serviceName, message string)
	LogInfo(message string)
	LogWarn(message string)
	LogError(message string)
}

BuildLogger interface for logging build output

type BuildOrchestrator

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

BuildOrchestrator coordinates the build process for multiple services

func NewBuildOrchestrator

func NewBuildOrchestrator(client *portainer.Client, buildConfig *config.BuildConfig, envID int, stackName string, logger BuildLogger) *BuildOrchestrator

NewBuildOrchestrator creates a new build orchestrator

func (*BuildOrchestrator) BuildServices

func (bo *BuildOrchestrator) BuildServices(servicesWithBuild []compose.ServiceBuildInfo) (map[string]string, error)

BuildServices builds all services with build directives

type BuildResult

type BuildResult struct {
	ServiceName string
	ImageTag    string
	Success     bool
	Error       error
}

BuildResult represents the result of building a service

type ContentHasher

type ContentHasher struct{}

ContentHasher handles generation of content hashes for build contexts

func NewContentHasher

func NewContentHasher() *ContentHasher

NewContentHasher creates a new content hasher

func (*ContentHasher) HashBuildContext

func (ch *ContentHasher) HashBuildContext(contextPath string, dockerfilePath string, buildArgs map[string]string) (string, error)

HashBuildContext generates a content hash for a build context

func (*ContentHasher) HashFileContents

func (ch *ContentHasher) HashFileContents(contextPath string) (string, error)

HashFileContents generates a hash of file contents in a directory This is a placeholder for the full implementation that would: 1. Walk the directory tree 2. Apply .dockerignore patterns 3. Hash file contents and metadata 4. Return a deterministic hash

type ContextTarStreamer

type ContextTarStreamer struct {
	WarnThresholdMB int
}

ContextTarStreamer handles creating tar streams of build contexts

func NewContextTarStreamer

func NewContextTarStreamer(warnThresholdMB int) *ContextTarStreamer

NewContextTarStreamer creates a new context tar streamer

func (*ContextTarStreamer) CreateTarStream

func (cts *ContextTarStreamer) CreateTarStream(contextPath string) (io.ReadCloser, error)

CreateTarStream creates a tar stream of the build context

func (*ContextTarStreamer) GetContextSize

func (cts *ContextTarStreamer) GetContextSize(contextPath string) (int64, error)

GetContextSize estimates the size of the build context

func (*ContextTarStreamer) ValidateContext

func (cts *ContextTarStreamer) ValidateContext(contextPath string) error

ValidateContext validates that a build context is valid

type SimpleBuildLogger

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

SimpleBuildLogger is a simple implementation of BuildLogger

func NewSimpleBuildLogger

func NewSimpleBuildLogger(prefix string) *SimpleBuildLogger

NewSimpleBuildLogger creates a new simple build logger

func (*SimpleBuildLogger) LogError

func (sbl *SimpleBuildLogger) LogError(message string)

LogError logs an error message

func (*SimpleBuildLogger) LogInfo

func (sbl *SimpleBuildLogger) LogInfo(message string)

LogInfo logs an info message

func (*SimpleBuildLogger) LogService

func (sbl *SimpleBuildLogger) LogService(serviceName, message string)

LogService logs a service-specific message

func (*SimpleBuildLogger) LogWarn

func (sbl *SimpleBuildLogger) LogWarn(message string)

LogWarn logs a warning message

type StyledBuildLogger

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

StyledBuildLogger is a modern, styled logger for build output. It implements BuildLogger and cleans Docker JSON lines into readable text.

func NewStyledBuildLogger

func NewStyledBuildLogger(prefix string) *StyledBuildLogger

NewStyledBuildLogger returns a logger with consistent, modern styles.

func (*StyledBuildLogger) LogError

func (l *StyledBuildLogger) LogError(message string)

LogError logs an error message

func (*StyledBuildLogger) LogInfo

func (l *StyledBuildLogger) LogInfo(message string)

LogInfo logs an info message

func (*StyledBuildLogger) LogService

func (l *StyledBuildLogger) LogService(serviceName, message string)

LogService logs a service-specific message

func (*StyledBuildLogger) LogWarn

func (l *StyledBuildLogger) LogWarn(message string)

LogWarn logs a warning message

type TagGenerator

type TagGenerator struct {
	StackName string
	TagFormat string
}

TagGenerator handles generation of deterministic image tags

func NewTagGenerator

func NewTagGenerator(stackName, tagFormat string) *TagGenerator

NewTagGenerator creates a new tag generator

func (*TagGenerator) GenerateTag

func (tg *TagGenerator) GenerateTag(serviceName, contentHash string) string

GenerateTag generates a tag for a service using the configured format

func (*TagGenerator) GenerateTagWithTimestamp

func (tg *TagGenerator) GenerateTagWithTimestamp(serviceName string) string

GenerateTagWithTimestamp generates a tag with timestamp (for force builds)

type TagTemplateValidator

type TagTemplateValidator struct{}

TagTemplateValidator validates tag format templates

func NewTagTemplateValidator

func NewTagTemplateValidator() *TagTemplateValidator

NewTagTemplateValidator creates a new tag template validator

func (*TagTemplateValidator) ValidateTagFormat

func (ttv *TagTemplateValidator) ValidateTagFormat(tagFormat string) error

ValidateTagFormat validates a tag format template

type TagValidator

type TagValidator struct{}

TagValidator validates image tag formats

func NewTagValidator

func NewTagValidator() *TagValidator

NewTagValidator creates a new tag validator

func (*TagValidator) ValidateTag

func (tv *TagValidator) ValidateTag(tag string) error

ValidateTag validates that a tag follows Docker naming conventions

Jump to

Keyboard shortcuts

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