fix: `helmfile delete` should not stop on uninstalled release(s) (#509)

Resolves #481
This commit is contained in:
KUOKA Yusuke 2019-03-29 10:11:19 +09:00 committed by GitHub
parent d3c5417177
commit 870d33f418
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 1 deletions

View File

@ -708,7 +708,14 @@ func (st *HelmState) DeleteReleases(helm helmexec.Interface, purge bool) []error
if purge {
flags = append(flags, "--purge")
}
return helm.DeleteRelease(release.Name, flags...)
installed, err := isReleaseInstalled(helm, release)
if err != nil {
return err
}
if installed {
return helm.DeleteRelease(release.Name, flags...)
}
return nil
})
}

View File

@ -80,6 +80,9 @@ info "Deleting release"
${helmfile} -f ${dir}/happypath.yaml delete
${helm} status --namespace=${test_ns} httpbin &> /dev/null && fail "release should not exist anymore after a delete"
info "Ensuring \"helmfile delete\" doesn't fail when no releases installed"
${helmfile} -f ${dir}/happypath.yaml delete || fail "\"helmfile delete\" shouldn't fail when there are no installed releases"
test_pass "happypath"