Documentation ¶
Index ¶
- Constants
- func IsCreatedByTugbot(e *dockerclient.Event) bool
- func IsSwarmTask(e *dockerclient.Event) bool
- type Client
- type Container
- func (c Container) GetEventListenerInterval() (time.Duration, bool)
- func (c Container) ID() string
- func (c Container) ImageID() string
- func (c Container) ImageName() string
- func (c Container) IsCreatedByTugbot() bool
- func (c Container) IsEventListener(e *dockerclient.Event) bool
- func (c Container) IsTugbot() bool
- func (c Container) IsTugbotCandidate() bool
- func (c Container) Name() string
- type Filter
Constants ¶
const ( TugbotService = "tugbot-service" TugbotTest = "tugbot-test" TugbotEventDocker = "tugbot-event-docker" TugbotEventTimer = "tugbot-event-timer" TugbotCreatedFrom = "tugbot-created-from" SwarmTaskID = "com.docker.swarm.task.id" )
Docker container labels
const ( // type filter: tugbot-event-docker-filter-type=container|image|daemon|network|volume|plugin TypeFilter = "tugbot-event-docker-filter-type" // action filter (depends on type), for 'container' type: // - attach, commit, copy, create, destroy, detach, die, exec_create, exec_detach, exec_start, export, // - health_status, kill, oom, pause, rename, resize, restart, start, stop, top, unpause, update ActionFilter = "tugbot-event-docker-filter-action" // container filter: use name, comma separated name list or RE2 regexp ContainerFilter = "tugbot-event-docker-filter-container" // image filter: use name, comma separated name list or RE2 regexp ImageFilter = "tugbot-event-docker-filter-image" // label filter: use key=value comma separated pairs LabelFilter = "tugbot-event-docker-filter-label" )
Docker Event Filter
Variables ¶
This section is empty.
Functions ¶
func IsCreatedByTugbot ¶
func IsCreatedByTugbot(e *dockerclient.Event) bool
IsCreatedByTugbot - true if created by tugbot
func IsSwarmTask ¶
func IsSwarmTask(e *dockerclient.Event) bool
IsSwarmTask - true if container is a swarm task
Types ¶
type Client ¶
type Client interface { ListContainers(Filter) ([]Container, error) StartContainerFrom(Container) error StartMonitorEvents(dockerclient.Callback) StopAllMonitorEvents() Inspect(containerID string) (*Container, error) }
A Client is the interface through which tugbot interacts with the Docker API.
type Container ¶
type Container struct {
// contains filtered or unexported fields
}
Container represents a running Docker container.
func NewContainer ¶
func NewContainer(containerInfo *dockerclient.ContainerInfo, imageInfo *dockerclient.ImageInfo) *Container
NewContainer returns a new Container instance instantiated with the specified ContainerInfo and ImageInfo structs.
func (Container) GetEventListenerInterval ¶
GetEventListenerTimer returns interval duration between a test container run and true if docker label exist and label value parsed into Duration, Otherwise false.
func (Container) ImageID ¶
ImageID returns the ID of the Docker image that was used to start the container.
func (Container) ImageName ¶
ImageName returns the name of the Docker image that was used to start the container. If the original image was specified without a particular tag, the "latest" tag is assumed.
func (Container) IsCreatedByTugbot ¶
IsCreatedByTugbot returns whether or not a container created by tugbot.
func (Container) IsEventListener ¶
func (c Container) IsEventListener(e *dockerclient.Event) bool
IsEventListener returns whether or not a container should run when an event e is occurred.
func (Container) IsTugbot ¶
IsTugbot returns whether or not the current container is the tugbot container itself. The tugbot container is identified by the presence of the "tugbot.service" label in the container metadata.
func (Container) IsTugbotCandidate ¶
IsTugbotCandidate returns whether or not a container is a candidate to run by tugbot. A candidate container is identified by the presence of "tugbot-test", it doesn't contain "tugbot.created.from" in the container metadata and it state is "Exited".