DeepCopy returns a copy of the MatrixRow. Without this, deepcopy.OrderedMap falls back to copying the *MatrixRow pointer as-is, so every "copy" of a Matrix would still share the same underlying rows - see #2890, where concurrent invocations of a task with a `ref:` matrix row raced on resolveMatrixRe
()
| 99 | // concurrent invocations of a task with a `ref:` matrix row raced on |
| 100 | // resolveMatrixRefs mutating that shared row. |
| 101 | func (row *MatrixRow) DeepCopy() *MatrixRow { |
| 102 | if row == nil { |
| 103 | return nil |
| 104 | } |
| 105 | return &MatrixRow{ |
| 106 | Ref: row.Ref, |
| 107 | Value: deepcopy.Slice(row.Value), |
| 108 | } |
| 109 | } |
| 110 | |
| 111 | func (matrix *Matrix) UnmarshalYAML(node *yaml.Node) error { |
| 112 | switch node.Kind { |