Back to Babylon Js

Azure DevOps Variable Groups Setup

.azure-pipelines/VARIABLE-GROUPS.md

9.5.28.5 KB
Original Source

Azure DevOps Variable Groups Setup

This document describes the variable groups required by the YAML pipelines. All infrastructure-specific values (storage accounts, CDN endpoints, service connections) are stored in variable groups to keep them out of source control.

Variable Group: BabylonJS-CI-Infrastructure

Create this variable group in Azure DevOps → Pipelines → Library and link it to every pipeline that references it.

Core Infrastructure

VariableDescriptionExample
SNAPSHOTS_STORAGE_ACCOUNTAzure Storage account for PR/branch snapshotsmystorageaccount
TOOLS_STORAGE_ACCOUNTAzure Storage account for production tool deploymentsmytoolsaccount
SNAPSHOT_CDN_URLBase URL of the snapshot CDN (no trailing slash)https://my-cdn.example.net
GITHUB_SERVICE_CONNECTIONGitHub service connection ID for GitHubComment and GitHubRelease tasksxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
DEVOPS_PROJECT_IDAzure DevOps project GUID (used for cross-project artifact downloads)xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
BOT_EMAILEmail address used for automated git commits in the publish pipeline[email protected]

Deployment Server API Endpoints

These are the API endpoint paths on the deployment server. Storing them as variables hides the server's API surface from public source code.

VariableDescription
DEPLOY_ENDPOINT_UPLOADFile upload endpoint path
DEPLOY_ENDPOINT_DELETESnapshot/path deletion endpoint path
DEPLOY_ENDPOINT_PURGECDN cache purge endpoint path
DEPLOY_ENDPOINT_SNAPSHOT_CHECKCheck if a snapshot exists endpoint path

CDN Purge Endpoints

These are Azure Front Door endpoint names used in CDN cache purge calls.

VariableDescription
CDN_ENDPOINT_CDNMain CDN endpoint
CDN_ENDPOINT_PREVIEW_CDNPreview CDN endpoint
CDN_ENDPOINT_SANDBOXSandbox tool endpoint
CDN_ENDPOINT_PLAYGROUNDPlayground tool endpoint
CDN_ENDPOINT_NMENode Material Editor endpoint
CDN_ENDPOINT_NGENode Geometry Editor endpoint
CDN_ENDPOINT_NRGENode Render Graph Editor endpoint
CDN_ENDPOINT_GUIEDITORGUI Editor endpoint
CDN_ENDPOINT_NPENode Particle Editor endpoint
CDN_ENDPOINT_FGEFlow Graph Editor endpoint
CDN_ENDPOINT_DOCSDocumentation site endpoint

CDN Purge Profiles

Azure Front Door profile names used alongside the endpoints above.

VariableDescription
CDN_PROFILE_CDNProfile for main CDN and preview CDN endpoints
CDN_PROFILE_SANDBOXProfile for the sandbox endpoint
CDN_PROFILE_PLAYGROUNDProfile for the playground endpoint
CDN_PROFILE_TOOLSProfile for all editor tool and documentation endpoints

Variable Group: BabylonJS-BrowserStack

BrowserStack credentials shared by pipelines that run browser tests.

VariableDescription
BROWSERSTACK_ACCESS_KEYBrowserStack access key
BROWSERSTACK_USERNAMEBrowserStack username

Linked by: ci-monorepo, ci-browser-testing.

BrowserStack connection

All pipelines connect to BrowserStack directly over CDP using Playwright's connectOptions.wsEndpoint (configured in playwright.browserstack.config.ts). The browser, OS, and credentials are passed as capabilities in the WebSocket URL.

CI invocation (in YAML pipelines):

yaml
- script: npx playwright test --config ./playwright.browserstack.config.ts
  env:
      BSTACK_TEST_TYPE: "webgl2" # or webgpu, performance, interaction
      CDN_BASE_URL: "$(SNAPSHOT_CDN_URL)/$(BuildName)"
      BROWSERSTACK_USERNAME: $(BROWSERSTACK_USERNAME)
      BROWSERSTACK_ACCESS_KEY: $(BROWSERSTACK_ACCESS_KEY)

Key environment variables for CI:

VariableDescription
BSTACK_TEST_TYPESelects test suite and dashboard build name (webgl2, webgpu, performance, interaction)
BSTACK_BROWSEROverride browser for cross-browser runs (e.g. playwright-firefox, playwright-webkit)
BSTACK_OS / BSTACK_OS_VERSIONOverride OS/version (e.g. OS X / Sonoma)
BSTACK_SESSIONS_REQUIREDPreferred number of parallel sessions to reserve (default: 1)
BSTACK_MAX_SESSIONSMax sessions on the BrowserStack plan; caps REQUIRED (default: 5)
CIWORKERSNumber of parallel BrowserStack sessions (default: set by browserstack-wait.sh)

Variable Group: BabylonJS-Deployment

Deployment server credentials shared by pipelines that upload snapshots or deploy tools.

VariableDescription
DEPLOY_TOKENDeployment server authorization token
DEPLOYMENT_SERVERDeployment server base URL

Linked by: ci-monorepo, ci-playground-sandbox, ci-graph-tools, cd-publish, cd-tools.

Secret Variables (per-pipeline)

These must be configured as secret variables on each pipeline (not in the variable group) because they contain credentials:

VariableUsed ByDescription
GitHubPATcd-publishGitHub Personal Access Token for git push and version scripts
NPM_TOKENcd-publishnpm registry auth token for publishing
SEARCH_KEYci-documentationSearch API key for documentation builds

Manual YAML Configuration

These values must be edited directly in the YAML files because Azure DevOps resources.pipelines.source does not support runtime variable expansion.

ValueFileDescription
<PUBLISH_PIPELINE_NAME>ci-monorepo.ymlName of the cd-publish YAML pipeline (build completion trigger)
<NATIVE_TESTS_PIPELINE_NAME>ci-monorepo.ymlName of the native tests pipeline (artifact download source)

Replace the <...> placeholders with the actual pipeline names after creating them in Azure DevOps.

Linking the Variable Group

Each pipeline YAML references the variable group via:

yaml
variables:
    - group: BabylonJS-CI-Infrastructure
    - name: BuildName
      value: $(Build.SourceBranch)

After creating a new YAML pipeline, go to Pipeline → Edit → Variables → Variable groups and link BabylonJS-CI-Infrastructure. The pipeline must be authorized to access the group.

Note: The GITHUB_SERVICE_CONNECTION variable is used in GitHubComment@0 and GitHubRelease@1 task inputs. After linking the variable group, you may need to manually authorize the service connection for each pipeline that uses it (Pipeline → Settings → Service connections).