Created
September 27, 2024 16:20
-
-
Save fredleger/f599e058374721ebfae23c942e991da3 to your computer and use it in GitHub Desktop.
helm lock chalenge
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
#!/bin/bash | |
# infos: | |
# https://github.com/helm/helm/blob/3a3e3846ca9c929a6966583b461181e70f19bc13/internal/resolver/resolver.go#L215 | |
# https://github.com/helm/helm/blob/983d5c26f805cc5cc29d3c27e8749e140f85b940/internal/resolver/resolver_test.go#L184 | |
# req: '{Name: "alpine", Version: 0.1.0, Repository: "http://localhost:8879/charts"}' | |
# lock: '{Name: "alpine", Version: 0.1.0, Repository: "http://localhost:8879/charts"}' | |
# function: data, err := json.Marshal([2][]*chart.Dependency{req, lock}) | |
in='[{"Name": "alpine", "Version": "0.1.0", "Repository": "http://localhost:8879/charts"}, {"Name": "alpine", "Version": "0.1.0", "Repository": "http://localhost:8879/charts"}]' | |
expected='sha256:fb239e836325c5fa14b29d1540a13b7d3ba13151b67fe719f820e0ef6d66aaaf' | |
echo -n "- validate input ... " | |
echo $in | jq . > /dev/null && echo "✅" || echo "❌" | |
echo -n "- validate sha256 ... " | |
sha="$(echo $in | sha256sum | cut -d ' ' -f 1)" | |
[ "$sha" == "$expected" ] && echo "✅" || echo "❌ (sha256: $sha)" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment