Skip to content

Commit

Permalink
Merge pull request #575 from rasta-rocket/fix_secret_files_list
Browse files Browse the repository at this point in the history
fix: side-effect on r.SecretsFiles when having multiple successive call
  • Loading branch information
luisdavim committed Jan 25, 2021
2 parents 6dca687 + 91c977a commit 2668337
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions internal/app/release_files.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,14 +80,17 @@ func (r *release) getValuesFiles() []string {
fileList = append(fileList, r.SecretsFile+".dec")
} else if len(r.SecretsFiles) > 0 {
for i := 0; i < len(r.SecretsFiles); i++ {
if isOfType(r.SecretsFiles[i], []string{".dec"}) {
// if .dec extension is added before to the secret filename, don't add it again.
// This happens at upgrade time (where diff and upgrade both call this function)
// and we don't need to decrypt the file again
continue
}

if err := decryptSecret(r.SecretsFiles[i]); err != nil {
log.Fatal(err.Error())
}
// if .dec extension is added before to the secret filename, don't add it again.
// This happens at upgrade time (where diff and upgrade both call this function)
if !isOfType(r.SecretsFiles[i], []string{".dec"}) {
r.SecretsFiles[i] = r.SecretsFiles[i] + ".dec"
}
r.SecretsFiles[i] = r.SecretsFiles[i] + ".dec"
}
fileList = append(fileList, r.SecretsFiles...)
}
Expand Down

0 comments on commit 2668337

Please sign in to comment.