Skip to content

GROW-703 Run onboard-ci gitlab on the server when available - #1325

Closed
alain-kermis-sonarsource wants to merge 1 commit into
masterfrom
ak/GROW-703
Closed

alain-kermis-sonarsource wants to merge 1 commit into
masterfrom
ak/GROW-703

Conversation

@alain-kermis-sonarsource

Copy link
Copy Markdown

Part of GROW-703

sonar admin onboard-ci gitlab now asks the server for GET /api/v2/onboarding/ci-configuration/capabilities and, when runs are enabled, lets the server open the merge requests (same reports, exit codes and flags). Otherwise it keeps the existing client-side path.

  • --server-side / --client-side force a mode.
  • New --repos a,b,c, exclusive with --repos-file.

Backend: https://github.com/SonarSource/sonarqube-unification/pull/2648

Tested: typecheck, lint, unit tests, the onboard-ci-gitlab integration spec, and the server path end to end against a Server instance and GitLab.

🤖 Generated with Claude Code

@netlify

netlify Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for sonarqube-cli canceled.

Name Link
🔨 Latest commit b8c1171
🔍 Latest deploy log https://app.netlify.com/projects/sonarqube-cli/deploys/6b001d10e8c1c1d5d04b9738

@hashicorp-vault-sonar-prod

hashicorp-vault-sonar-prod Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

GROW-703

@gitar-bot

gitar-bot Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Code Review ⚠️ Changes requested 🔴 High risk 0 closed / 5 findings

Delegating GitLab merge-request creation to SonarQube sends it a personal access token, so mishandling could expose repository write authority.

Adds server-side onboarding for sonar admin onboard-ci gitlab, which asks the server for capabilities and lets it open merge requests when runs are enabled, with --server-side/--client-side overrides and a new --repos flag. Changes are requested: the GitLab token is only redacted on 400 create errors, so non-400 response bodies could echo it to the terminal and logs. The progress bar can also render N/0 when the first poll is already terminal. Several findings are merge conflicts with #1318 (a removed users permission call, missing option fields, and mrUrl vs prUrl report keys) that need resolving on rebase.

ℹ️ Cross-PR: Client-side preflight calls a permission API that #1318 removes

📄 src/commands/admin/onboard-ci/gitlab/index.ts:246-249

Breaks when both this PR and #1318 merge (in either order) and the GitLab client-side path runs, either through --client-side or because the capability probe fell back.

How

  1. This PR keeps preflight calling sqsClient.users.hasProvisionProjectsPermission() on OnboardCiSqsClient from ./sqs-api.ts (src/commands/admin/onboard-ci/gitlab/index.ts:247-248).
  2. #1318 moves the client to src/commands/admin/onboard-ci/sqs-api.ts, which exposes only bindings and components and has no users member (sqs-api.ts:31).
  3. #1318 moves the permission check into the command tree instead (assertProvisionProjectsPermission in command-tree.ts), so the call kept in preflight no longer compiles.

Fix

  • This PR: Remove the users permission check from preflight and rely on #1318's command-tree check. Import OnboardCiSqsClient from ../sqs-api.ts.
  • #1318: Nothing needed, beyond keeping assertProvisionProjectsPermission ahead of the GitLab action so the client-side path is still guarded.

Compared b8c1171 with #1318 at 7e6eb6e

ℹ️ Cross-PR: #1318's GitLab options type lacks repos, clientSide, serverSide fields

📄 src/commands/admin/onboard-ci/gitlab/types.ts:43-45 📄 src/commands/admin/onboard-ci/gitlab/server-side.ts:124

Breaks when both this PR and #1318 merge and #1318's refactored OnboardCiGitlabOptions replaces the one this PR extends.

How

  1. This PR adds repos, clientSide and serverSide to OnboardCiGitlabOptions (src/commands/admin/onboard-ci/gitlab/types.ts:43-45). assertSelectionFlags, shouldRunServerSide and resolveSelectedRepoEntries all read these fields.
  2. In #1318, OnboardCiGitlabOptions extends OnboardCiOptions, which declares only bindingName, reposFile and dryRun? (src/commands/admin/onboard-ci/types.ts). None of the new fields is there.
  3. #1318 also makes dryRun optional, but buildCreateRunRequest assigns options.dryRun to CreateCiConfigurationRunRequest.dryRun: boolean (server-side.ts:124).

