Skip to content
This repository was archived by the owner on Mar 24, 2023. It is now read-only.

Commit

Permalink
clean paths before comparison
Browse files Browse the repository at this point in the history
  • Loading branch information
laverya committed Mar 14, 2019
1 parent ce0e98a commit 8651699
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions pkg/patch/patcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package patch

import (
"encoding/json"
"fmt"
"os"
"path"
"path/filepath"
Expand Down Expand Up @@ -232,7 +233,7 @@ func (p *ShipPatcher) writeTempKustomization(step api.Kustomize, resource string
return errors.Wrap(err, "failed to get relative path")
}

if targetPath == resource {
if filepath.Clean(targetPath) == filepath.Clean(resource) {
tempBaseKustomization.Resources = append(tempBaseKustomization.Resources, relativePath)
}
return nil
Expand All @@ -243,7 +244,7 @@ func (p *ShipPatcher) writeTempKustomization(step api.Kustomize, resource string

if len(tempBaseKustomization.Resources) == 0 {
level.Error(p.Logger).Log("event", "unable to find", "resource", resource)
return errors.New("Temp base directory is empty - base resource not found")
return fmt.Errorf("temp base directory is empty - base resource not found in %s", step.Base)
}

marshalled, err := yaml.Marshal(tempBaseKustomization)
Expand Down

0 comments on commit 8651699

Please sign in to comment.