From e3e839ea0a6f2e4773cb82daa50ff7f14cd3a399 Mon Sep 17 00:00:00 2001 From: Dustin Martin Date: Fri, 19 Jan 2024 00:55:37 -0500 Subject: [PATCH] Add labels to challenge instance containers Adds the label `cmgr.managed=true` to all challenge containers started by cmgr. Additionally, adds the label `cmgr.dynamic=`, indicating whether or not the instance is part of a build with `instance_count: -1`. --- cmgr/docker.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/cmgr/docker.go b/cmgr/docker.go index 5e30da5..a4c58d0 100644 --- a/cmgr/docker.go +++ b/cmgr/docker.go @@ -662,10 +662,21 @@ func (m *Manager) startContainers(build *BuildMetadata, instance *InstanceMetada } } + isDynamicInstance := "false" + if build.InstanceCount == DYNAMIC_INSTANCES { + isDynamicInstance = "true" + } + + cLabels := map[string]string{ + "cmgr.managed": "true", + "cmgr.dynamic": isDynamicInstance, + } + cConfig := container.Config{ Image: fmt.Sprintf("%s:%s", build.Challenge, build.dockerId(image)), Hostname: image.Host, ExposedPorts: exposedPorts, + Labels: cLabels, } hConfig := container.HostConfig{