Chapter 18Lesson 05~180 minutes

Checkpoint Lab — GitHub, GitLab, Azure DevOps, and Bitbucket Integration

Produce a least-privilege four-provider integration design and one safe end-to-end simulated decoration flow with permission, evidence, revocation, and cleanup proof.

GitHubGitLabAzure DevOpsBitbucketLeast privilege

Learning objectives

  • Produce a four-provider least-privilege integration design with explicit identities, scopes, endpoints, storage, and revocation.
  • Execute a real Community Build analysis and one safe simulated provider-decoration flow.
  • Predict and verify at least two independent state changes before execution.
  • Diagnose one deliberate provider-permission defect without changing source, gate, profile, or project key.
  • Package revision, task, gate, permission, simulated provider, and cleanup evidence.
  • Bridge provider trust design into Chapter 19’s CI-runner integration.

1. Checkpoint scenario

You are designing SonarQube integration for four teams that use GitHub, GitLab, Azure DevOps, and Bitbucket Cloud. Production credentials do not exist yet. Your deliverable must contain:

  1. a least-privilege provider-integration design for all four platforms;
  2. one real local SonarQube analysis using sq-ch18-provider-lab;
  3. one local GitHub-style decoration simulation driven by the real Quality Gate;
  4. one deliberate provider-scope failure and repair;
  5. an optional Developer+ sandbox procedure, or an explicit unexecuted limitation;
  6. credential/revocation and cleanup evidence.

2. Exact version/edition assumptions

Component Checkpoint assumption
Community Build 26.9.0.129388
Commercial reference Server 2026 Release 4.1; 2026.1.5 LTA
Scanner SonarScanner CLI 8.1.0.6389
Java/JRE Record scanner-reported runtime; modern scanner JRE auto-provisioning may apply
Database/plugins No change required
CI/provider No paid CI/provider sandbox required for mandatory path
Native PR decoration Developer+ only; simulated in mandatory path
Identity Fake provider org/repo names; real disposable SonarQube project token only

3. Provider integration design dossier

Create provider-design.md with one row per provider:

Provider Identity Minimum integration scope Secret storage Revocation
GitHub Dedicated GitHub App Checks RW, PR RW, Metadata R, private Contents R; optional permissions only when feature requires them SonarQube sensitive GitHub configuration Rotate/revoke App key/secret or uninstall from repository/org
GitLab Dedicated Reporter account PAT or Group Access Token api for global integration/decoration on required repositories; narrower import flow where documented SonarQube sensitive GitLab configuration Revoke token / disable technical identity
Azure DevOps Dedicated technical account PAT Code read/write for decoration; extension/service endpoint separately owned SonarQube Azure configuration / Azure service connection secrets Revoke PAT; create/test replacement before expiry
Bitbucket Cloud OAuth Client + import API token Client credentials + Pull requests Read; import token read:repository:bitbucket SonarQube sensitive Bitbucket configuration Rotate OAuth secret / revoke API token

Also record Server base URL/callback expectations and whether provider webhooks are actually required. Do not invent a webhook merely because the provider supports them.

4. Predictions before execution

  • Prediction A: the real Community Build scanner run will create a ceTaskId; after CE success, the project will have a queryable Quality Gate state.
  • Prediction B: changing only simulated provider checks permission from read_write to read will not change SonarQube analysis/gate evidence, but the provider simulator will fail.
  • Prediction C: restoring the permission contract will produce a local simulated provider check whose conclusion maps to the real gate.
  • Prediction D: no native PR decoration will exist on Community Build; the packet must say so explicitly.

5. Execute the analysis and preserve the asynchronous chain

export SONAR_HOST_URL="http://localhost:9000"
export SONAR_PROJECT_KEY="sq-ch18-provider-lab"
mkdir -p evidence/checkpoint/sonar evidence/checkpoint/provider

git rev-parse HEAD | tee evidence/checkpoint/sonar/revision.txt
sonar-scanner -X 2>&1 | tee evidence/checkpoint/sonar/scanner.log
cp .scannerwork/report-task.txt evidence/checkpoint/sonar/report-task.txt

CE_TASK_ID="$(sed -n 's/^ceTaskId=//p' .scannerwork/report-task.txt)"
echo "$CE_TASK_ID" | tee evidence/checkpoint/sonar/ce-task-id.txt

curl -fsS -H "Authorization: Bearer $SONAR_TOKEN" \
  "$SONAR_HOST_URL/api/ce/task?id=$CE_TASK_ID" \
  | tee evidence/checkpoint/sonar/ce-task.json

curl -fsS -H "Authorization: Bearer $SONAR_TOKEN" \
  "$SONAR_HOST_URL/api/qualitygates/project_status?projectKey=$SONAR_PROJECT_KEY" \
  | tee evidence/checkpoint/sonar/gate.json

Do not continue until CE is terminal. Scanner exit, upload, CE, analysis completion, gate, CI job, and provider decoration remain separate states.

6. Simulated binding, failure, and repair

Reuse Lesson 2’s binding.json and provider_sim.py, but copy them into evidence/checkpoint/provider/. Run three steps:

  1. Good contract: Checks RW + Pull Requests RW → provider check generated.
  2. Broken contract: Checks Read only → preserve SIMULATED_PROVIDER_403.
  3. Repair: restore only Checks RW → regenerate provider check.

