Documentation ¶
Index ¶
- Constants
- Variables
- func BuildVersion() string
- func DataSizeToUint64(size string) (uint64, error)
- func ExecError(err error) error
- func IsBuildHostFIPSEnabled() (enabled bool)
- func IsStringInSortedSlice(slice []string, s string) bool
- func MountUnitNameFor(mountpoint string) (string, error)
- func NopSeekCloser(r io.ReadSeeker) io.ReadSeekCloser
- func PanicOnError(err error)
- func ToPtr[T any](x T) *T
- func VersionGreaterThanOrEqual(a, b string) bool
- func VersionLessThan(a, b string) bool
- type CustomJsonConversionError
- type CustomTypeError
- type ImageBuildState
Constants ¶
const ( KiloByte = 1000 // kB KibiByte = 1024 // KiB MegaByte = 1000 * 1000 // MB MebiByte = 1024 * 1024 // MiB GigaByte = 1000 * 1000 * 1000 // GB GibiByte = 1024 * 1024 * 1024 // GiB TeraByte = 1000 * 1000 * 1000 * 1000 // TB TebiByte = 1024 * 1024 * 1024 * 1024 // TiB // shorthands KiB = KibiByte MB = MegaByte MiB = MebiByte GB = GigaByte GiB = GibiByte TiB = TebiByte )
const (
FIPSEnabledImageWarning = `The host building this image is not ` +
`running in FIPS mode. The image will still be FIPS compliant. ` +
`If you have custom steps that generate keys or perform ` +
`cryptographic operations, those must be considered non-compliant.`
)
Variables ¶
var ( // Git revision from which this code was built GitRev = "undefined" // RPM Version RpmVersion = "undefined" )
These constants are set during buildtime using additional compiler flags. Not all of them are necessarily defined because RPMs can be build from a tarball and spec file without being in a git repository. On the other hand when building composer inside of a container, there is no RPM layer so in that case the RPM version doesn't exist at all.
var (
FIPSEnabledFilePath = "/proc/sys/crypto/fips_enabled"
)
Functions ¶
func BuildVersion ¶
func BuildVersion() string
func DataSizeToUint64 ¶
DataSizeToUint64 converts a size specified as a string in KB/KiB/MB/etc. to a number of bytes represented by uint64.
func ExecError ¶ added in v0.65.0
ExecError handles the error from an exec.Command().Output() call. It returns a formatted error that includes StdErr when the error is of type exec.ExitError.
func IsBuildHostFIPSEnabled ¶ added in v0.32.0
func IsBuildHostFIPSEnabled() (enabled bool)
func IsStringInSortedSlice ¶
IsStringInSortedSlice returns true if the string is present, false if not slice must be sorted
func MountUnitNameFor ¶ added in v0.65.0
MountUnitNameFor returns the escaped name of the mount unit for a given mountpoint by calling:
systemd-escape --path --suffix=mount "mountpoint"
func NopSeekCloser ¶
func NopSeekCloser(r io.ReadSeeker) io.ReadSeekCloser
NopSeekCloser returns an io.ReadSeekCloser with a no-op Close method wrapping the provided io.ReadSeeker r.
func PanicOnError ¶
func PanicOnError(err error)
func VersionGreaterThanOrEqual ¶ added in v0.41.0
func VersionLessThan ¶
Returns true if the version represented by the first argument is semantically older than the second.
Meant to be used for comparing distro versions for differences between minor releases.
Provided version strings are of any characters which are not digits or periods, and then split on periods. Assumes any missing components are 0, so 8 < 8.1. Evaluates to false if a and b are equal.
Types ¶
type CustomJsonConversionError ¶
type CustomJsonConversionError struct {
// contains filtered or unexported fields
}
CustomJsonConversionError is thrown when parsing strings into enumerations
func (*CustomJsonConversionError) Error ¶
func (err *CustomJsonConversionError) Error() string
Error returns the error as a string
type CustomTypeError ¶
type CustomTypeError struct {
// contains filtered or unexported fields
}
CustomTypeError is thrown when parsing strings into enumerations
func (*CustomTypeError) Error ¶
func (err *CustomTypeError) Error() string
Error returns the error as a string
type ImageBuildState ¶
type ImageBuildState int
const ( IBWaiting ImageBuildState = iota IBRunning IBFinished IBFailed )
func (ImageBuildState) MarshalJSON ¶
func (ibs ImageBuildState) MarshalJSON() ([]byte, error)
func (ImageBuildState) ToString ¶
func (ibs ImageBuildState) ToString() string
ToString converts ImageBuildState into a human readable string
func (*ImageBuildState) UnmarshalJSON ¶
func (ibs *ImageBuildState) UnmarshalJSON(data []byte) error
UnmarshalJSON converts a JSON string into an ImageBuildState