Fix

  • This PR: After rebasing, declare repos?, clientSide? and serverSide? on the refactored interface (or on the shared OnboardCiOptions if GitHub should get --repos too). Send dryRun: options.dryRun === true.
  • #1318: Nothing needed.

Compared b8c1171 with #1318 at 7e6eb6e

ℹ️ Cross-PR: Server-side results use mrUrl while #1318 shares prUrl

📄 src/commands/admin/onboard-ci/gitlab/server-side.ts:216-230 📄 src/commands/admin/onboard-ci/gitlab/server-side.ts:261-270

Breaks when both this PR and #1318 merge and onboardCiGitlabServerSide writes its report.

How

  1. This PR's toResults builds opened/skipped entries with mrUrl (src/commands/admin/onboard-ci/gitlab/server-side.ts:221-232) and passes them straight to writeReportFile (server-side.ts:268).
  2. #1318 changes the shared OpenedResult/SkippedResult to carry prUrl (src/commands/admin/onboard-ci/types.ts:32), so the server-side entries no longer type-check.
  3. #1318 keeps the published mrUrl report key only through a mapping in the client-side live path (src/commands/admin/onboard-ci/gitlab/index.ts:400-404). Renaming the server-side fields to prUrl without that mapping changes the GitLab report key.

Fix

  • This PR: Build results with prUrl, then reuse a shared helper that maps prUrl back to mrUrl before writeReportFile. Also import writeReportFile from #1318's shared.ts.
  • #1318: Pull the prUrl → mrUrl report mapping out into an exported GitLab helper so both paths can share it.

Compared b8c1171 with #1318 at 7e6eb6e

💡 Security: GitLab token is redacted from 400 create errors only

📄 src/commands/admin/onboard-ci/gitlab/server-side.ts:133-141 📄 src/core/server/http-client.ts:162-165

createRun replaces the GitLab PAT with *** only when the error is a BadRequestError. For any other non-2xx POST response (409, 422, 500, ...), SonarHttpClient.buildStatusError builds the message as SonarQube API error: <status> <text> - ${errorText}, i.e. it includes the raw response body (http-client.ts:162-165). translateAccessError then passes that error through unchanged. So if the server echoes the request credential in a non-400 error body, the token reaches the terminal and the logs. That is the exact case the redaction and the 'never surfaces the GitLab token, even if the server echoes it' test are meant to guard against. Apply the redaction to every error that comes out of createRun, not just the 400 branch.

Redact the token from any error that comes out of the create call
} catch (error) {
  const redact = (text: string) => text.replaceAll(request.credential.token, '***');
  if (error instanceof BadRequestError) {
    throw new CommandFailedError(redact(error.message), { exitCode: EXIT_CODE_VALIDATION });
  }
  const translated = translateAccessError(error);
  if (translated instanceof CommandFailedError) throw translated;
  throw new CommandFailedError(redact(translated.message));
}
💡 Edge Case: Progress bar shows N/0 when the first poll is already terminal

📄 src/commands/admin/onboard-ci/gitlab/run-progress.ts:52-66 📄 src/commands/admin/onboard-ci/gitlab/server-side.ts:157-159

RunProgress.setTotal is only called from report(), and pollRun skips report() when the first getRun already returns a terminal status (a fast or small run, or a dry run). In that case complete() sets skippedResolved = counts.total - 1 and marks the row done while total is still 0. In TTY mode formatBar then renders 100% <counts.total>/0. The total can also be stale if the server's count changed after the last non-terminal poll. Call setTotal in complete() as well.

Set the total from the terminal run before finishing
complete(run: CiConfigurationRun): void {
  const failed = run.status === 'FAILED';
  const total = Math.max(1, run.counts.total);
  this.setTotal(total);
  // The row itself counts as one resolved item once done; keep the bar at exactly 100%.
  this.skippedResolved = total - 1;
  this.update(RUN_ROW, failed ? 'failed' : 'done', formatRunCounts(run.counts, run.dryRun));
  this.finish();
}
🤖 Prompt for agents
Code Review: Adds server-side onboarding for `sonar admin onboard-ci gitlab`, which asks the server for capabilities and lets it open merge requests when runs are enabled, with `--server-side`/`--client-side` overrides and a new `--repos` flag. Changes are requested: the GitLab token is only redacted on 400 create errors, so non-400 response bodies could echo it to the terminal and logs. The progress bar can also render `N/0` when the first poll is already terminal. Several findings are merge conflicts with #1318 (a removed `users` permission call, missing option fields, and `mrUrl` vs `prUrl` report keys) that need resolving on rebase.

