Deployment guide
This page guides you through the Google Cloud Cortex Framework deployment steps for production-path deployments.
Cortex Framework compiles your declarative YAML configurations
into a complete Dataform project and deploys the generated workspace to
one or more targets: a Google Cloud Dataform repository
(type: dataform), a remote or local Git repository (type: git), or both in a
single run.
Before you begin
Complete the following prerequisites before running a production deployment:
- Satisfy the tool and project setup requirements in Prerequisites.
- Prepare your raw landing datasets or external catalogs as described in Source system integration.
- If you configure any Git deployment target (
type: gitunderdeployment.targetsinconfig/config.yaml), installgitversion 2.28 or later on your workstation or CI/CD runner and configure repository write credentials.
Configure Identity and Access Management roles
Grant the deploying user or CI/CD service account the following Identity and Access Management (IAM) roles across your Google Cloud projects.
Roles for build project
To get the permissions that
you need to build Cortex Framework,
ask your administrator to grant you the
BigQuery Job User (roles/bigquery.jobUser) IAM role on your build project.
For more information about granting roles, see Manage access to projects, folders, and organizations.
You might also be able to get the required permissions through custom roles or other predefined roles.
Grant the role on your build project:
gcloud projects add-iam-policy-binding BUILD_PROJECT_ID \
--member="user:USER_EMAIL" \
--role="roles/bigquery.jobUser"
Replace the following:
BUILD_PROJECT_ID: the Google Cloud project ID where schema discovery and compilation jobs execute, for example:my-cortex-build-project.USER_EMAIL: the email address of the deploying user (or useserviceAccount:SA_EMAILfor a CI/CD service account), for example:analyst@example.com.
Roles for source project
To get the permissions that
you need to inspect raw source schemas for Cortex Framework,
ask your administrator to grant you the
BigQuery Data Viewer (roles/bigquery.dataViewer) IAM role on your source project.
For more information about granting roles, see Manage access to projects, folders, and organizations.
You might also be able to get the required permissions through custom roles or other predefined roles.
gcloud projects add-iam-policy-binding SOURCE_PROJECT_ID \
--member="user:USER_EMAIL" \
--role="roles/bigquery.dataViewer"
Replace the following:
SOURCE_PROJECT_ID: the Google Cloud project ID hosting your raw source datasets or catalog connections, for example:my-cortex-source-project.USER_EMAIL: the email address of the deploying principal, for example:analyst@example.com.
Roles for target projects
To get the permissions that you need to deploy Cortex Framework, ask your administrator to grant you the following IAM roles on your target projects:
- BigQuery Data Editor (
roles/bigquery.dataEditor) - Dataform Admin (
roles/dataform.admin) - Service Usage Consumer (
roles/serviceusage.serviceUsageConsumer)
For more information about granting roles, see Manage access to projects, folders, and organizations.
You might also be able to get the required permissions through custom roles or other predefined roles.
Grant the roles on your target project:
gcloud projects add-iam-policy-binding TARGET_PROJECT_ID \
--member="user:USER_EMAIL" \
--role="roles/bigquery.dataEditor"
gcloud projects add-iam-policy-binding TARGET_PROJECT_ID \
--member="user:USER_EMAIL" \
--role="roles/dataform.admin"
gcloud projects add-iam-policy-binding TARGET_PROJECT_ID \
--member="user:USER_EMAIL" \
--role="roles/serviceusage.serviceUsageConsumer"
Replace the following:
TARGET_PROJECT_ID: the destination Google Cloud project ID for BigQuery datasets and Dataform repositories, for example:my-cortex-target-project.USER_EMAIL: the email address of the deploying principal, for example:analyst@example.com.
Roles for Dataform execution
When Dataform executes compiled SQL actions in BigQuery,
it runs under either the default Dataform service agent
(service-PROJECT_NUMBER@gcp-sa-dataform.iam.gserviceaccount.com) or a custom service account
configured in deployment.targets[].targetSettings.serviceAccount. Grant the
execution service account the following roles:
- Source projects and external catalog projects: BigQuery
Data Viewer (
roles/bigquery.dataViewer) on raw landing datasets and external catalog datasets. - Target projects: BigQuery Data Editor
(
roles/bigquery.dataEditor) on foundation, data product, and assertion target datasets, plus BigQuery Job User (roles/bigquery.jobUser) on the project hosting the Dataform repository. - Custom service account impersonation (when
targetSettings.serviceAccountis set): Grant the default Dataform service agent both Service Account Token Creator (roles/iam.serviceAccountTokenCreator) and Service Account User (roles/iam.serviceAccountUser) on your custom service account, and grant the deploying user Service Account User (roles/iam.serviceAccountUser) and Service Account Token Creator (roles/iam.serviceAccountTokenCreator) on the custom service account. For a completegcloudexample, see Demo deployment service account setup.
Configure deployment settings
Cortex Framework uses a YAML configuration file (by convention,
config/config.yaml, copied from config/config.yaml.example) to bind source
datasets, target datasets, enabled modules, data quality assertions, and
deployment targets.
Populate the project identifiers for your topology:
BUILD_PROJECT_ID(buildEnvironment.buildProjectId): Project where CLI metadata and dry-run queries execute.SOURCE_PROJECT_ID(data.datasets[].projectId): Project hosting raw landing tables.TARGET_PROJECT_ID(data.datasets[].projectId): Destination project for conformed foundation and data product datasets. Duringtype: dataformtarget preflight, whendata.assertionsEnabledistrue(the default), Cortex Framework also validates and provisionsdefaultAssertionDataset(defaultdataform_assertions, used by data quality assertions) in every target project.REPO_PROJECT_ID(deployment.targets[].targetSettings.repositoryProjectId): Project hosting your Dataform repository when deploying totype: dataform.
For the full schema of every configuration block, see Deployment configuration.
Choose a deployment target (dataform or git)
Under deployment.targets in config/config.yaml, you can enable one or more
deployment targets:
- Google Cloud Dataform workspace (
type: dataform): Creates or reuses a Dataform repository and development workspace in Google Cloud, then reconciles remote files against your compileddist/output. Remote files matchingtargetSettings.ignoredPaths(default["definitions/custom"]) are preserved across deployments. - Protocol-agnostic Git repository
(
type: git): Requires Git2.28or later on the build host. Validates configuration and payload integrity, clones or initializes the target Git repository, reconciles compiled Dataform artifacts using SHA-256 content hashes, and commits and pushes totargetSettings.branch(default"main"). Optionally scopes reconciliation totargetSettings.targetDirso sibling directories remain untouched. Usetype: gitwhen your enterprise connects Dataform to GitHub, GitLab, Bitbucket, or internal Git servers through GitOps and pull-request pipelines:- Pre-flight validation: Before cloning, checks
repositoryUrland branch syntax, blocks unsafetargetDirpaths, verifiesdist/Dataform descriptors, and probes remote reachability withgit ls-remote(unlessskipPreflightChecks: true). Before committing, Cortex Framework also checks that an author email for Git commits is configured usingtargetSettings.authorEmail,git config user.email, or bothGIT_AUTHOR_EMAILandGIT_COMMITTER_EMAIL. This check still runs even ifskipPreflightChecksis set totrue. - Supported protocols: SCP-style SSH (
git@github.com:org/repo.git),ssh://...,https://...,http://..., and localfile:///pathor file system paths. Non-existent local paths are automatically initialized as bare Git repositories, and inline URL credentials and secrets are redacted in logs. - Authentication (
targetSettings.auth): Supply key or token content incredentialsEnvVaror a path incredentialsPath(mutually exclusive). Alternatively, rely on your SSH agent or Git credential helper (allowSystemAuth: true). For SSH, the deployer configuresGIT_SSH_COMMANDwithBatchMode=yesand configurablestrictHostKeyCheckingandsshKnownHostsPath. It creates an ephemeral0600key file only when you usecredentialsEnvVar(withIdentitiesOnly=yes). When you usecredentialsPath, SSH points directly to that existing file with-F /dev/nullandIdentitiesOnly=yes. When you provide neither (allowSystemAuth: true), SSH uses the host SSH agent and configuration without-iorIdentitiesOnly=yes. For HTTPS, the deployer injects an ephemeral0700GIT_ASKPASShelper only when you providecredentialsEnvVarorcredentialsPath. The helper supportsusername:tokenor a raw personal access token (x-access-token). - Commit identity and verified signatures:
Cortex Framework doesn't use a hardcoded default commit email.
It requires an email from
targetSettings.authorEmail, bothGIT_AUTHOR_EMAILandGIT_COMMITTER_EMAIL, orgit config user.email(including conditionalincludeIfrules). For repositories enforcing verified GPG or SSH signatures (such as GitHub Enterprise rulesets), omittargetSettings.authorEmailwhen your team sharesconfig/config.yamlso Git uses each developer's local signed identity. In headless CI/CD pipelines without global Git configuration, settargetSettings.authorEmailor export bothGIT_AUTHOR_EMAILandGIT_COMMITTER_EMAIL. - Path protection, fast-forward push, and dry-run mode: Protect
repository-owned files from overwrite or deletion with
targetSettings.ignorePatterns(for example,["README*", ".github/**", "definitions/custom/**"];.gitis always preserved). Force pushes are disabled, so diverged remote branches fail fast. SettargetSettings.push: falseto commit locally without pushing, and matchingHEADpayloads exit as an idempotent no-op without an empty commit.
- Pre-flight validation: Before cloning, checks
The following example configures a GitOps deployment target pushing compiled
artifacts into a dataform/ subdirectory on main using an environment
variable token:
deployment:
targets:
- type: git
enabled: true
targetSettings:
repositoryUrl: https://github.com/ORG_NAME/REPO_NAME.git
branch: main
targetDir: dataform
commitMessage: "Deploy Cortex Framework artifacts {timestamp}"
authorEmail: DEPLOYER_EMAIL
push: true
ignorePatterns:
- "README*"
- ".github/**"
- "definitions/custom/**"
auth:
credentialsEnvVar: CORTEX_GIT_TOKEN
allowSystemAuth: false
Replace the following:
ORG_NAME: your target Git organization name, for example:my-org.REPO_NAME: your target Git repository name, for example:cortex-dataform.DEPLOYER_EMAIL: the email address for the Git commit author and committer, for example:deployer@example.com. Headless CI/CD runners usually don't have a globalgit config user.emailset. Whenuser.emailisn't set, deployments fail unless you configureauthorEmailinconfig/config.yamlor export bothGIT_AUTHOR_EMAILandGIT_COMMITTER_EMAILin the pipeline environment.
Execute deployment
Run cortex-build-and-deploy to validate prerequisites, compile all enabled
modules and assertions into dist/, and synchronize every enabled deployment
target:
export CORTEX_CONFIG_FILE=config/config.yaml
uv run cortex-build-and-deploy --config $CORTEX_CONFIG_FILE
When deploying to type: git interactively, both uv run cortex-deploy and
uv run cortex-build-and-deploy prompt for confirmation before creating a
missing remote branch or overwriting or deleting tracked files outside
ignorePatterns. In automated CI/CD pipelines, pass -y (or --yes) to
auto-confirm these prompts non-interactively:
export CORTEX_CONFIG_FILE=config/config.yaml
uv run cortex-build-and-deploy \
--config $CORTEX_CONFIG_FILE \
--yes
To validate compiled Dataform SQL and assertion definitions locally
before deploying, run
uv run cortex-compile (pass
--dist-dir dist after uv run cortex-build for strictly offline graph
compilation).
Command-line tools
Use the following uv run CLI entry points to separate build, validation, and
deployment stages across CI/CD environments:
uv run cortex-build: Compiles YAML configurations, source schemas, and assertions into local Dataform artifacts (dist/).uv run cortex-compile: Compiles the Dataform dependency graph locally (offline when passed--dist-dir) to validate SQL and assertion definitions before deployment.uv run cortex-deploy: Deploys an already-builtdist/directory to enableddataformandgittargets without modifying live BigQuery tables.uv run cortex-build-and-deploy: Runs compilation and target synchronization in a single command.uv run cortex-apply-security: Reconciles BigQuery column policy tags and stale row access policies after Dataform workflow execution for bothtype: dataformandtype: gittargets (supports--dry-runfor a read-only preview).
Upgrade from v7.0 to v7.1
To upgrade an existing Cortex Framework version 7.0.x deployment
to version 7.1, follow the standard workflow in
Upgrade Cortex Framework
together with the version-specific steps, SAP column rename map, and targeted
full-refresh table lists in
Upgrade to version 7.1. You can also run the
/upgrade-cortex
agent skill to inspect
and update configuration files.
If your deployment enables cortex_v6_compatibility, stock_weekly_snapshots
and stock_monthly_snapshots rebuild automatically on their first version 7.1
incremental run for both SAP S/4HANA and SAP ECC (see
Inventory snapshots).
Next steps
- Post-deployment steps: Execute your Dataform workflows and verify materialized tables in BigQuery.
- Row- and column-level security:
Configure column policy tags, row access policies, and
uv run cortex-apply-securityreconciliation. - Data quality assertions: Configure blocking and severity-tagged validation rules on foundation and product tables.
- Knowledge Catalog integration: Register and govern deployed data products.
- Data product module creation: Build custom data products in an isolated namespace.