Hash the relevant evidence to prove the SonarQube gate did not change during provider-only failure/repair:

sha256sum evidence/checkpoint/sonar/revision.txt \
  evidence/checkpoint/sonar/report-task.txt \
  evidence/checkpoint/sonar/gate.json \
  | tee evidence/checkpoint/sonar/evidence.sha256

7. Optional real Developer+ sandbox flow

If an authorized sandbox exists, choose one provider—not all four. Create the minimum provider identity, bind/import the disposable repository, run a PR/MR analysis in supported CI, and preserve:

  • provider organization/repository ID;
  • app/token identity and scopes with values redacted;
  • SonarQube binding/configuration name;
  • commit SHA, PR/MR key and target;
  • ceTaskId and CE status;
  • Quality Gate;
  • provider check/comment/status ID and timestamp;
  • credential revocation/uninstall audit evidence.
Free fallback: if no Developer+ sandbox exists, write native_provider_decoration=NOT_EXECUTED_EDITION_OR_SANDBOX_UNAVAILABLE. Do not substitute a production repository.

8. Required evidence packet

Minimum packet contents
  • assumptions.md: versions, edition, local URL, scanner/runtime, no production providers.
  • provider-design.md: all four provider identities/scopes/storage/revocation paths.
  • revision, scanner log, report-task, ceTaskId, CE response, and Quality Gate response.
  • fake provider binding manifest and good simulated check.
  • broken permission manifest/log and repaired check.
  • provider-vs-SonarQube credential ownership note.
  • optional native sandbox provider evidence or explicit unexecuted limitation.
  • credential revocation/cleanup checklist.

9. Verification checklist

  • ☐ Exact source SHA is recorded.
  • ☐ Scanner/server versions and ceTaskId are recorded.
  • ☐ Gate was queried only after Compute Engine success.
  • ☐ Provider identities/scopes differ appropriately across GitHub/GitLab/Azure/Bitbucket.
  • ☐ No provider credential value exists in the packet.
  • ☐ Deliberate provider failure leaves SonarQube analysis/gate evidence unchanged.
  • ☐ Repair changes only the required provider permission contract.
  • ☐ Native decoration is labeled Developer+ and not attributed to Community Build.
  • ☐ Bitbucket’s current OAuth Client/API-token transition is documented.
  • ☐ SonarQube project token is revoked and revocation verified.

10. Cleanup and rollback

  • Revoke the disposable SonarQube project-analysis token and verify a read requiring that token fails.
  • Delete the disposable local SonarQube project only after exporting the packet and only if you created it solely for this checkpoint.
  • The mandatory provider path created no real provider credentials; record that explicitly.
  • If the optional sandbox path was executed, revoke/uninstall its app/token/client after evidence capture.
  • Do not delete shared provider apps, organization integrations, global SonarQube configurations, unrelated CI service endpoints, or source repositories.

11. What Chapter 18 adds to the operating model

Chapter 18 adds provider trust governance: each provider result can now be traced from repository/PR identity through a dedicated integration credential and SonarQube binding to a specific analysis task, Quality Gate, provider check, audit record, and revocation path. “The integration works” is no longer sufficient; the identity and permission boundary are evidence.

Chapter 19 continues into CI Integration with GitHub Actions, GitLab CI, Jenkins, and Other Runners, where checkout depth, runner caches, secret injection, scanner invocation, gate enforcement, and job-status behavior become the primary operational focus.

Knowledge check

What two credentials must never be conflated in the checkpoint?

What does the unchanged gate hash during simulated provider failure prove?

Which real provider should be used for the optional sandbox path?

What must the packet say when only Community Build is available?

Why is cleanup incomplete if you only unset environment variables?

What is the Chapter 19 bridge?

Next lesson — Next chapter

CI Integration with GitHub Actions, GitLab CI, Jenkins, and Other Runners

Chapter 19 moves from provider trust into CI runner checkout, caching, scanner invocation, secret injection, and Quality Gate enforcement.

Official references and version notes

Version and compatibility note

Rechecked 2026-09-08. Mandatory examples target Community Build 26.9.0.129388 and SonarScanner CLI 8.1.0.6389; current commercial reference points are SonarQube Server 2026 Release 4.1 and 2026.1.5 LTA. Native feature/maintenance branch and pull/merge-request analysis plus provider decoration start in Developer Edition. GitHub integration uses a GitHub App with explicit repository permissions; GitLab global integration uses a dedicated Reporter-capable personal/group token with api scope; Azure DevOps uses a dedicated technical PAT and Azure DevOps Extension/service endpoint; Bitbucket Cloud is currently transitioning terminology/credentials, with API tokens replacing App passwords for import and current provider UI using OAuth Clients even where some Sonar documentation still says OAuth Consumer. Multiple configurations/instances and several monorepo/enterprise integration capabilities begin in Enterprise. Recheck provider UI, token deprecations, patch notes, callback/base URL requirements, and exact permissions before production rollout.

Keep the academy open

Support free, practical DevOps education.

Every lesson is designed to remain readable in a browser, downloadable from GitHub, and usable without a paid learning platform. Contributions help expand and maintain the curriculum.

Ethereum / ERC-20
0x716c4Ab160C4B66F31a28AE2448BfF68fc3a2ef0Send only Ethereum/ERC-20 compatible assets to this address.