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

sh -c helm dependency build failed exit status 1: Error: no cached repository #393

Open
rm-rf-home opened this issue Aug 26, 2022 · 6 comments

Comments

@rm-rf-home
Copy link

Describe the bug
An Argo CD application is configured to use the vault plugin with an umbrella Helm Chart hosted in git:

apiVersion: argoproj.io/v1alpha1
kind: Application
(...)
  source:
    plugin:
      name: argocd-vault-plugin-helm
    path: the/path
    repoURL: 'ssh://[email protected]:7999/repos/repo.git'
    targetRevision: thebranch
(...)

The umbrella Chart has another Helm Chart as dependency.

apiVersion: v2
(...)
dependencies:
  - name: another-chart
    version: 0.1.5
    repository: https://helm-example.com/charts/name/helm-poc

The plugin is configured like this:

  configManagementPlugins: |
    - name: argocd-vault-plugin
      generate:
        command: ["argocd-vault-plugin"]
        args: ["generate", "./"]
    - name: argocd-vault-plugin-helm
      init:
        command: [sh, -c]
        args: ["helm dependency build"]
      generate:
        command: ["sh", "-c"]
        args: ["helm template $ARGOCD_APP_NAME . | argocd-vault-plugin generate -"]

Both the git repo and the Helm repo are successfully added in Argo CD as repositories.
The "helm dependency build" command fails with the following error message:

rpc error: code = Unknown desc = Manifest generation error (cached): `sh -c helm dependency build ` failed exit status 1: Error: no cached repository for helm-manager-9894e008a23e82901a4adbd36642eca2d4d8848dbfd3afba46e82d8c440a41de found. (try 'helm repo update'): open /.cache/helm/repository/helm-manager-9894e008a23e82901a4adbd36642eca2d4d8848dbfd3afba46e82d8c440a41de-index.yaml: no such file or directory

Expected behavior
Dependencies should be downloaded

Additional context
Red Hat OpenShift GitOps 1.5.5
argocd-vault-plugin v1.12.0
OpenShift version 4.8.44
Kubernetes version v1.21.11+6b3cbdd
Argo CD
{
"Version": "v2.3.7+unknown",
"BuildDate": "2022-08-01T21:40:18Z",
"GitTreeState": "clean",
"GoVersion": "go1.17.12",
"Compiler": "gc",
"Platform": "linux/amd64",
"KsonnetVersion": "unable to determine ksonnet version: exec: "ks": executable file not found in $PATH",
"KustomizeVersion": "v4.4.1 1970-01-01T00:00:00Z",
"HelmVersion": "v3.8.0+g7ddadb4",
"KubectlVersion": "v0.23.1",
"JsonnetVersion": "v0.18.0"
}

@werne2j
Copy link
Member

werne2j commented Aug 29, 2022

This might help argoproj/argo-cd#7768 i dont think this is an AVP issue but a larger Helm with Argo CD thing.

@hamelg
Copy link

hamelg commented Oct 12, 2022

You get this error
open /.cache/helm/repository/helm-manager-9894e008a23e82901a4adbd36642eca2d4d8848dbfd3afba46e82d8c440a41de-index.yaml: no such file or directory
because helm has no permission to write the directory /.cache.

Here, setting the HOME environment variable to /tmp has solved the issue.

@meyfa
Copy link

meyfa commented Jan 4, 2023

Here, setting the HOME environment variable to /tmp has solved the issue.

For more fine-grained control, it's also possible to set just Helm variables:

  • HELM_CACHE_HOME to /tmp/helm/cache
  • HELM_CONFIG_HOME to /tmp/helm/config
  • HELM_DATA_HOME to /tmp/helm/data

After this, there may still be an error because Helm doesn't know about the dependency repo.
There are two options:

  • helm repo add <name> <url> for every repo that you need
  • helm dependency update instead of helm dependency build - this will ignore the lock file, but doesn't require adding repos

@lusu007
Copy link

lusu007 commented Jul 18, 2023

I think I ran into a similar issue. I got the following error in my ArgoCD UI:

rpc error: code = Unknown desc = Manifest generation error (cached): plugin sidecar failed. error generating manifests in cmp: rpc error: code = Unknown desc = error generating manifests: `sh -c "helm registry login \"$HELM_REGISTRY_URL\" -u \"$HELM_REGISTRY_USERNAME\" -p \"$HELM_REGISTRY_PASSWORD\" && helm dependency build"` failed exit status 1: WARNING: Using --password via the CLI is insecure. Use --password-stdin. Login Succeeded Error: no repository definition for https://charts.bitnami.com/bitnami. Please add the missing repos via 'helm repo add'

I also used helm dependency build.

@locustbaby
Copy link

Add env HELM_CACHE_HOME in repo server solved my issue, argo version 2.3.4

@PrayagS
Copy link

PrayagS commented Jun 6, 2024

I spent quite some time trying to set this plugin up for applications with dependencies. Turns out it's easier to not go through all these hoops to restore default behavior and instead use https://github.com/crumbhole/argocd-lovely-plugin which has a nice feature to chain plugins.

There's also a build of it which has this vault plugin bundled and ready to use out of the box.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants