buildRigLabels function

Map<String, String> buildRigLabels({
  1. required ContainerSpec spec,
  2. required String hash,
  3. required String project,
})

The labels rig puts on a container it creates.

Docker has no way to change a label afterwards, so nothing that rig will later want to rewrite belongs here. That is why a failed readiness mark lives in the state directory instead, and why there is no creation timestamp: Docker reports Created itself.

Implementation

Map<String, String> buildRigLabels({
  required ContainerSpec spec,
  required String hash,
  required String project,
}) {
  return {
    // The caller's labels go first so rig's own always win.
    ...spec.labels,
    rigMarkerLabel: '1',
    rigHashLabel: hash,
    rigLifetimeLabel: spec.lifetime.name,
    rigProjectLabel: project,
    rigSummaryLabel: summarizeSpec(spec),
  };
}