1. 💡 Security: GitLab token is redacted from 400 create errors only
   Files: src/commands/admin/onboard-ci/gitlab/server-side.ts:133-141, src/core/server/http-client.ts:162-165

   `createRun` replaces the GitLab PAT with `***` only when the error is a `BadRequestError`. For any other non-2xx POST response (409, 422, 500, ...), `SonarHttpClient.buildStatusError` builds the message as `SonarQube API error: <status> <text> - ${errorText}`, i.e. it includes the raw response body (http-client.ts:162-165). `translateAccessError` then passes that error through unchanged. So if the server echoes the request credential in a non-400 error body, the token reaches the terminal and the logs. That is the exact case the redaction and the 'never surfaces the GitLab token, even if the server echoes it' test are meant to guard against. Apply the redaction to every error that comes out of `createRun`, not just the 400 branch.

   Fix (Redact the token from any error that comes out of the create call):
   } catch (error) {
     const redact = (text: string) => text.replaceAll(request.credential.token, '***');
     if (error instanceof BadRequestError) {
       throw new CommandFailedError(redact(error.message), { exitCode: EXIT_CODE_VALIDATION });
     }
     const translated = translateAccessError(error);
     if (translated instanceof CommandFailedError) throw translated;
     throw new CommandFailedError(redact(translated.message));
   }

2. 💡 Edge Case: Progress bar shows N/0 when the first poll is already terminal
   Files: src/commands/admin/onboard-ci/gitlab/run-progress.ts:52-66, src/commands/admin/onboard-ci/gitlab/server-side.ts:157-159

   `RunProgress.setTotal` is only called from `report()`, and `pollRun` skips `report()` when the first `getRun` already returns a terminal status (a fast or small run, or a dry run). In that case `complete()` sets `skippedResolved = counts.total - 1` and marks the row done while `total` is still 0. In TTY mode `formatBar` then renders `100% <counts.total>/0`. The total can also be stale if the server's count changed after the last non-terminal poll. Call `setTotal` in `complete()` as well.

   Fix (Set the total from the terminal run before finishing):
   complete(run: CiConfigurationRun): void {
     const failed = run.status === 'FAILED';
     const total = Math.max(1, run.counts.total);
     this.setTotal(total);
     // The row itself counts as one resolved item once done; keep the bar at exactly 100%.
     this.skippedResolved = total - 1;
     this.update(RUN_ROW, failed ? 'failed' : 'done', formatRunCounts(run.counts, run.dryRun));
     this.finish();
   }

