Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Helm deployment check to only retrieve deployed YAML #5723

Merged
merged 2 commits into from
Apr 27, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Hello Helm
11 changes: 7 additions & 4 deletions pkg/skaffold/deploy/helm/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ func (h *Deployer) deployRelease(ctx context.Context, out io.Writer, releaseName
return nil, userErr("install", err)
}

b, err := h.getRelease(ctx, releaseName, opts.namespace)
b, err := h.getReleaseManifest(ctx, releaseName, opts.namespace)
if err != nil {
return nil, userErr("get release", err)
}
Expand All @@ -422,16 +422,19 @@ func (h *Deployer) deployRelease(ctx context.Context, out io.Writer, releaseName
return artifacts, nil
}

// getRelease confirms that a release is visible to helm
func (h *Deployer) getRelease(ctx context.Context, releaseName string, namespace string) (bytes.Buffer, error) {
// getReleaseManifest confirms that a release is visible to helm and returns the release manifest
func (h *Deployer) getReleaseManifest(ctx context.Context, releaseName string, namespace string) (bytes.Buffer, error) {
// Retry, because sometimes a release may not be immediately visible
opts := backoff.NewExponentialBackOff()
opts.MaxElapsedTime = 4 * time.Second
var b bytes.Buffer

err := backoff.Retry(
func() error {
if err := h.exec(ctx, &b, false, nil, getArgs(releaseName, namespace)...); err != nil {
// only intereted in the deployed YAML
args := getArgs(releaseName, namespace)
args = append(args, "--template", "{{.Release.Manifest}}")
if err := h.exec(ctx, &b, false, nil, args...); err != nil {
logrus.Debugf("unable to get release: %v (may retry):\n%s", err, b.String())
return err
}
Expand Down
Loading