fluxcd / flux2

Open and extensible continuous delivery solution for Kubernetes. Powered by GitOps Toolkit.
https://fluxcd.io
Apache License 2.0
6.38k stars 593 forks source link

shenxn/protonmail-bridge: unable to determine latest version from provided list #4990

Closed AngellusMortis closed 1 day ago

AngellusMortis commented 1 day ago

Describe the bug

shenxn/protonmail-bridge is not working with ImageRepository / ImageUpdateAutomation. It does not seem to be detecting any image tag after 3.9.1-1

https://hub.docker.com/r/shenxn/protonmail-bridge/tags

It looks like it may not be parsing the tags correctly or something since the tag count matches up.

  Last Scan Result:
    Latest Tags:
      latest
      build
      3.9.1-1
      3.8.2-1
      3.8.1-1
      3.7.1-1
      3.6.1-2
      3.5.4-1
      3.5.3-1
      3.5.1-1
    Scan Time:  2024-09-17T13:53:52Z
    Tag Count:  85

Resources:

apiVersion: image.toolkit.fluxcd.io/v1beta2
kind: ImageRepository
metadata:
  name: protonmail-bridge
  namespace: flux-system
spec:
  image: shenxn/protonmail-bridge
  interval: 12h
---
apiVersion: image.toolkit.fluxcd.io/v1beta2
kind: ImagePolicy
metadata:
  name: protonmail-bridge-policy
  namespace: flux-system
spec:
  imageRepositoryRef:
    name: protonmail-bridge
  policy:
    semver:
      range: "3.12.*"
---
apiVersion: helm.toolkit.fluxcd.io/v2
kind: HelmRelease
spec:
  values:
    image:
      repository: shenxn/protonmail-bridge # {"$imagepolicy": "flux-system:protonmail-bridge-policy:name"}
      tag: 3.12.0-1 # {"$imagepolicy": "flux-system:protonmail-bridge-policy:tag"}

Steps to reproduce

  1. Create ImageRepository and ImageUpdateAutomation pointing to shenxn/protonmail-bridge with a range of "3.12.*"
  2. See error

Expected behavior

FluxCD should recognize and use 3.12.0-1 for shenxn/protonmail-bridge

Screenshots and recordings

No response

OS / Distro

Windows 11 (WSL)

Flux version

v2.3.0

Flux check

► checking prerequisites ✔ Kubernetes 1.30.3 >=1.28.0-0 ► checking version in cluster ✔ distribution: flux-v2.3.0 ✔ bootstrapped: true ► checking controllers ✔ helm-controller: deployment ready ► ghcr.io/fluxcd/helm-controller:v1.0.1 ✔ image-automation-controller: deployment ready ► ghcr.io/fluxcd/image-automation-controller:v0.38.0 ✔ image-reflector-controller: deployment ready ► ghcr.io/fluxcd/image-reflector-controller:v0.32.0 ✔ kustomize-controller: deployment ready ► ghcr.io/fluxcd/kustomize-controller:v1.3.0 ✔ notification-controller: deployment ready ► ghcr.io/fluxcd/notification-controller:v1.3.0 ✔ source-controller: deployment ready ► ghcr.io/fluxcd/source-controller:v1.3.0 ► checking crds ✔ alerts.notification.toolkit.fluxcd.io/v1beta3 ✔ buckets.source.toolkit.fluxcd.io/v1beta2 ✔ gitrepositories.source.toolkit.fluxcd.io/v1 ✔ helmcharts.source.toolkit.fluxcd.io/v1 ✔ helmreleases.helm.toolkit.fluxcd.io/v2 ✔ helmrepositories.source.toolkit.fluxcd.io/v1 ✔ imagepolicies.image.toolkit.fluxcd.io/v1beta2 ✔ imagerepositories.image.toolkit.fluxcd.io/v1beta2 ✔ imageupdateautomations.image.toolkit.fluxcd.io/v1beta2 ✔ kustomizations.kustomize.toolkit.fluxcd.io/v1 ✔ ocirepositories.source.toolkit.fluxcd.io/v1beta2 ✔ providers.notification.toolkit.fluxcd.io/v1beta3 ✔ receivers.notification.toolkit.fluxcd.io/v1 ✔ all checks passed

Git provider

No response

Container Registry provider

DockerHub

Additional context

$ flux -n flux-system logs --kind=ImageRepository --name=protonmail-bridge
2024-09-15T18:42:43.099Z info ImageRepository/protonmail-bridge.flux-system - successful scan: found 85 tags
2024-09-15T23:42:43.663Z info ImageRepository/protonmail-bridge.flux-system - no new tags found, next scan in 5h0m0s
2024-09-16T04:42:44.099Z info ImageRepository/protonmail-bridge.flux-system - no new tags found, next scan in 5h0m0s
2024-09-16T09:42:44.568Z info ImageRepository/protonmail-bridge.flux-system - no new tags found, next scan in 5h0m0s
2024-09-16T14:42:44.964Z info ImageRepository/protonmail-bridge.flux-system - no new tags found, next scan in 5h0m0s
2024-09-16T19:42:45.408Z info ImageRepository/protonmail-bridge.flux-system - no new tags found, next scan in 5h0m0s
2024-09-17T00:42:46.183Z info ImageRepository/protonmail-bridge.flux-system - no new tags found, next scan in 5h0m0s
2024-09-17T05:42:46.585Z info ImageRepository/protonmail-bridge.flux-system - no new tags found, next scan in 5h0m0s
2024-09-17T10:42:47.120Z info ImageRepository/protonmail-bridge.flux-system - no new tags found, next scan in 5h0m0s
2024-09-17T13:24:31.884Z info ImageRepository/protonmail-bridge.flux-system - no change in repository configuration since last scan, next scan in 9h18m15.147786846s
2024-09-17T13:25:43.386Z info ImageRepository/protonmail-bridge.flux-system - no new tags found, next scan in 12h0m0s
2024-09-17T13:53:52.265Z info ImageRepository/protonmail-bridge.flux-system - no new tags found, next scan in 12h0m0s

Code of Conduct

bigkevmcd commented 1 day ago

It looks like all the versions are pre-release versions, so you will need to change your Semver Constraint to include pre-release versions...

apiVersion: image.toolkit.fluxcd.io/v1beta2
kind: ImagePolicy
metadata:
  name: protonmail-bridge-policy
  namespace: flux-system
spec:
  imageRepositoryRef:
    name: protonmail-bridge
  policy:
    semver:
      range: "3.12.*-0" # <- this indicates that it should include pre-releases.

Should work

See https://github.com/Masterminds/semver?tab=readme-ov-file#working-with-prerelease-versions and https://semver.org/#spec-item-9

It's not clear why all the tags are marked as "pre-release" in this case, but that should fix it.

AngellusMortis commented 1 day ago

Could I do "3.12.*-*" instead to match any release?

And yeah, they are not really pre-release versions, it is just because it is an "unofficial" application. So, the extra number indicate the release number for that upstream version. I know Linux system packages often follow the same scheme.

bigkevmcd commented 1 day ago

@AngellusMortis https://go.dev/play/p/GLojB9uR6SM might help you figure this out

AngellusMortis commented 1 day ago

That helps a lot, thanks.