Source Discovery & Connection Testing
Overview
When configuring a source, users can click "Test Connection" to validate credentials and auto-discover available projects/repositories, instead of entering project IDs manually.
How it works
- The frontend sends a
POST /discover-projectsrequest with source credentials. - The backend dispatches to the provider-specific service (GitLab, GitHub, Bitbucket, FTP).
- For Git providers, the response includes the authenticated username and a list of accessible projects.
- An autocomplete dropdown lets the user select a project.
- For FTP, the test creates a temporary
.bcyip_testdirectory, writes a file, then deletes it — verifying full Read/Write/Delete permissions. - Connection errors display the exact failing URL in a styled code block to help debug 401/403/404.
Auto-discovered username (GitHub/GitLab)
- The
tokenNamefield is hidden for GitHub/GitLab; the username is auto-retrieved from/useron "Test Connection". - Displayed as "Connected as {username}"; persisted as
username:token_valuefor clone auth. - Bitbucket and FTP keep manual fields (email / username).
GitLab project name persistence
path_with_namespaceis stored aslabelin the project config when a GitLab project is selected.- Used in the summary page, init report, and webhook context — no extra API call needed.
Key files
src/app.controller.ts—POST /discover-projectsendpointsrc/protocol/source/source.service.ts— Unified discovery dispatch + error URL enrichmentsrc/protocol/capacities/ftp-capacity/ftp-capacity.service.ts— FTP write permission testui/src/pages/workflows/stepForms/StepInitForm.tsx— Test Connection UI + auto-discoverui/src/utils/format.ts—ProjectFormatter.unkeyincludeslabel
Technical decisions
DiscoverSourceParamsprovides a uniform interface across all providers.- FTP test uses absolute paths to avoid CWD issues on various server configurations.
ConfiguratorService/StateInterceptorfixed to prevent premature "Ready" state when only partial config is saved.