unbroken-dome / gradle-helm-plugin

A Gradle plugin for building, publishing and managing Helm charts.
MIT License
52 stars 55 forks source link

helmUpdate*Dependecies fails with "Error: no cached repository for helm-manager" #140

Closed rnett closed 2 years ago

rnett commented 2 years ago

Gradle: 7.2 Plugin version: 1.6.1 Helm version: 3.7.0

I'm trying to package a basic chart that depends on bitnami postgresql 10.13.1, this seems to cause the plugin to fail. Stacktrace:

Error: no cached repository for helm-manager-54d2620bbb6f1bb3f35d4c7f945bfa25077949488dcbb0a4d01c90f2c35baa59 found. (try 'helm repo update'): open C:\Users\jimne\Desktop\My Stuff\k8s-learning\.gradle\helm\cache\helm\repository\helm-manager-54d2620bbb6f1bb3f35d4c7f945bfa25077949488dcbb0a4d01c90f2c35baa59-index.yaml: The system cannot find the path specified.

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':helmUpdateMainChartDependencies'.
> A failure occurred while executing org.unbrokendome.gradle.plugins.helm.command.HelmExecWorkAction
   > Process 'command 'helm'' finished with non-zero exit value 1

helm update dependencies and helm package . in the source folder works fine.

rnett commented 2 years ago

Looks like it was caused by not explicitly specifying:

repositories {
    bitnami()
}

Not sure if that's intended or not.

tkrullmann commented 2 years ago

Yes, that's intended -- the plugin won't register any repositories by default so you'll have to add them in your build script.

By default the Helm plugin passes a different cache and config path to helm, in order to keep the Gradle builds as independent as possible from the state of a local Helm installation. That's why calling helm in your source folder works in this case: most likely you had the repository already registered with helm repo add.

You can change this behavior so that Gradle would use the same paths as your local Helm installation by setting the Gradle properties helm.xdgDataHome, helm.xdgCacheHome and helm.xdgConfigHome (best put into ~/.gradle/gradle.properties and not in your project because they're somewhat specific to your local environment).