Documentation ¶
Index ¶
- func BuildContainer(dockerFile, tagName string) error
- func ComputeShaOCITar(filename string) (string, error)
- func CopyFile(src string, dst string) (err error)
- func CopyFileNotExists(src string, dst string) (err error)
- func CreateAndRunContainer(containerName string, imageName string, portMap map[string]string, ...) error
- func CreateDockerNetwork(name string) error
- func CreateTarGz(dstFile string, paths []FileToSave) error
- func CurrentDirConfigPath() (string, error)
- func DefaultConfigPath() (string, error)
- func DefaultEdenDir() (string, error)
- func DelEleInSlice(arr interface{}, index int)
- func DockerImageRepack(commandPath string, distImage string, imageTag string) (err error)
- func DownloadEveLive(eve EVEDescription, uefi UEFIDescription, outputFile string) (err error)
- func DownloadEveRootFS(eve EVEDescription, outputDir string) (filePath string, err error)
- func DownloadFile(filepath string, url string) error
- func ExtractFilesFromDocker(u io.ReadCloser, directory string, prefixDirectory string) error
- func FileNameWithoutExtension(fileName string) string
- func FindEleInSlice(slice []string, val string) (int, bool)
- func GenCARoot() (*x509.Certificate, *rsa.PrivateKey)
- func GenServerCert(cert *x509.Certificate, key *rsa.PrivateKey, serial *big.Int, ip []net.IP, ...) (*x509.Certificate, *rsa.PrivateKey)
- func GenServerCertElliptic(cert *x509.Certificate, key *rsa.PrivateKey, serial *big.Int, ip []net.IP, ...) (*x509.Certificate, *ecdsa.PrivateKey)
- func GenerateConfigFile(filePath string) error
- func GenerateConfigFileDiff(filePath string, context *Context) error
- func GenerateConfigFileFromViper() error
- func GenerateSSHKeyPair(privateKeyFile string, publicKeyFile string) error
- func GenerateStateFile(dirToSave string, state StateObject) error
- func GetConfig(name string) string
- func GetDesktopName(address string, password string) (string, error)
- func GetDockerNetworks() ([]*net.IPNet, error)
- func GetFileFollowLinks(filePath string) (string, error)
- func GetFileSize(filePath string) int64
- func GetFileSizeURL(url string) int64
- func GetIPForDockerAccess() (ip string, err error)
- func GetParams(line, regEx string) (paramsMap map[string]string)
- func GetSubnetIPs(subnet string) (result []net.IP)
- func HasImage(image string) (bool, error)
- func LoadConfigFile(config string) (loaded bool, err error)
- func LoadConfigFileContext(config string) (loaded bool, err error)
- func LoadRegistry(image, remote string) (string, error)
- func LookUp(i interface{}, path string) (value reflect.Value, err error)
- func LookupWithCallback(inpValue interface{}, inpPath string, callback checkPart)
- func ParseCertificate(certFile string) (*x509.Certificate, error)
- func ParsePrivateKey(keyFile string) (*rsa.PrivateKey, error)
- func PullImage(image string) error
- func PushImage(image, remote string) error
- func RemoveGeneratedVolumeOfContainer(containerName string) error
- func RenderTemplate(configFile string, tmpl string) (string, error)
- func RepeatableAttempt(client *http.Client, req *http.Request) (response *http.Response, err error)
- func RequestHTTPRepeatWithTimeout(url string, returnEmpty bool, timeoutSeconds time.Duration) (string, error)
- func RequestHTTPWithTimeout(url string, timeoutSeconds time.Duration) (string, error)
- func ResolveAbsPath(curPath string) string
- func ResolveHomeDir(filePath string) string
- func ResolveURL(b, p string) (string, error)
- func RunCommandAndWait(name string, args ...string) (stdout string, stderr string, err error)
- func RunCommandBackground(name string, logOutput io.Writer, args ...string) (pid int, err error)
- func RunCommandForeground(name string, args ...string) (err error)
- func RunCommandNohup(name string, logFile string, pidFile string, args ...string) (err error)
- func RunCommandWithLogAndWait(name string, logLevel log.Level, args ...string) (err error)
- func RunCommandWithSTDINAndWait(name string, stdin string, args ...string) (stdout string, stderr string, err error)
- func RunDockerCommand(image string, command string, volumeMap map[string]string) (result string, err error)
- func SHA256SUM(filePath string) (result string, err error)
- func SaveImage(image string) (io.ReadCloser, error)
- func SaveImageAndExtract(image, outputDir, defaultEvePrefixInTar string) error
- func SaveImageToTar(image, tarFile string) error
- func StartContainer(containerName string) error
- func StateContainer(containerName string) (state string, err error)
- func StatusCommandWithPid(pidFile string) (status string, err error)
- func StopCommandWithPid(pidFile string) (err error)
- func StopContainer(containerName string, remove bool) error
- func TouchFile(src string) (err error)
- func UnpackTarGz(srcFile string, paths []FileToSave) error
- func UploadFile(client *http.Client, url string, filePath string) (result *http.Response, err error)
- func WriteToFiles(crt *x509.Certificate, key interface{}, certFile string, keyFile string) (err error)
- type ConfigVars
- type Context
- type EVEDescription
- type FileToSave
- type IFInfo
- type QemuSettings
- type QueueWithCapacity
- type RegistryHTTP
- type StateObject
- type UEFIDescription
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildContainer ¶
BuildContainer build container with tagName using dockerFile
func ComputeShaOCITar ¶
ComputeShaOCITar compute the sha for an OCI tar file with the manifest inside
func CopyFileNotExists ¶
CopyFileNotExists copy file from src to dst with same permission if not exists
func CreateAndRunContainer ¶
func CreateAndRunContainer(containerName string, imageName string, portMap map[string]string, volumeMap map[string]string, command []string, envs []string) error
CreateAndRunContainer run container with defined name from image with port and volume mapping and defined command
func CreateDockerNetwork ¶
CreateDockerNetwork create network for docker`s containers
func CreateTarGz ¶
func CreateTarGz(dstFile string, paths []FileToSave) error
CreateTarGz generates tar.gz file in dstFile by putting files and directories described in paths
func CurrentDirConfigPath ¶
CurrentDirConfigPath returns path to eden-config.yml in current folder
func DefaultConfigPath ¶
DefaultConfigPath returns path to default config
func DefaultEdenDir ¶
DefaultEdenDir returns path to default directory
func DelEleInSlice ¶
func DelEleInSlice(arr interface{}, index int)
DelEleInSlice delete an element from slice by index
- arr: the reference of slice
- index: the index of element will be deleted
func DockerImageRepack ¶
DockerImageRepack export image to tar and repack it
func DownloadEveLive ¶
func DownloadEveLive(eve EVEDescription, uefi UEFIDescription, outputFile string) (err error)
DownloadEveLive pulls EVE live image from docker
func DownloadEveRootFS ¶
func DownloadEveRootFS(eve EVEDescription, outputDir string) (filePath string, err error)
DownloadEveRootFS pulls EVE rootfs image from docker
func DownloadFile ¶
DownloadFile download a url to a local file.
func ExtractFilesFromDocker ¶
func ExtractFilesFromDocker(u io.ReadCloser, directory string, prefixDirectory string) error
ExtractFilesFromDocker extract all files from docker layer into directory if prefixDirectory is not empty, remove it from path
func FileNameWithoutExtension ¶
FileNameWithoutExtension trim file extension
func FindEleInSlice ¶
FindEleInSlice takes a slice and looks for an element in it. If found it will return it's key, otherwise it will return -1 and a bool of false.
func GenServerCert ¶
func GenServerCert(cert *x509.Certificate, key *rsa.PrivateKey, serial *big.Int, ip []net.IP, dns []string, CN string) (*x509.Certificate, *rsa.PrivateKey)
GenServerCert cert gen
func GenServerCertElliptic ¶
func GenServerCertElliptic(cert *x509.Certificate, key *rsa.PrivateKey, serial *big.Int, ip []net.IP, dns []string, uuid string) (*x509.Certificate, *ecdsa.PrivateKey)
GenServerCertElliptic elliptic cert
func GenerateConfigFile ¶
GenerateConfigFile is a function to generate default yml
func GenerateConfigFileDiff ¶
GenerateConfigFileDiff is a function to generate diff yml for new context
func GenerateConfigFileFromViper ¶
func GenerateConfigFileFromViper() error
GenerateConfigFileFromViper is a function to generate yml from viper config
func GenerateSSHKeyPair ¶
GenerateSSHKeyPair generates keypair for ssh
func GenerateStateFile ¶
func GenerateStateFile(dirToSave string, state StateObject) error
GenerateStateFile generates state in file
func GetDesktopName ¶
GetDesktopName return DesktopName from VNC server address with password (if not empty)
func GetDockerNetworks ¶
GetDockerNetworks returns gateways IPs of networks in docker
func GetFileFollowLinks ¶
GetFileFollowLinks resolve file by walking through symlinks
func GetFileSizeURL ¶
GetFileSizeURL returns file size for url
func GetIPForDockerAccess ¶
GetIPForDockerAccess is service function to obtain IP for adam access The function is filter out docker bridge
func GetSubnetIPs ¶
GetSubnetIPs return all IPs from subnet
func LoadConfigFile ¶
LoadConfigFile load config from file with viper
func LoadConfigFileContext ¶
LoadConfigFileContext load config from context file with viper
func LoadRegistry ¶
LoadRegistry push image into registry
func LookupWithCallback ¶
func LookupWithCallback(inpValue interface{}, inpPath string, callback checkPart)
LookupWithCallback travels through inpValue by inpPath and apply callback you can pass [] without index for iterate over loops
func ParseCertificate ¶
func ParseCertificate(certFile string) (*x509.Certificate, error)
ParseCertificate from file
func ParsePrivateKey ¶
func ParsePrivateKey(keyFile string) (*rsa.PrivateKey, error)
ParsePrivateKey from file
func RemoveGeneratedVolumeOfContainer ¶
RemoveGeneratedVolumeOfContainer remove volumes created by eden
func RenderTemplate ¶
RenderTemplate render Go template with Eden-related fuctions
func RepeatableAttempt ¶
RepeatableAttempt do request several times waiting for nil error and expected status code
func RequestHTTPRepeatWithTimeout ¶
func RequestHTTPRepeatWithTimeout(url string, returnEmpty bool, timeoutSeconds time.Duration) (string, error)
RequestHTTPRepeatWithTimeout make series of requests to url with timeout returnEmpty control if empty string is normal result
func RequestHTTPWithTimeout ¶
RequestHTTPWithTimeout make request to url with timeout
func ResolveAbsPath ¶
ResolveAbsPath use eden.root parameter to resolve path
func RunCommandAndWait ¶
RunCommandAndWait run process in foreground
func RunCommandBackground ¶
RunCommandBackground command run in goroutine
func RunCommandForeground ¶
RunCommandForeground command run in foreground
func RunCommandNohup ¶
RunCommandNohup run process in background
func RunCommandWithLogAndWait ¶
RunCommandWithLogAndWait run process in foreground
func RunCommandWithSTDINAndWait ¶
func RunCommandWithSTDINAndWait(name string, stdin string, args ...string) (stdout string, stderr string, err error)
RunCommandWithSTDINAndWait run process in foreground with stdin passed as arg
func RunDockerCommand ¶
func RunDockerCommand(image string, command string, volumeMap map[string]string) (result string, err error)
RunDockerCommand is run wrapper for docker container
func SaveImage ¶
func SaveImage(image string) (io.ReadCloser, error)
SaveImage get a reader to save an image
func SaveImageAndExtract ¶
SaveImageAndExtract from docker to outputDir only for path defaultEvePrefixInTar in docker rootfs
func SaveImageToTar ¶
SaveImageToTar creates tar from image
func StartContainer ¶
StartContainer start container with containerName
func StateContainer ¶
StateContainer return state of container if found or "" state if not found
func StatusCommandWithPid ¶
StatusCommandWithPid check if process with pid from pidFile running
func StopCommandWithPid ¶
StopCommandWithPid sends kill to pid from pidFile
func StopContainer ¶
StopContainer stop container and remove if remove is true
func UnpackTarGz ¶
func UnpackTarGz(srcFile string, paths []FileToSave) error
UnpackTarGz observes tar.gz file in srcFile and extracts files and directories described in paths
func UploadFile ¶
func UploadFile(client *http.Client, url string, filePath string) (result *http.Response, err error)
UploadFile send file in form
func WriteToFiles ¶
func WriteToFiles(crt *x509.Certificate, key interface{}, certFile string, keyFile string) (err error)
WriteToFiles write cert and key
Types ¶
type ConfigVars ¶
type ConfigVars struct { AdamIP string AdamPort string AdamDomain string AdamDir string AdamCA string AdamRemote bool AdamCaching bool AdamCachingRedis bool AdamCachingPrefix string AdamRemoteRedis bool AdamRedisURLEden string AdamRedisURLAdam string EveHV string EveSSID string EveUUID string EveName string EveRemote bool EveRemoteAddr string EveQemuPorts map[string]string SSHKey string EveCert string EveDeviceCert string EveSerial string ZArch string DevModel string EdenBinDir string EdenProg string TestProg string TestScenario string EServerImageDist string EServerPort string EServerIP string LogLevel string AdamLogLevel string }
ConfigVars struct with parameters from config file
type Context ¶
Context for use with multiple config files
func ContextInit ¶
ContextInit generates and returns default context
func (*Context) GetCurrentConfig ¶
GetCurrentConfig return path to config file
func (*Context) ListContexts ¶
ListContexts show available contexts
func (*Context) SetContext ¶
SetContext set current contexts
type EVEDescription ¶
type EVEDescription struct { ConfigPath string Arch string HV string Registry string Tag string Format string ImageSizeMB int }
EVEDescription provides information about EVE to download
type FileToSave ¶
FileToSave provides pattern to save or load files based on Location and Destination inside fs and tar
type IFInfo ¶
IFInfo stores information about net address and subnet
func GetSubnetsNotUsed ¶
GetSubnetsNotUsed prepare map with subnets and ip not used by any interface of host
type QemuSettings ¶
type QemuSettings struct { DTBDrive string Firmware []string MemoryMB int CPUs int USBSerials int USBTablets int }
QemuSettings struct for pass into template
func (QemuSettings) GenerateQemuConfig ¶
func (settings QemuSettings) GenerateQemuConfig() ([]byte, error)
GenerateQemuConfig provides string representation of Qemu config for QemuSettings object
type QueueWithCapacity ¶
type QueueWithCapacity struct {
// contains filtered or unexported fields
}
QueueWithCapacity for represent FIFO queue with defined capacity
func InitQueueWithCapacity ¶
func InitQueueWithCapacity(capacity int) *QueueWithCapacity
InitQueueWithCapacity initialises queue
func (*QueueWithCapacity) Dequeue ¶
func (queue *QueueWithCapacity) Dequeue() (item interface{}, err error)
Dequeue get last element from queue
func (*QueueWithCapacity) Enqueue ¶
func (queue *QueueWithCapacity) Enqueue(item interface{}) error
Enqueue add element into queue if queue is full, it drop last element
type RegistryHTTP ¶
RegistryHTTP for http access to local registry
func NewRegistryHTTP ¶
NewRegistryHTTP creates new RegistryHTTP with plainHTTP resolver
type StateObject ¶
type StateObject struct { EveConfig string //if empty will not create/overwrite config file EveDir string AdamDir string EveUUID string DeviceUUID string QEMUConfig string }
StateObject is structure to save state in file
type UEFIDescription ¶
UEFIDescription provides information about UEFI to download