4

I am planning to setup jenkins pipeline on K8S using terraform to provising my CI/CD environment.

I am using Terraform v0.12.18

My terraform file has following resource

resource "helm_release" "jenkins-master" {
  name = "jenkins"
  chart = "jenkins"
  version = "7.0.3"
  repository = "https://charts.bitnami.com/bitnami"


  set {
    name = "jenkinsUser"
    value = "admin"
  }
  set {
    name = "jenkinsPassword"
    value = "admin"
  }
}

When I ran terraform apply -input=false provision-plan

I am getting following error.

Error: failed to download "https://charts.bitnami.com/bitnami/jenkins-7.0.3.tgz" (hint: running `helm repo update` may help)

But when I ran direct helm install using

helm install my-jenkins bitnami/jenkins --version 7.0.3

then jenkins get install.

If I click on the linke https://charts.bitnami.com/bitnami/jenkins-7.0.3.tgz then also I am able to download the chart.

Can someone please helm to find the issue ?

Thanks Alpesh

Alpesh Jikadra
  • 1,692
  • 3
  • 18
  • 38

4 Answers4

7

The issue is caused because helm-terraform-provider uses verify = true by default.

The equivalent helm command would be

helm install my-jenkins bitnami/jenkins --version 7.0.3 --verify --debug

Which will triggers the following error:

> helm install my-jenkins bitnami/jenkins --version 7.0.3 --verify --debug
install.go:172: [debug] Original chart version: "7.0.3"
Error: failed to fetch provenance "https://charts.bitnami.com/bitnami/jenkins-7.0.3.tgz.prov"
helm.go:81: [debug] failed to fetch provenance "https://charts.bitnami.com/bitnami/jenkins-7.0.3.tgz.prov"

This is an issue with the upstream chart and we are looking into it.

As a temporary workaround, setting verify = false should fix the issue.

If the problem persists, adding HELM_DEBUG=1 to your terraform apply command would provide helpful information to determine the root cause of the issue.

Dharman
  • 30,962
  • 25
  • 85
  • 135
Miguel Ruiz
  • 121
  • 1
2

Solution/Workaround: Download the chart-file by hand, save it to a local file and set

chart = "<path-to-your-local-file>"
2

I got the same error when I ran terraform apply the first time on a freshly installed Ubuntu 22.04. The solution was running helm repo update manually the first time.

helm repo add bitnami https://charts.bitnami.com/bitnami
    "bitnami" already exists with the same configuration, skipping

helm search repo bitnami
    WARNING: Repo "bitnami" is corrupt or missing. Try 'helm repo update'.
    WARNING: open /home/xxxx/.cache/helm/repository/bitnami-index.yaml: no such file or directory
    No results found

helm repo update
    Hang tight while we grab the latest from your chart repositories...
    ...Successfully got an update from the "cetic" chart repository
    ...Successfully got an update from the "bitnami" chart repository
    Update Complete. ⎈Happy Helming!⎈
maow
  • 2,712
  • 1
  • 11
  • 25
-1

If the repo is not added to your local helm repo list then you get an error like;

Error: failed to download "https://github.com/kubernetes/autoscaler/releases/download/cluster-autoscaler-chart-9.13.1/cluster-autoscaler-9.13.1.tgz" at version "9.13.1"

then if you add the target repo to your local everything should be fine

helm repo add [NAME] [URL]
hmz
  • 1,017
  • 9
  • 18