3. ℹ️ Cross-PR: Client-side preflight calls a permission API that [#1318](<https://github.com/SonarSource/sonarqube-cli/pull/1318>) removes
   Files: src/commands/admin/onboard-ci/gitlab/index.ts:246-249

   **Breaks when** both this PR and [#1318](<https://github.com/SonarSource/sonarqube-cli/pull/1318>) merge (in either order) and the GitLab client-side path runs, either through `--client-side` or because the capability probe fell back.
   
   **How**
   
   1. This PR keeps `preflight` calling `sqsClient.users.hasProvisionProjectsPermission()` on `OnboardCiSqsClient` from `./sqs-api.ts` (`src/commands/admin/onboard-ci/gitlab/index.ts:247-248`).
   2. [#1318](<https://github.com/SonarSource/sonarqube-cli/pull/1318>) moves the client to `src/commands/admin/onboard-ci/sqs-api.ts`, which exposes only `bindings` and `components` and has no `users` member (`sqs-api.ts:31`).
   3. [#1318](<https://github.com/SonarSource/sonarqube-cli/pull/1318>) moves the permission check into the command tree instead (`assertProvisionProjectsPermission` in `command-tree.ts`), so the call kept in `preflight` no longer compiles.
   
   **Fix**
   
   - **This PR:** Remove the `users` permission check from `preflight` and rely on [#1318](<https://github.com/SonarSource/sonarqube-cli/pull/1318>)'s command-tree check. Import `OnboardCiSqsClient` from `../sqs-api.ts`.
   - **[#1318](<https://github.com/SonarSource/sonarqube-cli/pull/1318>):** Nothing needed, beyond keeping `assertProvisionProjectsPermission` ahead of the GitLab action so the client-side path is still guarded.
   
   _Compared `b8c1171` with [#1318](<https://github.com/SonarSource/sonarqube-cli/pull/1318>) at `7e6eb6e`_

4. ℹ️ Cross-PR: [#1318](<https://github.com/SonarSource/sonarqube-cli/pull/1318>)'s GitLab options type lacks repos, clientSide, serverSide fields
   Files: src/commands/admin/onboard-ci/gitlab/types.ts:43-45, src/commands/admin/onboard-ci/gitlab/server-side.ts:124

   **Breaks when** both this PR and [#1318](<https://github.com/SonarSource/sonarqube-cli/pull/1318>) merge and [#1318](<https://github.com/SonarSource/sonarqube-cli/pull/1318>)'s refactored `OnboardCiGitlabOptions` replaces the one this PR extends.
   
   **How**
   
   1. This PR adds `repos`, `clientSide` and `serverSide` to `OnboardCiGitlabOptions` (`src/commands/admin/onboard-ci/gitlab/types.ts:43-45`). `assertSelectionFlags`, `shouldRunServerSide` and `resolveSelectedRepoEntries` all read these fields.
   2. In [#1318](<https://github.com/SonarSource/sonarqube-cli/pull/1318>), `OnboardCiGitlabOptions extends OnboardCiOptions`, which declares only `bindingName`, `reposFile` and `dryRun?` (`src/commands/admin/onboard-ci/types.ts`). None of the new fields is there.
   3. [#1318](<https://github.com/SonarSource/sonarqube-cli/pull/1318>) also makes `dryRun` optional, but `buildCreateRunRequest` assigns `options.dryRun` to `CreateCiConfigurationRunRequest.dryRun: boolean` (`server-side.ts:124`).
   
   **Fix**
   
   - **This PR:** After rebasing, declare `repos?`, `clientSide?` and `serverSide?` on the refactored interface (or on the shared `OnboardCiOptions` if GitHub should get `--repos` too). Send `dryRun: options.dryRun === true`.
   - **[#1318](<https://github.com/SonarSource/sonarqube-cli/pull/1318>):** Nothing needed.
   
   _Compared `b8c1171` with [#1318](<https://github.com/SonarSource/sonarqube-cli/pull/1318>) at `7e6eb6e`_

5. ℹ️ Cross-PR: Server-side results use mrUrl while [#1318](<https://github.com/SonarSource/sonarqube-cli/pull/1318>) shares prUrl
   Files: src/commands/admin/onboard-ci/gitlab/server-side.ts:216-230, src/commands/admin/onboard-ci/gitlab/server-side.ts:261-270

   **Breaks when** both this PR and [#1318](<https://github.com/SonarSource/sonarqube-cli/pull/1318>) merge and `onboardCiGitlabServerSide` writes its report.
   
   **How**
   
   1. This PR's `toResults` builds `opened`/`skipped` entries with `mrUrl` (`src/commands/admin/onboard-ci/gitlab/server-side.ts:221-232`) and passes them straight to `writeReportFile` (`server-side.ts:268`).
   2. [#1318](<https://github.com/SonarSource/sonarqube-cli/pull/1318>) changes the shared `OpenedResult`/`SkippedResult` to carry `prUrl` (`src/commands/admin/onboard-ci/types.ts:32`), so the server-side entries no longer type-check.
   3. [#1318](<https://github.com/SonarSource/sonarqube-cli/pull/1318>) keeps the published `mrUrl` report key only through a mapping in the client-side live path (`src/commands/admin/onboard-ci/gitlab/index.ts:400-404`). Renaming the server-side fields to `prUrl` without that mapping changes the GitLab report key.
   
   **Fix**
   
   - **This PR:** Build results with `prUrl`, then reuse a shared helper that maps `prUrl` back to `mrUrl` before `writeReportFile`. Also import `writeReportFile` from [#1318](<https://github.com/SonarSource/sonarqube-cli/pull/1318>)'s `shared.ts`.
   - **[#1318](<https://github.com/SonarSource/sonarqube-cli/pull/1318>):** Pull the `prUrl` → `mrUrl` report mapping out into an exported GitLab helper so both paths can share it.
   
   _Compared `b8c1171` with [#1318](<https://github.com/SonarSource/sonarqube-cli/pull/1318>) at `7e6eb6e`_

Verification Rules 2/2 met PRs 3 inspected

Functional validation No results

Rules 2 passed 2 not applicable

✅ Internal artifact registries
✅ Repository license compliance

Broader impact PRs 3 inspected
Cross-PR 3 PRs inspected 3 open impacts

PR 1318: CLI-1557 Add bulk GitHub CI onboarding command Inspected
PR 1296: CLI-1554 Share Server integration discovery for GitHub onboarding Inspected
PR 1295: CLI-1553 Add GitHub API client and shared DevOps token input Inspected

Auto-approval Withheld

For more verification details, comment gitar display:verbose.

Options

Auto-apply is off → Gitar will not commit updates to this branch.
Display: compact → Showing compact verification results.
Unblock → Override a blocking verdict and allow merging.

Comment with these commands to change the behavior for this request:

Auto-apply Compact Unblock
gitar auto-apply:on         
gitar display:verbose         
gitar unblock         

Was this helpful? React with 👍 / 👎 | Gitar

Comment on lines +133 to +141
try {
return (await client.createRun(request).orThrow()).id;
} catch (error) {
if (error instanceof BadRequestError) {
const message = error.message.replaceAll(request.credential.token, '***');
throw new CommandFailedError(message, { exitCode: EXIT_CODE_VALIDATION });
}
throw translateAccessError(error);
}

@gitar-bot gitar-bot Bot Nov 20, 2026 •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Security: GitLab token is redacted from 400 create errors only

createRun replaces the GitLab PAT with *** only when the error is a BadRequestError. For any other non-2xx POST response (409, 422, 500, ...), SonarHttpClient.buildStatusError builds the message as SonarQube API error: <status> <text> - ${errorText}, i.e. it includes the raw response body (http-client.ts:162-165). translateAccessError then passes that error through unchanged. So if the server echoes the request credential in a non-400 error body, the token reaches the terminal and the logs. That is the exact case the redaction and the 'never surfaces the GitLab token, even if the server echoes it' test are meant to guard against. Apply the redaction to every error that comes out of createRun, not just the 400 branch.

Redact the token from any error that comes out of the create call:

} catch (error) {
  const redact = (text: string) => text.replaceAll(request.credential.token, '***');
  if (error instanceof BadRequestError) {
    throw new CommandFailedError(redact(error.message), { exitCode: EXIT_CODE_VALIDATION });
  }
  const translated = translateAccessError(error);
  if (translated instanceof CommandFailedError) throw translated;
  throw new CommandFailedError(redact(translated.message));
}

Was this helpful? React with 👍 / 👎

Comment on lines +52 to +66
report(run: CiConfigurationRun): void {
const { counts } = run;
const detail = formatRunCounts(counts, run.dryRun);
this.setTotal(counts.total);
this.skippedResolved = Math.max(0, counts.total - counts.queued - counts.running);
this.update(RUN_ROW, 'running', detail);
if (!this.isTTY && detail !== this.lastDetail) {
this.output.info(detail);
}
this.lastDetail = detail;
}

complete(run: CiConfigurationRun): void {
const failed = run.status === 'FAILED';
// The row itself counts as one resolved item once done; keep the bar at exactly 100%.

@gitar-bot gitar-bot Bot Nov 20, 2026 •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Edge Case: Progress bar shows N/0 when the first poll is already terminal

RunProgress.setTotal is only called from report(), and pollRun skips report() when the first getRun already returns a terminal status (a fast or small run, or a dry run). In that case complete() sets skippedResolved = counts.total - 1 and marks the row done while total is still 0. In TTY mode formatBar then renders 100% <counts.total>/0. The total can also be stale if the server's count changed after the last non-terminal poll. Call setTotal in complete() as well.

Set the total from the terminal run before finishing:

complete(run: CiConfigurationRun): void {
  const failed = run.status === 'FAILED';
  const total = Math.max(1, run.counts.total);
  this.setTotal(total);
  // The row itself counts as one resolved item once done; keep the bar at exactly 100%.
  this.skippedResolved = total - 1;
  this.update(RUN_ROW, failed ? 'failed' : 'done', formatRunCounts(run.counts, run.dryRun));
  this.finish();
}

Was this helpful? React with 👍 / 👎

Comment on lines +246 to 249
const { httpClient } = connection;
const sqsClient = new OnboardCiSqsClient(httpClient);
if (!(await sqsClient.users.hasProvisionProjectsPermission().orThrow())) {
throw new CommandFailedError(

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ℹ️ Cross-PR: Client-side preflight calls a permission API that #1318 removes

Breaks when both this PR and #1318 merge (in either order) and the GitLab client-side path runs, either through --client-side or because the capability probe fell back.

How

  1. This PR keeps preflight calling sqsClient.users.hasProvisionProjectsPermission() on OnboardCiSqsClient from ./sqs-api.ts (src/commands/admin/onboard-ci/gitlab/index.ts:247-248).
  2. #1318 moves the client to src/commands/admin/onboard-ci/sqs-api.ts, which exposes only bindings and components and has no users member (sqs-api.ts:31).
  3. #1318 moves the permission check into the command tree instead (assertProvisionProjectsPermission in command-tree.ts), so the call kept in preflight no longer compiles.

Fix

  • This PR: Remove the users permission check from preflight and rely on #1318's command-tree check. Import OnboardCiSqsClient from ../sqs-api.ts.
  • #1318: Nothing needed, beyond keeping assertProvisionProjectsPermission ahead of the GitLab action so the client-side path is still guarded.

Compared b8c1171 with #1318 at 7e6eb6e

Was this helpful? React with 👍 / 👎

Comment on lines +43 to +45
repos?: string;
clientSide?: boolean;
serverSide?: boolean;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ℹ️ Cross-PR: #1318's GitLab options type lacks repos, clientSide, serverSide fields

Breaks when both this PR and #1318 merge and #1318's refactored OnboardCiGitlabOptions replaces the one this PR extends.

How

  1. This PR adds repos, clientSide and serverSide to OnboardCiGitlabOptions (src/commands/admin/onboard-ci/gitlab/types.ts:43-45). assertSelectionFlags, shouldRunServerSide and resolveSelectedRepoEntries all read these fields.
  2. In #1318, OnboardCiGitlabOptions extends OnboardCiOptions, which declares only bindingName, reposFile and dryRun? (src/commands/admin/onboard-ci/types.ts). None of the new fields is there.
  3. #1318 also makes dryRun optional, but buildCreateRunRequest assigns options.dryRun to CreateCiConfigurationRunRequest.dryRun: boolean (server-side.ts:124).

Fix

  • This PR: After rebasing, declare repos?, clientSide? and serverSide? on the refactored interface (or on the shared OnboardCiOptions if GitHub should get --repos too). Send dryRun: options.dryRun === true.
  • #1318: Nothing needed.

Compared b8c1171 with #1318 at 7e6eb6e

Was this helpful? React with 👍 / 👎

Comment on lines +216 to +230
function toResults(items: CiRunItem[]): OnboardCiResults {
const results: OnboardCiResults = { opened: [], skipped: [], failed: [] };
for (const item of items) {
const repo = item.repository;
const skipReason = toSkipReason(item.skipReason);
if (item.status === 'OPENED') {
results.opened.push({
repo,
projectKey: item.projectKey ?? '',
mrUrl: item.mergeRequestUrl ?? '',
});
} else if (item.status === 'SKIPPED' && skipReason) {
results.skipped.push({
repo,
reason: skipReason,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ℹ️ Cross-PR: Server-side results use mrUrl while #1318 shares prUrl

Breaks when both this PR and #1318 merge and onboardCiGitlabServerSide writes its report.

How

  1. This PR's toResults builds opened/skipped entries with mrUrl (src/commands/admin/onboard-ci/gitlab/server-side.ts:221-232) and passes them straight to writeReportFile (server-side.ts:268).
  2. #1318 changes the shared OpenedResult/SkippedResult to carry prUrl (src/commands/admin/onboard-ci/types.ts:32), so the server-side entries no longer type-check.
  3. #1318 keeps the published mrUrl report key only through a mapping in the client-side live path (src/commands/admin/onboard-ci/gitlab/index.ts:400-404). Renaming the server-side fields to prUrl without that mapping changes the GitLab report key.

Fix

  • This PR: Build results with prUrl, then reuse a shared helper that maps prUrl back to mrUrl before writeReportFile. Also import writeReportFile from #1318's shared.ts.
  • #1318: Pull the prUrl → mrUrl report mapping out into an exported GitLab helper so both paths can share it.

Compared b8c1171 with #1318 at 7e6eb6e

Was this helpful? React with 👍 / 👎

@sonarqubecloud

Copy link
Copy Markdown

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