Skip to content

refactor(config): normalize all URL env vars via shared urlSchema - #2526

Draft
shikanime wants to merge 2 commits into
mainfrom
fix/gitlab-trailing-slash
Draft

refactor(config): normalize all URL env vars via shared urlSchema#2526
shikanime wants to merge 2 commits into
mainfrom
fix/gitlab-trailing-slash

Conversation

@shikanime

@shikanime shikanime commented Aug 20, 2026

Copy link
Copy Markdown
Member

Issues liées

Closes #2524


Quel est le comportement actuel ?

La création de groupe / sous-groupe / dépôt GitLab échoue avec une erreur GitbeakerRequestError: Internal Server Error (HTTP 500) sur POST /api/v4/groups lorsque GITLAB_URL (ou GITLAB_INTERNAL_URL) se termine par un slash. gitbeaker construit l'URL de base en concaténant host + "api" + "v4" avec /, produisant …fr//api/v4 (double slash) que le webservice GitLab ne route pas. Le même risque existe pour toutes les URLs injectées par variable d'environnement.

Quel est le nouveau comportement ?

Une normalisation d'URL partagée (urlSchema dans config.utils.ts) est appliquée à toutes les variables d'environnement de type URL des schémas de configuration : new URL(s).href normalise la casse, les dot-segments et le port par défaut, puis le slash final (que new URL() conserve) est retiré. Couvre les 17 variables URL de src/config/ (argocd, base, gitlab, harbor, keycloak, nexus, observability, service-chain, sonarqube, vault) ainsi que les champs URL hors config (configuration OpenID Keycloak, dépôt Helm observability). Les logiques locales (.replace, normalizeUrl GitLab) sont supprimées. Tests de régression ajoutés dans config.utils.spec.ts.

Cette PR introduit-elle un breaking change ?

Non.

Autres informations

Indépendant de #2529 (collision 409 sur le nom d'utilisateur).

@shikanime shikanime self-assigned this Aug 20, 2026
@shikanime shikanime added this to the 9.24.5 milestone Aug 20, 2026
@github-actions github-actions Bot added the built label Aug 20, 2026
@shikanime
shikanime force-pushed the fix/gitlab-trailing-slash branch 4 times, most recently from 1006335 to c7bd7f1 Compare August 20, 2026 16:17
@shikanime
shikanime force-pushed the fix/gitlab-trailing-slash branch 2 times, most recently from c6a7910 to 84837af Compare August 20, 2026 16:58
@shikanime
shikanime marked this pull request as ready for review August 20, 2026 16:58
@shikanime
shikanime requested a review from KepoParis August 20, 2026 16:58
@shikanime shikanime added the bug Something isn't working label Aug 20, 2026
@shikanime
shikanime force-pushed the fix/gitlab-trailing-slash branch from 84837af to f56ccdf Compare August 20, 2026 17:17
Signed-off-by: William Phetsinorath <william.phetsinorath-open@interieur.gouv.fr>
Change-Id: I753dca17461fcc63b555334a05d98fc16a6a6964
@shikanime
shikanime force-pushed the fix/gitlab-trailing-slash branch from f56ccdf to 5d2ce7e Compare August 21, 2026 12:30
KepoParis
KepoParis previously approved these changes Aug 21, 2026
Replace remaining z.string().url() call sites (keycloak openid
configuration, observability chart repository) with the shared
normalizing urlSchema.

Signed-off-by: William Phetsinorath <william.phetsinorath-open@interieur.gouv.fr>
Change-Id: I097736ec36a7ae40641b8547b919f8d96a6a6964
@cloud-pi-native-sonarqube

Copy link
Copy Markdown

@shikanime
shikanime requested a review from KepoParis August 21, 2026 14:00
@shikanime
shikanime enabled auto-merge August 21, 2026 14:00
@shikanime shikanime changed the title fix(gitlab): strip trailing slash from GITLAB_URL to avoid //api/v4 500 refactor(config): normalize all URL env vars via shared urlSchema Aug 21, 2026
@StephaneTrebel
StephaneTrebel requested review from a team and removed request for KepoParis August 24, 2026 08:13
Comment thread apps/server-nestjs/src/config/config.utils.ts
@shikanime
shikanime added this pull request to the merge queue Aug 24, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Aug 24, 2026
@StephaneTrebel
StephaneTrebel added this pull request to the merge queue Aug 26, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Aug 26, 2026
@StephaneTrebel StephaneTrebel modified the milestones: 9.24.5, 9.25.0 Aug 26, 2026
@shikanime
shikanime marked this pull request as draft August 27, 2026 13:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working built

Projects

None yet

Development

Successfully merging this pull request may close these issues.

🐛 [BUG] - Erreur 500 GitLab (//api/v4) lors de la création de groupe/dépôt via serveur NestJS

3 participants