Skip to content

Commit dca0c8c

Browse files
authored
Merge pull request #2185 from elementary-data/update-ci-review-docs
docs: update CI review for server-side architecture
2 parents b2f9284 + 03d55bb commit dca0c8c

1 file changed

Lines changed: 38 additions & 36 deletions

File tree

docs/cloud/features/ci.mdx

Lines changed: 38 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -19,33 +19,36 @@ Elementary closes that gap by bringing live data quality context directly into t
1919

2020
## What you get on every PR
2121

22-
- **Test history:** pass/fail counts for each changed model over the last 7 days, so reviewers know if they're touching something that's already fragile
23-
- **Active incidents:** any open data quality issues on those models right now, before the change lands on top of them
24-
- **Downstream blast radius:** exactly which models, pipelines, and dashboards depend on what's changing, two levels deep
25-
- **Health summary:** a plain-language signal on whether it's safe to merge, powered by Claude
22+
- **Change analysis:** Elementary cross-references the diff against what it knows about each model's columns, types, and behavior, flagging logical concerns like NULL risks, type mismatches, or join changes that could alter row counts
23+
- **Performance & cost:** SQL anti-pattern detection (SELECT *, cross joins, missing filters on large tables) with volume context so reviewers can assess real cost impact
24+
- **Downstream blast radius:** exactly which models, pipelines, and dashboards depend on what's changing, including column-level impact for renamed or removed columns
25+
- **Tests & incidents:** pass/fail history for each changed model, active data quality incidents, and coverage gaps on new columns
26+
- **Risk summary:** a plain-language assessment of whether it's safe to merge, with prioritized recommendations
27+
28+
The comment is concise by default. If everything looks clean, the review is a few lines. It only expands when there are actual issues to flag.
2629

2730
The comment updates automatically on every new push, so the review always reflects the latest state. No noise, no duplicate comments.
2831

2932
## How it works
3033

