This repository has been archived by the owner on Nov 1, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 260
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
release: detect change of charts base values
By returning values as part of the `helm.Chart` object, so that the comparison done during dry-run will take into account the charts base values which ultimately results in ensure we perofrm a release when the values change.
- Loading branch information
1 parent
448897b
commit 94d20aa
Showing
8 changed files
with
78 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package helm | ||
|
||
import ( | ||
"crypto/sha256" | ||
"encoding/hex" | ||
|
||
"github.com/ghodss/yaml" | ||
) | ||
|
||
// Values represents a collection of (Helm) values. | ||
// We define our own type to avoid working with two `chartutil` | ||
// versions. | ||
type Values map[string]interface{} | ||
|
||
// YAML encodes the values into YAML bytes. | ||
func (v Values) YAML() ([]byte, error) { | ||
b, err := yaml.Marshal(v) | ||
return b, err | ||
} | ||
|
||
// Checksum calculates and returns the SHA256 checksum of the YAML | ||
// encoded values. | ||
func (v Values) Checksum() string { | ||
b, _ := v.YAML() | ||
|
||
hasher := sha256.New() | ||
hasher.Write(b) | ||
return hex.EncodeToString(hasher.Sum(nil)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters