Documentation
¶
Index ¶
- func ClearDockerConfigSecret(parentPath string) error
- func DetermineDebugPortForPFE() (pfeDebugPort string)
- func GetContainersToRemove(containerList []types.Container) []types.Container
- func WriteToComposeFile(dockerComposeFile string, debug bool) bool
- type Compose
- type DockerClient
- type DockerConfig
- type DockerCredential
- type DockerError
- func AddDockerCredential(connectionID string, address string, username string, password string) *DockerError
- func CheckContainerStatus(dockerClient DockerClient) (bool, *DockerError)
- func CheckImageStatus(dockerClient DockerClient) (bool, *DockerError)
- func DockerCompose(dockerComposeFile string, tag string, loglevel string) *DockerError
- func DockerComposeRemove(dockerComposeFile, tag string) *DockerError
- func DockerComposeStop(tag, dockerComposeFile string) *DockerError
- func GetContainerList(dockerClient DockerClient) ([]types.Container, *DockerError)
- func GetContainerTags(dockerClient DockerClient) ([]string, *DockerError)
- func GetImageList(dockerClient DockerClient) ([]types.ImageSummary, *DockerError)
- func GetImageTags(dockerClient DockerClient) ([]string, *DockerError)
- func GetPFEHostAndPort(dockerClient DockerClient) (string, string, *DockerError)
- func LoginToRegistry(address string, username string, password string) *DockerError
- func NewDockerClient() (*client.Client, *DockerError)
- func PingHealth(healthEndpoint string) (bool, *DockerError)
- func PullImage(dockerClient DockerClient, image string, jsonOutput bool) *DockerError
- func RemoveDockerCredential(connectionID string, address string) *DockerError
- func RemoveImage(imageID string) *DockerError
- func StopContainer(dockerClient DockerClient, container types.Container) *DockerError
- func ValidateImageDigest(dockerClient DockerClient, image string) (string, *DockerError)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ClearDockerConfigSecret ¶
ClearDockerConfigSecret We erase the contents rather than deleting the file as the docker-compose file expects the secret to be present.
func DetermineDebugPortForPFE ¶
func DetermineDebugPortForPFE() (pfeDebugPort string)
DetermineDebugPortForPFE determines a debug port to use for PFE based on the external PFE port
func GetContainersToRemove ¶
GetContainersToRemove returns a list of containers ([]types.Container) matching "/cw"
func WriteToComposeFile ¶
WriteToComposeFile the contents of the docker compose yaml
Types ¶
type Compose ¶
type Compose struct {
Version string `yaml:"version"`
SERVICES struct {
PFE struct {
Image string `yaml:"image"`
ContainerName string `yaml:"container_name"`
User string `yaml:"user"`
Environment []string `yaml:"environment"`
DependsOn []string `yaml:"depends_on"`
Ports []string `yaml:"ports"`
Volumes []string `yaml:"volumes"`
Networks []string `yaml:"networks"`
Secrets []string `yaml:"secrets"`
} `yaml:"codewind-pfe"`
PERFORMANCE struct {
Image string `yaml:"image"`
Ports []string `yaml:"ports"`
ContainerName string `yaml:"container_name"`
Volumes []string `yaml:"volumes"`
Networks []string `yaml:"networks"`
} `yaml:"codewind-performance"`
} `yaml:"services"`
VOLUME struct {
CodewindWorkspace map[string]string `yaml:"cw-workspace"`
} `yaml:"volumes"`
NETWORKS struct {
NETWORK struct {
DRIVEROPTS struct {
HostIP string `yaml:"com.docker.network.bridge.host_binding_ipv4"`
} `yaml:"driver_opts"`
} `yaml:"network"`
} `yaml:"networks"`
SECRETS struct {
DOCKERCONFIG struct {
File string `yaml:"file"`
} `yaml:"dockerconfig"`
} `yaml:"secrets"`
}
Compose struct for the docker compose yaml file
type DockerClient ¶
type DockerClient interface {
ImagePull(ctx context.Context, image string, imagePullOptions types.ImagePullOptions) (io.ReadCloser, error)
ImageList(ctx context.Context, imageListOptions types.ImageListOptions) ([]types.ImageSummary, error)
ContainerList(ctx context.Context, containerListOptions types.ContainerListOptions) ([]types.Container, error)
ContainerInspect(ctx context.Context, containerID string) (types.ContainerJSON, error)
ContainerStop(ctx context.Context, containerID string, timeout *time.Duration) error
ContainerRemove(ctx context.Context, containerID string, options types.ContainerRemoveOptions) error
DistributionInspect(ctx context.Context, image, encodedRegistryAuth string) (registry.DistributionInspect, error)
}
DockerClient requires all the functions called on the docker client package
type DockerConfig ¶
type DockerConfig struct {
Auths map[string]DockerCredential `json:"auths"`
}
DockerConfig : The docker config.json object.
type DockerCredential ¶
type DockerCredential struct {
Username string `json:"username"`
Password string `json:"password"`
Auth string `json:"auth"`
}
DockerCredential : A single login for a docker registry.
type DockerError ¶
DockerError struct will format the error
func AddDockerCredential ¶
func AddDockerCredential(connectionID string, address string, username string, password string) *DockerError
AddDockerCredential : Add (or update) a single docker login in the keychain entry.
func CheckContainerStatus ¶
func CheckContainerStatus(dockerClient DockerClient) (bool, *DockerError)
CheckContainerStatus of Codewind running/stopped
func CheckImageStatus ¶
func CheckImageStatus(dockerClient DockerClient) (bool, *DockerError)
CheckImageStatus of Codewind installed/uninstalled
func DockerCompose ¶
func DockerCompose(dockerComposeFile string, tag string, loglevel string) *DockerError
DockerCompose to set up the Codewind environment
func DockerComposeRemove ¶
func DockerComposeRemove(dockerComposeFile, tag string) *DockerError
DockerComposeRemove to remove Codewind images
func DockerComposeStop ¶
func DockerComposeStop(tag, dockerComposeFile string) *DockerError
DockerComposeStop to stop Codewind containers
func GetContainerList ¶
func GetContainerList(dockerClient DockerClient) ([]types.Container, *DockerError)
GetContainerList from docker
func GetContainerTags ¶
func GetContainerTags(dockerClient DockerClient) ([]string, *DockerError)
GetContainerTags of the Codewind version(s) currently running
func GetImageList ¶
func GetImageList(dockerClient DockerClient) ([]types.ImageSummary, *DockerError)
GetImageList from docker
func GetImageTags ¶
func GetImageTags(dockerClient DockerClient) ([]string, *DockerError)
GetImageTags of Codewind images
func GetPFEHostAndPort ¶
func GetPFEHostAndPort(dockerClient DockerClient) (string, string, *DockerError)
GetPFEHostAndPort will return the current hostname and port that PFE is running on
func LoginToRegistry ¶
func LoginToRegistry(address string, username string, password string) *DockerError
LoginToRegistry : Log in locally to a docker registry with the supplied credentials.
func NewDockerClient ¶
func NewDockerClient() (*client.Client, *DockerError)
NewDockerClient creates a new client for the docker API
func PingHealth ¶
func PingHealth(healthEndpoint string) (bool, *DockerError)
PingHealth - pings environment api every 15 seconds to check if containers started
func PullImage ¶
func PullImage(dockerClient DockerClient, image string, jsonOutput bool) *DockerError
PullImage - pull pfe/performance images from dockerhub
func RemoveDockerCredential ¶
func RemoveDockerCredential(connectionID string, address string) *DockerError
RemoveDockerCredential : Remove a single docker login in the keychain entry.
func RemoveImage ¶
func RemoveImage(imageID string) *DockerError
RemoveImage of Codewind and project
func StopContainer ¶
func StopContainer(dockerClient DockerClient, container types.Container) *DockerError
StopContainer will stop only codewind containers
func ValidateImageDigest ¶
func ValidateImageDigest(dockerClient DockerClient, image string) (string, *DockerError)
ValidateImageDigest - will ensure the image digest matches that of the one in dockerhub returns imageID, docker error
func (*DockerError) Error ¶
func (de *DockerError) Error() string
DockerError : Error formatted in JSON containing an errorOp and a description