helpers

package
v5.0.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2019 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TagSearch    byte = iota
	BranchSearch byte = iota
)

Variables

This section is empty.

Functions

func BuildVersionString

func BuildVersionString() string

BuildVersionString builds a version string containing both the version and the build

func ChainCommands

func ChainCommands(commands []*exec.Cmd) error

func CheckTag

func CheckTag(v string) error

func DockerComposeCommand

func DockerComposeCommand(args ...string) *exec.Cmd

func DockerComposeHasService

func DockerComposeHasService(service string) bool

func DockerComposeServiceId

func DockerComposeServiceId(serviceName string) (string, error)

func DockerComposeServiceIsRunning

func DockerComposeServiceIsRunning(serviceName string) (bool, error)

func DockerComposeServices

func DockerComposeServices() (services []string)

DockerComposeServices returns all docker-compose services found inside the project

func DockerComposeServicesExcluding

func DockerComposeServicesExcluding(excluded []string) []string

DockerComposeServicesExcluding same as DockerComposeServices(), but will exclude any services that has an image declaration in the 'excluded' slice.

func DockerContainerDyanmicPorts

func DockerContainerDyanmicPorts(id string) (map[string]string, error)

func DockerContainerExists

func DockerContainerExists(name string) bool

func DockerContainerIsRunning

func DockerContainerIsRunning(id string) (bool, error)

func DockerImageExists

func DockerImageExists(image string, tag string) (bool, error)

DockerImageExists returns true if docker image:tag exists in local docker daemon

func DockerIp

func DockerIp() (string, error)

func EnsureDockerConnectivity

func EnsureDockerConnectivity() error

EnsureDockerConnectivity will return an error if the docker daemon is not accessible

func ExtractTag

func ExtractTag(gitTag string, gitBranch string) (string, error)

* extract tag name from git tag or git branch * gives priority to git tag

func ExtractTagFromBranch

func ExtractTagFromBranch(gitBranch string) (string, error)

* extract tag name from branch * branch: `master` becomes tag `latest` * branch: `origin/release/xxx` becomes tag `xxx` * branch: `origin/aaa/xxx` becomes tag `snapshot.aaa.xxx` * branch: `origin/xxx` becomes tag `snapshot.xxx`

func ExtractTagFromTag

func ExtractTagFromTag(gitTag string) (string, error)

extractTagFromTag will extract the docker tag from the git tag

gitTag must be of format 'v.X.Y.Z-q', where X, Y, and Z are ints and q is some character-baed qualifier. example: v0.2.2, v0.2.3-rc1

func GetDockerClient

func GetDockerClient() *docker.Client

func GetDockerComposeVersion

func GetDockerComposeVersion(c *cli.Context) (string, []int, error)

GetDockerComposeVersion returns version of the docker-compose binary first return value is the human readable version second return value is an array of the {majorVersion, minorVersion, patchVersion}

func GetDockerVersion

func GetDockerVersion() (string, []int, error)

GetDockerVersion returns version of the docker binary first return value is the human readable version second return value is an array of the {majorVersion, minorVersion, patchVersion}

func HasDockerfile

func HasDockerfile() bool

func IsStableBranch

func IsStableBranch(gitBranch string) bool

func IsTagNameAlreadyUsed added in v1.6.1

func IsTagNameAlreadyUsed(tag string) (bool, error)

func IsTagNameAlreadyUsedAsABranchName added in v1.6.1

func IsTagNameAlreadyUsedAsABranchName(tag string) (bool, error)

func PullDockerImage

func PullDockerImage(image string, tag string) error

PullDockerImage blindly pulls the image:tag

func RemoveContainersOfImage

func RemoveContainersOfImage(image string) error

RemoveContainersOfImage will remove all containers created from the provided image

func RunCommand

func RunCommand(command *exec.Cmd) error

func RunCommandWithOutput

func RunCommandWithOutput(command *exec.Cmd) (string, error)

func ServiceLogs added in v1.7.0

func ServiceLogs(service string) ([]byte, error)

ServiceLogs simply returns the both stderr and stdout logs for a service

func Version

func Version() string

Version returns the raw version string

Types

type ComposeFileVersion

type ComposeFileVersion int

ComposeFileVersion inside the repo

const (
	V1 ComposeFileVersion
	V2
)

func GetComposeFileVersion

func GetComposeFileVersion(file string, defaultVersion ComposeFileVersion) ComposeFileVersion

GetComposeFileVersion of the current repo Will return the defaultVersion if it cannot determine the actual version

type DockerComposeMap

type DockerComposeMap map[string]DockerComposeService

type DockerComposeNetwork

type DockerComposeNetwork struct {
	Driver string
}

type DockerComposeNetworkMap

type DockerComposeNetworkMap map[string]DockerComposeNetwork

type DockerComposeService

type DockerComposeService struct {
	Image string
}

type DockerComposeV2

type DockerComposeV2 struct {
	Version  string
	Services DockerComposeMap
	Networks DockerComposeNetworkMap
}

type DockerDataContainer

type DockerDataContainer struct {
	Image     string
	Name      string
	Volumes   []string
	Resilient bool
}

func (*DockerDataContainer) Create

func (ddc *DockerDataContainer) Create() error

func (*DockerDataContainer) Ensure

func (ddc *DockerDataContainer) Ensure(offline bool) error

Jump to

Keyboard shortcuts

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