renovatebot / renovate

Home of the Renovate CLI: Cross-platform Dependency Automation by Mend.io
https://mend.io/renovate
GNU Affero General Public License v3.0
17.19k stars 2.25k forks source link

helmv3: Cannot update Chart.lock when file: is used for chart dependency #15163

Closed mcritchlow closed 2 years ago

mcritchlow commented 2 years ago

How are you running Renovate?

WhiteSource Renovate hosted app on github.com

If you're self-hosting Renovate, tell us what version of Renovate you run.

No response

Please select which platform you are using if self-hosting.

gitlab.com

If you're self-hosting Renovate, tell us what version of the platform you run.

No response

Was this something which used to work for you, and then stopped?

It used to work, and then stopped

Describe the bug

We have a Helm chart in a monorepo repository which sits next to one of it's dependencies.

This dependent chart is referenced using the file: syntax as described in the Helm docs: https://helm.sh/docs/chart_best_practices/dependencies/#repository-urls which states:

File URLs (file://...) are considered a "special case" for charts that are assembled by a fixed deployment pipeline.

We get an error from Renovate saying Error: could not find protocol handler for: file

see: https://gitlab.com/surfliner/surfliner/-/merge_requests/2207#note_915593963

The result is that the MR from Renovate contains an updated Chart.yaml, but not an updated Chart.lock

Here is where this reference occurs in the chart: https://gitlab.com/surfliner/surfliner/-/blob/trunk/charts/shoreline/Chart.yaml#L13

Relevant debug logs

Logs ``` Copy/paste any log here, between the starting and ending backticks ```

Have you created a minimal reproduction repository?

Yes: https://github.com/mcritchlow/renovate-helm-chart-file-dep

github-actions[bot] commented 2 years ago

Hi there,

Help us by making a minimal reproduction repository.

Before we can start work on your issue we first need to know exactly what's causing the current behavior. A minimal reproduction helps us with this.

To get started, please read our guide on creating a minimal reproduction to understand what is needed.

We may close the issue if you (or someone else) have not provided a minimal reproduction within two weeks. If you need more time, or are stuck, please ask for help or more time in a comment.

Good luck,

The Renovate team

mcritchlow commented 2 years ago

Ok, here's a reproduction repo: https://github.com/mcritchlow/renovate-helm-chart-file-dep

In it, "mychart" is the Helm chart which depends on a local "geoserver" chart using the file: .. protocol.

I also added a postgresql chart dependency, which is intentionally out of date and should trigger a pull request/chart update.

rarkins commented 2 years ago

Reproduction forked to https://github.com/renovate-reproductions/15163

What is the observed outcome? e.g. if you install the bot will you see a PR with failed artifacts update, or no PR at all?

mcritchlow commented 2 years ago

@rarkins we get a PR/MR, but without an updated Chart.lock file.

We do also get a message from the bot like this:

image

rarkins commented 2 years ago

In that case it seems like it's helm which is logging that error, not Renovate directly. There are some discussions on this same message within the helm repo: https://github.com/helm/helm/search?q=could+not+find+protocol+handler+for+is%3Aissue&type=issues

Most likely outcomes if it can be fixed are:

But we need a helm expert to figure it out first

mcritchlow commented 2 years ago

I'm not sure I'd call myself a helm expert, but we've had a fair amount of experience using it and running it in CI pipelines in various contexts.

Could you point me to:

We need to install some additional tools into our helm image, or We need to change commands we pass to helm

I'd be happy to take a look

rarkins commented 2 years ago

Our renovate/helm image is built from here: https://github.com/renovatebot/docker-helm, but the real logic is here: https://github.com/containerbase/buildpack/blob/d7b0d290cb313cb0df4f2795a6d44d9ade394499/src/usr/local/buildpack/tools/v2/helm.sh

In terms of the commands, they are from this repo, and you can see them in your logs (e.g. on the docker run command you see a glimpse of above)

carno commented 2 years ago

Sorry if I'm hijacking the thread, but I believe I have the same issue

Command failed: helm repo add dask --registry-config /tmp/renovate/cache/__renovate-private-cache/registry.json --repository-config /tmp/renovate/cache/__renovate-private-cache/repositories.yaml --repository-cache /tmp/renovate/cache/__renovate-private-cache/repositories file://../dependency_chart/dask
Error: could not find protocol handler for: file
---
apiVersion: v2
appVersion: "1.0"
description: A Helm chart for Kubernetes
name: <redacted>
version: 0.1.0
dependencies:
(…)
  - name: dask
    version: 2.2.2
    repository: file://../dependency_chart/dask
    tags:
      - lab
(…)

I have not written a line of type script in my life, but if I read the code correctly it looks like https://github.com/renovatebot/renovate/blob/main/lib/modules/manager/helmv3/artifacts.ts#L89 is executed for local dependencies and that does not make sense? Shouldn't they be skipped like in https://github.com/renovatebot/renovate/blob/main/lib/modules/manager/helmv3/utils.ts#L19 ?

mcritchlow commented 2 years ago

I have not written a line of type script in my life

Same, but that looks promising. I was going to dig into this today, really appreciate you looking at it as well.

renovate-release commented 2 years ago

:tada: This issue has been resolved in version 32.36.1 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

mcritchlow commented 2 years ago

many thanks to @SebastienElet and @rarkins for fixing this. really appreciate all the hard work on this amazing service