utils

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2026 License: Apache-2.0 Imports: 19 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 (
	// UnexpectedErrorMessage is a generic error message for unexpected errors
	// that occur in the deploy engine.
	UnexpectedErrorMessage = "an unexpected error occurred"
)

Variables

View Source
var (
	// ErrUnsupportedBlueprintFormat is the error message for an unsupported blueprint format.
	ErrUnsupportedBlueprintFormat = errors.New("unsupported blueprint format")
)

Functions

func BlueprintFormatFromExtension

func BlueprintFormatFromExtension(filePath string) (schema.SpecFormat, error)

BlueprintFormatFromExtension determines the blueprint input format based on the file extension. An error is returned if the extension is not supported.

func ClearStaleUnixSocket added in v0.9.0

func ClearStaleUnixSocket(unixSocketPath string) error

ClearStaleUnixSocket removes a socket file left behind by a previous run, so that net.Listen does not fail with "address already in use".

A path that is not a socket is left alone and reported, rather than removed. A socket another process is still listening on is also left alone, so a second engine cannot hijack the path of a running one.

func DiagnosticsFromBlueprintValidationError

func DiagnosticsFromBlueprintValidationError(
	err error,
	logger core.Logger,
	fallbackToGeneralDiagnostic bool,
) []*core.Diagnostic

DiagnosticsFromBlueprintValidationError extracts diagnostics from a blueprint validation error.

func ExpandEnv

func ExpandEnv(input string) string

ExpandEnv expands the environment variables in the given string. This supports windows and unix style environment variable expansion.

func HasAtLeastOneError

func HasAtLeastOneError(diagnostics []*core.Diagnostic) bool

HasAtLeastOneError checks if there is at least one error in the provided diagnostics slice.

func NewUUIDv7Generator

func NewUUIDv7Generator() core.IDGenerator

NewUUIDv7Generator creates a new blueprint framework ID generator that uses UUIDv7. This is useful for generating IDs that can be sorted based on time of creation.

func PrepareUnixSocketDir added in v0.9.0

func PrepareUnixSocketDir(unixSocketPath string) error

PrepareUnixSocketDir creates the directory that will hold a unix socket, restricted to the owning user, and tightens an existing directory to the same.

The directory is the control over who can reach the socket, on both platforms. On unix its mode restricts traversal and the socket inherits nothing, so the socket is restricted separately. On Windows the socket file inherits the directory's ACL, and bind and connect are checked against it, so a restrictive directory is what restricts the socket too.

Go's os.Chmod cannot express an ACL, on Windows it only toggles the read-only attribute so the directory, not a mode on the socket, is the portable way to set this.

func RestrictUnixSocket added in v0.9.0

func RestrictUnixSocket(unixSocketPath string) error

RestrictUnixSocket restricts a unix socket to the owning user on unix, where net.Listen would otherwise create it with umask-dependent permissions.

Types

This section is empty.

Jump to

Keyboard shortcuts

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