Skip to content

Commit

Permalink
fix: reverse order of deployers during cleanup (GoogleContainerTools#…
Browse files Browse the repository at this point in the history
  • Loading branch information
chronicc committed Oct 6, 2022
1 parent c50ca8a commit a1bbb01
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions pkg/skaffold/deploy/deploy_mux.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,12 @@ func (m DeployerMux) Dependencies() ([]string, error) {
}

func (m DeployerMux) Cleanup(ctx context.Context, w io.Writer, dryRun bool, manifestsByConfig manifest.ManifestListByConfig) error {
// Reverse order of deployers for cleanup to ensure resources
// are removed before their definitions are removed.
revDeployers := m.deployers
for i, j := 0, len(revDeployers)-1; i < j; i, j = i+1, j-1 {
revDeployers[i], revDeployers[j] = revDeployers[j], revDeployers[i]
}
for _, deployer := range m.deployers {
ctx, endTrace := instrumentation.StartTrace(ctx, "Cleanup")
if dryRun {
Expand Down

0 comments on commit a1bbb01

Please sign in to comment.