util

package
v2.7.20 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2022 License: LGPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DockerBasedir The base directory where all code is copied in the Docker image
	DockerBasedir = "/u01"
	// DockerfileApplicationFolder Where in the build folder the application is put
	DockerfileApplicationFolder = "app"
	// ApplicationFolder name
	ApplicationFolder = "application"
	// LayerFolder name
	LayerFolder = "layer"
	// ApplicationBuildFolder The directory where the application is prepared
	ApplicationBuildFolder = DockerfileApplicationFolder + "/" + ApplicationFolder
)

Variables

This section is empty.

Functions

func CalculateDigest

func CalculateDigest(data []byte) string

CalculateDigest returns sha256:<base64 digest> string of the provided byte slice.

func CalculateDigestFromArchive

func CalculateDigestFromArchive(path string) (string, error)

CalculateDigestFromArchive calculates a sha256 hash

func CalculateDigestFromFile

func CalculateDigestFromFile(path string) (string, error)

CalculateDigestFromFile of tar content

func CompressLayerTarGz

func CompressLayerTarGz(src string, folder string, destination string) (string, error)

CompressLayerTarGz compress folder

func Copy

func Copy(srcFile, dstFile string) error

Copy srcFile to dstFile

func CopyDirectory

func CopyDirectory(scrDir, dest string) error

CopyDirectory copy content from srcDir to dest

func Exists

func Exists(filePath string) bool

Exists check if file exists

func ExtractAndRenameDeliverable

func ExtractAndRenameDeliverable(dockerBuildFolder string, deliverablePath string) error

ExtractAndRenameDeliverable extract and rename

func ExtractBinaryFromFile

func ExtractBinaryFromFile(file string) (string, error)

ExtractBinaryFromFile copy binary from file

func ExtractBinaryFromStdIn

func ExtractBinaryFromStdIn() (string, error)

ExtractBinaryFromStdIn copy binary from stdin stream

func ExtractDeliverable

func ExtractDeliverable(archivePath string, extractedDirPath string) error

ExtractDeliverable extract archive to dest

func ExtractGz

func ExtractGz(gzipStream io.Reader) *gzip.Reader

ExtractGz stream

func FindOutputTagOrHash

func FindOutputTagOrHash(dockerName string) (string, error)

FindOutputTagOrHash get tag or hash from docker name

func GetVersionMetadata

func GetVersionMetadata(versionString string) string

GetVersionMetadata get version metadata

func GetVersionWithoutMetadata

func GetVersionWithoutMetadata(versionString string) string

GetVersionWithoutMetadata get version

func IsFullSemanticVersion

func IsFullSemanticVersion(versionString string) bool

IsFullSemanticVersion check version

func IsSemanticVersion

func IsSemanticVersion(versionString string) bool

IsSemanticVersion check version

func IsSemanticVersionWithMeta

func IsSemanticVersionWithMeta(versionString string) bool

IsSemanticVersionWithMeta check version

func MkdirAllWithPermissions added in v2.7.2

func MkdirAllWithPermissions(path string, perm fs.FileMode) error

MkdirAllWithPermissions works like os.MkdirAll, but will set permissions even if the folder already exists.

func RenameSingleFolderInDirectory

func RenameSingleFolderInDirectory(base string, newName string) error

RenameSingleFolderInDirectory When we unzip the delivery, it will have an additional level. eg. app/myapplication-LEVERANSEPAKKE-SNAPSHOT -> app/application This function is used to rename the folder to align it better with the container image file system.

Types

type FileWriter

type FileWriter func(WriterFunc, ...string) error

FileWriter function

func NewFileWriter

func NewFileWriter(targetFolder string) FileWriter

NewFileWriter wrapper

type WriterFunc

type WriterFunc func(io.Writer) error

WriterFunc function

func NewByteWriter

func NewByteWriter(data []byte) WriterFunc

NewByteWriter wrapper

func NewTemplateWriter

func NewTemplateWriter(input interface{}, templatename string, templateString string) WriterFunc

NewTemplateWriter wrapper

Jump to

Keyboard shortcuts

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