Skip to content

Resolve the project url from the plain Host rule only - #152

Open
turegjorup wants to merge 2 commits into
developfrom
feature/url-host-label-regex
Open

turegjorup wants to merge 2 commits into
developfrom
feature/url-host-label-regex

Conversation

@turegjorup

Copy link
Copy Markdown
Contributor

idc url returns a malformed URL for any project whose nginx carries a second Traefik router, so idc open opens a blank browser tab.

Changes

  • scripts/itkdev-docker-compose, the url case: the jq host pattern goes from ^Host\(`(?<host>.+)`\)$ to ^Host\(`[^`]+`\)$ in the filter, and the capture likewise
  • Dropped the unused named group from the test call; only capture needs it

Why

. matches a backtick, and .+ is greedy, so the "bare Host rule" filter matched compound rules too. Given

Host(`itksites.local.itkdev.dk`) && PathPrefix(`/health/detail`)

the pattern still matches — the value starts with Host(` , ends with `), and .+ swallows the `) && PathPrefix(` in between — so nothing gets filtered and the capture returns that whole middle section as the host.

first then picks by label order, and traefik.http.routers.itksites-health.rule sorts ahead of traefik.http.routers.itksites.rule (- is 0x2D, . is 0x2E). So idc url printed

http://itksites.local.itkdev.dk`) && PathPrefix(`/health/detail

and open could not parse it. With [^`]+ a backtick can no longer be consumed, the compound rule fails the closing anchor and is excluded, and the capture yields the hostname alone.

Verified against devops_itksites, which has two such routers (/cron-metrics and /health/detail): idc url now prints http://itksites.local.itkdev.dk and idc open lands on the site.

Worth noting the bug is invisible without jq installed — that branch is skipped entirely and the script falls back to COMPOSE_DOMAIN.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant