Skip to content

Commit

Permalink
fix: avoid copying binaries from the Init image when it's not necessary
Browse files Browse the repository at this point in the history
  • Loading branch information
rangoo94 committed Jul 25, 2024
1 parent 363594e commit 36f496a
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion pkg/testworkflows/testworkflowprocessor/action/optimize.go
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,25 @@ func optimize(actions []actiontypes.Action) ([]actiontypes.Action, error) {
}
}

// TODO: Avoid copying init process in case only Init Process image is used
// Avoid copying init process and common binaries, when it is not necessary
copyInit := false
copyBinaries := false
for i := range actions {
if actions[i].Type() == lite.ActionTypeContainerTransition {
if actions[i].Container.Config.Image != constants.DefaultInitImage {
copyInit = true
if actions[i].Container.Config.Image != constants.DefaultToolkitImage {
copyBinaries = true
}
}
}
}
for i := range actions {
if actions[i].Type() == lite.ActionTypeSetup {
actions[i].Setup.CopyInit = copyInit
actions[i].Setup.CopyBinaries = copyBinaries
}
}

// Get rid of skipped steps from initial statuses and results
skipMachine := expressions.NewMachine().
Expand Down

0 comments on commit 36f496a

Please sign in to comment.