31-
The review is powered by [Claude](https://www.anthropic.com) connected to the [Elementary MCP server](/cloud/mcp/intro). When a PR is opened or updated:
34+
When a PR is opened or updated:
3235

33-
1. A CI job detects which models changed using `git diff`
34-
2. Claude queries Elementary for live data quality context on those exact models
35-
3. A structured Markdown summary is posted as a comment on the PR or MR
36+
1. A CI job sends the repository name and branch to Elementary's API
37+
2. Elementary fetches the diff, runs static SQL analysis, and queries live data quality context for the changed models
38+
3. A structured Markdown comment is posted as a comment on the PR or MR
3639

37-
No custom scripts. No webhook setup. No infrastructure to manage. Two secrets and one file.
40+
No custom scripts. No webhook setup. No infrastructure to manage. One secret and one file.
3841

3942
## Setup
4043

4144
### Prerequisites
4245

43-
- An Elementary Cloud account with the [MCP server enabled](/cloud/mcp/setup-guide)
44-
- An [Anthropic API key](https://console.anthropic.com)
46+
- An Elementary Cloud account with a [code repository connected](/cloud/integrations/code-repo/connect-code-repo)
47+
- An [Elementary API key](/cloud/integrations/api-key)
4548

4649
### GitHub Actions
4750

48-
**Step 1 Add the workflow file**
51+
**Step 1 -- Add the workflow file**
4952

5053
Create `.github/workflows/elementary-review.yml` in your dbt repository:
5154

@@ -65,27 +68,26 @@ jobs:
6568
permissions:
6669
contents: read
6770
pull-requests: write
71+
issues: write
6872
steps:
6973
- uses: actions/checkout@v4
7074
with:
7175
fetch-depth: 0
7276

7377
- uses: elementary-data/elementary-ci@v1
7478
with:
75-
anthropic-api-key: ${{ secrets.ANTHROPIC_API_KEY }}
7679
elementary-api-key: ${{ secrets.ELEMENTARY_API_KEY }}
7780
```
7881
79-
**Step 2 Add two repository secrets**
82+
**Step 2 -- Add a repository secret**
8083
8184
Go to **Settings > Secrets and variables > Actions** and add:
8285
8386
| Secret | Description |
8487
|---|---|
85-
| `ANTHROPIC_API_KEY` | Your Anthropic API key |
8688
| `ELEMENTARY_API_KEY` | Your Elementary Cloud API key |
8789

88-
That's it. The review only runs on PRs that touch model files — other PRs are ignored entirely.
90+
That's it. The review only runs on PRs that touch model files. Other PRs are ignored entirely.
8991

9092
<Warning>
9193
This works for pull requests opened from branches within the same repository. GitHub does not pass repository secrets to `pull_request` workflows triggered by forks or Dependabot.
@@ -95,38 +97,42 @@ This works for pull requests opened from branches within the same repository. Gi
9597

9698
| Input | Default | Description |
9799
|---|---|---|
98-
| `models-path` | `models/` | Path to your dbt models directory |
99-
| `diff-filter` | `ACMR` | File changes to include: A=Added, C=Copied, M=Modified, R=Renamed |
100-
| `claude-model` | `claude-haiku-4-5-latest` | Claude model to use. Switch to `claude-sonnet-4-latest` for deeper analysis on complex changes |
101-
| `base-ref` | PR base branch | Branch to diff against |
102-
| `mcp-config-path` | _(auto-generated)_ | Path to a custom MCP config file. Only needed for self-hosted Elementary setups |
100+
| `elementary-api-url` | Elementary Cloud | Override the API URL. Only needed for self-hosted Elementary setups |
101+
102+
</Accordion>
103+
104+
<Accordion title="Optional: specify environment">
105+
106+
If your repository is connected to multiple Elementary environments, add `env-id` to the request to specify which one to use:
103107

104108
```yaml
105109
- uses: elementary-data/elementary-ci@v1
106110
with:
107-
anthropic-api-key: ${{ secrets.ANTHROPIC_API_KEY }}
108111
elementary-api-key: ${{ secrets.ELEMENTARY_API_KEY }}
109-
models-path: "dbt/models/"
110-
claude-model: "claude-sonnet-4-latest"
112+
elementary-env-id: "169e9308-9a70-4200-b810-ad486cb42f3a"
111113
```
114+
115+
The environment ID is the UUID in your Elementary Cloud URL. For example, in `https://app.elementary-data.com/169e9308-9a70-4200-b810-ad486cb42f3a/report/dashboard`, the environment ID is `169e9308-9a70-4200-b810-ad486cb42f3a`.
116+
117+
If you don't specify an `env-id` and the repository is connected to only one environment, it will be selected automatically. If connected to multiple, the review will return an error listing the available environment IDs.
118+
112119
</Accordion>
113120

114121
### GitLab CI
115122

116-
**Step 1 Add the include to your `.gitlab-ci.yml`**
123+
**Step 1 -- Add the include to your `.gitlab-ci.yml`**
117124

118125
```yaml
119126
include:
120127
- remote: 'https://raw.githubusercontent.com/elementary-data/elementary-ci/v1/templates/mr-review.yml'
121128
```
122129

123-
**Step 2 Add two CI/CD variables**
130+
**Step 2 -- Add CI/CD variables**
124131

125132
Go to **Settings > CI/CD > Variables** and add:
126133

127134
| Variable | Masked | Description |
128135
|---|---|---|
129-
| `ANTHROPIC_API_KEY` | Yes | Your Anthropic API key |
130136
| `ELEMENTARY_API_KEY` | Yes | Your Elementary Cloud API key |
131137
| `GITLAB_API_TOKEN` | Yes | Optional. Project Access Token with `api` scope. Set this if you cannot enable CI/CD job token API access in project settings. |
132138

@@ -143,20 +149,16 @@ The review only runs on MRs that touch model files. Other MRs are ignored entire
143149

144150
**No comment appears after the job runs**
145151

146-
Make sure both `contents: read` and `pull-requests: write` are set under `permissions` in the workflow. An explicit `permissions` block sets any unlisted scope to `none`, so omitting `contents: read` causes the checkout step to fail before Elementary runs.
152+
Make sure `contents: read`, `pull-requests: write`, and `issues: write` are set under `permissions` in the workflow. An explicit `permissions` block sets any unlisted scope to `none`, so omitting a required scope causes the step to fail silently.
147153

148-
**`git diff` returns no changed models**
154+
**The review says the repository is not connected**
149155

150-
Make sure `fetch-depth: 0` is set on the checkout step. Without full git history the runner cannot compare branches and the diff will be empty.
156+
Make sure you have a code repository integration set up in Elementary Cloud. Go to **Settings > Environments** and verify your repository is connected.
151157

152-
**The comment says the MCP server is unreachable**
158+
**The review says the repository is connected to multiple environments**
153159

154-
Verify `ELEMENTARY_API_KEY` is correctly set and the MCP server is enabled for your account. See the [MCP setup guide](/cloud/mcp/setup-guide).
160+
Add `elementary-env-id` to your workflow to specify which environment to use. The error message will list the available environment IDs.
155161

156162
<Warning>
157163
If a model has never been synced through Elementary, the comment will note that no history is available yet. Results populate automatically after the next Elementary sync.
158164
</Warning>
159-
160-
## Using a different AI provider?
161-
162-
The review currently uses Claude via the Anthropic API. If your team uses a different provider and you'd like to see it supported, reach out at [support@elementary-data.com](mailto:support@elementary-data.com) or on the [Community Slack](https://elementary-data.com/community).

0 commit comments

Comments
 (0)