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 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1450 from weaveworks/issue/1278-helm-resolve-deps
Update chart dependencies before installing
- Loading branch information
Showing
7 changed files
with
95 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
apiVersion: v1 | ||
repositories: | ||
- caFile: "" | ||
cache: /var/fluxd/helm/repository/cache/stable-index.yaml | ||
certFile: "" | ||
keyFile: "" | ||
name: stable | ||
password: "" | ||
url: https://kubernetes-charts.storage.googleapis.com | ||
username: "" |
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,6 @@ | ||
# NB Helm clients will refuse to play with Tiller that is older. 2.8.2 | ||
# is the first release that had checksums; but 2.9.1 appears the first | ||
# that reliably supports authenticating against chart repos, so that | ||
# wins. | ||
HELM_VERSION=2.9.1 | ||
HELM_CHECKSUM=56ae2d5d08c68d6e7400d462d6ed10c929effac929fedce18d2636a9b4e166ba |
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,46 @@ | ||
package release | ||
|
||
import ( | ||
"fmt" | ||
"os" | ||
"os/exec" | ||
"path/filepath" | ||
) | ||
|
||
func updateDependencies(chartDir string) error { | ||
var hasLockFile bool | ||
|
||
// We are going to use `helm dep build`, which tries to update the | ||
// dependencies in charts/ by looking at the file | ||
// `requirements.lock` in the chart directory. If the lockfile | ||
// does not match what is specified in requirements.yaml, it will | ||
// error out. | ||
// | ||
// If that file doesn't exist, `helm dep build` will fall back on | ||
// `helm dep update`, which populates the charts/ directory _and_ | ||
// creates the lockfile. So that it will have the same behaviour | ||
// the next time it attempts a release, remove the lockfile if it | ||
// was created by helm. | ||
lockfilePath := filepath.Join(chartDir, "requirements.lock") | ||
info, err := os.Stat(lockfilePath) | ||
hasLockFile = (err == nil && !info.IsDir()) | ||
if !hasLockFile { | ||
defer os.Remove(lockfilePath) | ||
} | ||
|
||
cmd := exec.Command("helm", "repo", "update") | ||
out, err := cmd.CombinedOutput() | ||
if err != nil { | ||
return fmt.Errorf("could not update repo: %s", string(out)) | ||
} | ||
|
||
cmd = exec.Command("helm", "dep", "build", ".") | ||
cmd.Dir = chartDir | ||
|
||
out, err = cmd.CombinedOutput() | ||
if err != nil { | ||
return fmt.Errorf("could not update dependencies in %s: %s", chartDir, string(out)) | ||
} | ||
|
||
return 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