Skip to content

Commit

Permalink
fix(Traefik Hub): 🐛 handle main and latest build
Browse files Browse the repository at this point in the history
  • Loading branch information
darkweaver87 authored Feb 6, 2025
1 parent 203787d commit cb40c04
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 1 deletion.
9 changes: 8 additions & 1 deletion traefik/templates/requirements.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,14 @@
{{ fail "When using Traefik Hub image tag needs to be specified !" }}
{{- end -}}

{{ $hubVersion := (split "@" (default "v3" $.Values.image.tag))._0 | replace "latest-" "" }}
{{ $hubVersion := (split "@" (default "v3" $.Values.image.tag))._0 }}

{{/*
Consider non semver versions as latest one
*/}}
{{- if not (regexMatch "v[0-9]+.[0-9]+.[0-9]+" (default "" $.Values.image.tag)) -}}
{{ $hubVersion = "v3.99" }}
{{- end }}

{{- if and (semverCompare "<v3.9.0" $hubVersion) .Values.hub.tracing.additionalTraceHeaders.enabled }}
{{ fail "ERROR: additionalTraceHeaders is a feature only available for traefik-hub >= v3.9.0."}}
Expand Down
32 changes: 32 additions & 0 deletions traefik/tests/requirements-config_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -192,3 +192,35 @@ tests:
asserts:
- failedTemplate:
errorMessage: "ERROR: microcks provider is a feature only available for traefik-hub >= v3.7.0."
- it: should not fail when using hub.tracing.additionalTraceHeaders on Traefik Hub main builds
set:
image:
registry: "ghcr.io"
repository: "traefik/traefik-hub"
tag: main-1af57d3-1737730202
tracing:
otlp:
enabled: true
hub:
token: "xxx"
tracing:
additionalTraceHeaders:
enabled: true
asserts:
- notFailedTemplate: {}
- it: should not fail when using hub.tracing.additionalTraceHeaders on Traefik Hub latest v3 builds
set:
image:
registry: "ghcr.io"
repository: "traefik/traefik-hub"
tag: latest-v3
tracing:
otlp:
enabled: true
hub:
token: "xxx"
tracing:
additionalTraceHeaders:
enabled: true
asserts:
- notFailedTemplate: {}

0 comments on commit cb40c04

Please sign in to comment.