You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
On self-hosted GitLab, APM org-policy auto-discovery can never resolve, because every candidate repository name in the discovery cascade is an invalid GitLab project path.
Per the Policy Files docs, discovery probes, in order: .github-private → .github → .apm → _apm. GitLab rejects any project path that starts with ., _, or -:
Path can only include non-accented letters, digits, '', '-' and '.'. It must not start with '-', '', or '.', nor end with '-', '_', '.', '.git', or '.atom'.
So none of the four candidates can be created:
Candidate
Valid on GitLab?
Reason
.github-private
❌
leading .
.github
❌
leading .
.apm
❌
leading .
_apm
❌
leading _
This is stricter than Azure DevOps (#2429): ADO forbids a leading _ only on the project name, so PR #2450 could keep repository _apm inside project apm. On GitLab the _apm fallback is also invalid, so there is no working coordinate at all. Additionally, probing these paths on our host surfaces an HTTP 410, which prints a policy-fetch warning on every apm install / apm audit (inconsistent with the docs stating GitLab "falls through with no policy applied").
To Reproduce
Steps to reproduce the behavior:
On a project whose origin is a self-hosted GitLab remote (git@gitlab.example.com:<group>/<repo>.git), run command apm audit --ci (without --no-policy), or apm install.
With parameters: default org-policy auto-discovery (no explicit --policy).
See error: a policy-fetch warning (HTTP 410 on our host) and no org policy applied. Then try to create the org policy repo under the group — GitLab rejects .github-private, .github, .apm, and _apm with the path error quoted above.
Expected behavior
A supported way to host and auto-discover org policy on self-hosted GitLab using a valid, configurable GitLab project path (e.g. apm-policy), plus a clean "no policy" outcome (not a 410 warning) when none is present — analogous to the ADO project-coordinate fix in PR #2450, but for GitLab where even _apm is an invalid path.
Environment:
OS: macOS
APM Version: 0.25.0
Git host: self-hosted GitLab (GitLab Enterprise), e.g. gitlab.example.com
Logs
The form contains the following errors:
Project namespace path can only include non-accented letters, digits, '', '-' and '.'. It must not start with '-', '', or '.', nor end with '-', '_', '.', '.git', or '.atom'.
Path can only include non-accented letters, digits, '', '-' and '.'. It must not start with '-', '', or '.', nor end with '-', '_', '.', '.git', or '.atom'.
Additional context
Current mitigation is apm audit --ci --no-policy, which disables policy enforcement entirely.
Proposed direction:
Configurable / host-valid policy repo name (default e.g. apm-policy), mirroring PR fix(policy): use valid ADO project coordinate #2450's ADO project-coordinate fix but for GitLab (where _apm is invalid too).
A GitLab auto-discovery code path (currently documented as "not auto-discovered / falls through with no policy").
Describe the bug
On self-hosted GitLab, APM org-policy auto-discovery can never resolve, because every candidate repository name in the discovery cascade is an invalid GitLab project path.
Per the Policy Files docs, discovery probes, in order:
.github-private→.github→.apm→_apm. GitLab rejects any project path that starts with.,_, or-:So none of the four candidates can be created:
.github-private..github..apm._apm_This is stricter than Azure DevOps (#2429): ADO forbids a leading
_only on the project name, so PR #2450 could keep repository_apminside projectapm. On GitLab the_apmfallback is also invalid, so there is no working coordinate at all. Additionally, probing these paths on our host surfaces an HTTP 410, which prints a policy-fetch warning on everyapm install/apm audit(inconsistent with the docs stating GitLab "falls through with no policy applied").To Reproduce
Steps to reproduce the behavior:
originis a self-hosted GitLab remote (git@gitlab.example.com:<group>/<repo>.git), run commandapm audit --ci(without--no-policy), orapm install.--policy)..github-private,.github,.apm, and_apmwith the path error quoted above.Expected behavior
A supported way to host and auto-discover org policy on self-hosted GitLab using a valid, configurable GitLab project path (e.g.
apm-policy), plus a clean "no policy" outcome (not a 410 warning) when none is present — analogous to the ADO project-coordinate fix in PR #2450, but for GitLab where even_apmis an invalid path.Environment:
gitlab.example.comLogs
The form contains the following errors:
Additional context
Current mitigation is
apm audit --ci --no-policy, which disables policy enforcement entirely.Proposed direction:
apm-policy), mirroring PR fix(policy): use valid ADO project coordinate #2450's ADO project-coordinate fix but for GitLab (where_apmis invalid too).apm install --policy <path-or-url>for install-time enforcement on non-GitHub remotes (tracked more broadly in [FEATURE] Support policy enforcement on non-GitHub remotes: add --policy to apm install (and/or auto-discovery for GitLab/ADO/plain git) #1925).Related:
--policyon install and/or GitLab/ADO/plain-git auto-discovery).