Documentation
¶
Index ¶
- Constants
- Variables
- func BlueprintFormatFromExtension(filePath string) (schema.SpecFormat, error)
- func ClearStaleUnixSocket(unixSocketPath string) error
- func DiagnosticsFromBlueprintValidationError(err error, logger core.Logger, fallbackToGeneralDiagnostic bool) []*core.Diagnostic
- func ExpandEnv(input string) string
- func HasAtLeastOneError(diagnostics []*core.Diagnostic) bool
- func NewUUIDv7Generator() core.IDGenerator
- func PrepareUnixSocketDir(unixSocketPath string) error
- func RestrictUnixSocket(unixSocketPath string) error
Constants ¶
const ( // UnexpectedErrorMessage is a generic error message for unexpected errors // that occur in the deploy engine. UnexpectedErrorMessage = "an unexpected error occurred" )
Variables ¶
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
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 ¶
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
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
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.