Skip to content

Commit

Permalink
Add labels to challenge instance containers
Browse files Browse the repository at this point in the history
Adds the label `cmgr.managed=true` to all challenge containers started
by cmgr.

Additionally, adds the label `cmgr.dynamic=<bool>`, indicating whether
or not the instance is part of a build with `instance_count: -1`.
  • Loading branch information
dmartin committed Jan 19, 2024
1 parent 4ed9aee commit e3e839e
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions cmgr/docker.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down

0 comments on commit e3e839e

Please sign in to comment.