Fixed ResolveStages

This commit is contained in:
Priya Wadhwa 2018-04-30 22:37:45 -04:00
parent 6c017128ab
commit a1acbe8aa8
1 changed files with 6 additions and 3 deletions

View File

@ -53,13 +53,16 @@ func ResolveStages(stages []instructions.Stage) {
nameToIndex := make(map[string]string)
for i, stage := range stages {
index := strconv.Itoa(i)
nameToIndex[stage.Name] = index
nameToIndex[index] = index
if stage.Name != index {
nameToIndex[stage.Name] = index
}
for _, cmd := range stage.Commands {
switch c := cmd.(type) {
case *instructions.CopyCommand:
if c.From != "" {
c.From = nameToIndex[c.From]
if val, ok := nameToIndex[c.From]; ok {
c.From = val
}
}
}
}