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

Remove build dep for helm deploy #2121

Merged
merged 4 commits into from
May 20, 2019
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
15 changes: 10 additions & 5 deletions pkg/skaffold/deploy/helm.go
Original file line number Diff line number Diff line change
Expand Up @@ -401,18 +401,23 @@ func (h *HelmDeployer) deleteRelease(ctx context.Context, out io.Writer, r lates

func (h *HelmDeployer) joinTagsToBuildResult(builds []build.Artifact, params map[string]string) (map[string]build.Artifact, error) {
imageToBuildResult := map[string]build.Artifact{}
for _, build := range builds {
imageToBuildResult[build.ImageName] = build
for _, b := range builds {
imageToBuildResult[b.ImageName] = b
}

paramToBuildResult := map[string]build.Artifact{}
for param, imageName := range params {
newImageName := util.SubstituteDefaultRepoIntoImage(h.defaultRepo, imageName)
build, ok := imageToBuildResult[newImageName]
b, ok := imageToBuildResult[newImageName]
if !ok {
return nil, fmt.Errorf("no build present for %s", imageName)
if len(builds) == 0 {
logrus.Debugf("no build artifacts present. Assuming skaffold deploy. Continuing with %s", imageName)
b = build.Artifact{ImageName: imageName, Tag: imageName}
} else {
return nil, fmt.Errorf("no build present for %s", imageName)
}
}
paramToBuildResult[param] = build
paramToBuildResult[param] = b
}
return paramToBuildResult, nil
}
Expand Down
10 changes: 8 additions & 2 deletions pkg/skaffold/deploy/helm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ spec:
containers:
- name: skaffold-helm
image: gcr.io/nick-cloudbuild/skaffold-helm:f759510436c8fd6f7ffa13dd9e9d85e64bec8d2bfd12c5aa3fb9af1288eccdab
imagePullPolicy:
imagePullPolicy:
command: ["/bin/bash", "-c", "--" ]
args: ["while true; do sleep 30; done;"]
resources:
Expand Down Expand Up @@ -301,7 +301,13 @@ func TestHelmDeploy(t *testing.T) {
builds: testBuilds,
},
{
description: "deploy error unmatched parameter",
description: "deploy should not error for unmatched parameter when no builds present",
cmd: &MockHelm{t: t},
runContext: makeRunContext(testDeployConfigParameterUnmatched, false),
builds: nil,
},
{
description: "deploy should error for unmatched parameter when builds present",
cmd: &MockHelm{t: t},
runContext: makeRunContext(testDeployConfigParameterUnmatched, false),
builds: testBuilds,
Expand Down