source-controller icon indicating copy to clipboard operation
source-controller copied to clipboard

no chart version found - semver range issue

Open psolarcz opened this issue 2 years ago • 2 comments

Version: ghcr.io/fluxcd/source-controller:v0.15.4

I'm getting an error: no chart version found for XXX-09.20.x:

flux get all -A
NAMESPACE  	NAME                             	READY	MESSAGE                                                   	REVISION                                	SUSPENDED
flux-system	helmrepository/XXX-helm-repo-dev	True 	Fetched revision: 9ddf39cf1e565edfdb96edb36465ec1b440f1a9c	9ddf39cf1e565edfdb96edb36465ec1b440f1a9c	False


NAMESPACE  	NAME                           	READY	MESSAGE                                        	REVISION	SUSPENDED
flux-system	helmchart/default-XXX-dev     	False	no chart version found for XXX-09.20.x        	        	False

However it exist in our private repo:

helm search repo XXX --version "09.20.x"
NAME                       	CHART VERSION	APP VERSION	DESCRIPTION
XXX-helm-repo-dev/XXX    	09.20.22     	09.20.22   	XXX Helm Charts

It's also present in the index.yaml file:

cat data/helmrepository/flux-system/XXX-helm-repo-dev/index.yaml
apiVersion: v1
entries:
  XXX:

  - apiVersion: v2
    appVersion: 09.20.22
    created: "2021-09-20T22:13:45.626Z"
    description: XXX Helm Charts
    digest: 0a22e6db6168ff9a297026e7623eb3ab13f2f8ea442a0d9ead25898e9b385e58
    icon: https://upload.wikimedia.org/wikipedia/commons/6/64/XXX.svg
    name: XXX
    urls:
    - https://REPO_URL/artifactory/api/helm/XXX-helm-repo-dev/XXX-09.20.22.tgz
    version: 09.20.22

When I specify version explicitly it works fine, I have problem only when I use some range operator or wildcards.

Edit:

HelmRelease manifest:

apiVersion: helm.toolkit.fluxcd.io/v2beta1
kind: HelmRelease
metadata:
  name: XXX-dev
  namespace: default
spec:
  chart:
    spec:
      chart: XXX
      version: "09.20.x"
      valuesFiles:
       - values.yaml
      sourceRef:
        kind: HelmRepository
        name: XXX-helm-repo-dev
        namespace: flux-system
  interval: 10m

Generated helmchart:

k get helmchart -n flux-system -o yaml
apiVersion: v1
items:
- apiVersion: source.toolkit.fluxcd.io/v1beta1
  kind: HelmChart
  metadata:
    creationTimestamp: "2021-09-21T11:07:02Z"
    finalizers:
    - finalizers.fluxcd.io
    generation: 1
    name: default-XXX-dev
    namespace: flux-system
    resourceVersion: "20314135"
    uid: 05102c57-84d5-42c9-8c74-8e7fa1f91b7e
  spec:
    chart: XXX
    interval: 10m0s
    sourceRef:
      kind: HelmRepository
      name: XXX-helm-repo-dev
    valuesFiles:
    - values.yaml
    version: 09.20.x
  status:
    conditions:
    - lastTransitionTime: "2021-09-21T11:07:12Z"
      message: no chart version found for XXX-09.20.x
      reason: ChartPullFailed
      status: "False"
      type: Ready
    observedGeneration: 1

psolarcz avatar Sep 21 '21 11:09 psolarcz

I found source of a problem - our version was incorrect - 09.20.22 should not have leading 0.

This was returning an error:

Version segment starts with 0

Not sure if this is expected behaviour that there is no error, for sure it makes troubleshooting more difficult :)

psolarcz avatar Sep 21 '21 13:09 psolarcz

@psolarcz I believe that's because 09.20.22 is not a valid semver: https://regex101.com/r/vkijKf/1/

Found your issue while also playing around with chart's dev version. #205 and #410 were a big help for me, I think something like this will work: 0.0.0-09-20-22

https://play.golang.org/p/Tiy3DQiR8La https://github.com/Masterminds/semver#checking-version-constraints

tarasbsbr avatar Oct 03 '21 13:10 tarasbsbr