recce-cloud-nightly 1.26.0.20251119__py3-none-any.whl → 1.31.0.20260101__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of recce-cloud-nightly might be problematic. Click here for more details.
- recce_cloud/.gitignore +22 -0
- recce_cloud/PKG-INFO +801 -0
- recce_cloud/README.md +780 -0
- recce_cloud/VERSION +1 -1
- recce_cloud/api/base.py +21 -0
- recce_cloud/api/client.py +36 -0
- recce_cloud/api/github.py +30 -0
- recce_cloud/api/gitlab.py +29 -0
- recce_cloud/cli.py +189 -0
- recce_cloud/download.py +230 -0
- recce_cloud/hatch_build.py +20 -0
- recce_cloud/pyproject.toml +49 -0
- recce_cloud/pyproject.toml.bak +49 -0
- recce_cloud_nightly-1.31.0.20260101.dist-info/METADATA +801 -0
- recce_cloud_nightly-1.31.0.20260101.dist-info/RECORD +28 -0
- {recce_cloud_nightly-1.26.0.20251119.dist-info → recce_cloud_nightly-1.31.0.20260101.dist-info}/WHEEL +1 -2
- recce_cloud_nightly-1.26.0.20251119.dist-info/METADATA +0 -163
- recce_cloud_nightly-1.26.0.20251119.dist-info/RECORD +0 -23
- recce_cloud_nightly-1.26.0.20251119.dist-info/licenses/LICENSE +0 -201
- recce_cloud_nightly-1.26.0.20251119.dist-info/top_level.txt +0 -1
- {recce_cloud_nightly-1.26.0.20251119.dist-info → recce_cloud_nightly-1.31.0.20260101.dist-info}/entry_points.txt +0 -0
recce_cloud/README.md
ADDED
|
@@ -0,0 +1,780 @@
|
|
|
1
|
+
# Recce Cloud CLI
|
|
2
|
+
|
|
3
|
+
Lightweight command-line tool for managing dbt artifacts with Recce Cloud in CI/CD environments.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
The Recce Cloud CLI (`recce-cloud`) is a standalone tool designed for CI/CD pipelines that need to upload and download dbt artifacts (manifest.json and catalog.json) to/from Recce Cloud without the full `recce` package dependencies.
|
|
8
|
+
|
|
9
|
+
**Key Features:**
|
|
10
|
+
|
|
11
|
+
- 🚀 Lightweight - minimal dependencies for fast CI/CD execution
|
|
12
|
+
- 🤖 Auto-detection - automatically detects CI platform, repository, and PR/MR context
|
|
13
|
+
- ⬆️ Upload - push dbt artifacts to Recce Cloud sessions
|
|
14
|
+
- ⬇️ Download - pull dbt artifacts from Recce Cloud sessions
|
|
15
|
+
- 🔐 Flexible authentication - works with CI tokens or explicit API tokens
|
|
16
|
+
- ✅ Platform-specific - optimized for GitHub Actions and GitLab CI
|
|
17
|
+
|
|
18
|
+
## Installation
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
pip install recce-cloud
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Or in your CI/CD workflow:
|
|
25
|
+
|
|
26
|
+
```yaml
|
|
27
|
+
# GitHub Actions
|
|
28
|
+
- name: Install recce-cloud
|
|
29
|
+
run: pip install recce-cloud
|
|
30
|
+
|
|
31
|
+
# GitLab CI
|
|
32
|
+
install:
|
|
33
|
+
script:
|
|
34
|
+
- pip install recce-cloud
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Quick Start
|
|
38
|
+
|
|
39
|
+
### GitHub Actions
|
|
40
|
+
|
|
41
|
+
**Upload artifacts:**
|
|
42
|
+
|
|
43
|
+
```yaml
|
|
44
|
+
- name: Upload to Recce Cloud
|
|
45
|
+
run: recce-cloud upload
|
|
46
|
+
env:
|
|
47
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
**Download artifacts:**
|
|
51
|
+
|
|
52
|
+
```yaml
|
|
53
|
+
- name: Download from Recce Cloud
|
|
54
|
+
run: recce-cloud download --prod --target-path target-base
|
|
55
|
+
env:
|
|
56
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### GitLab CI
|
|
60
|
+
|
|
61
|
+
**Upload artifacts:**
|
|
62
|
+
|
|
63
|
+
```yaml
|
|
64
|
+
recce-upload:
|
|
65
|
+
script:
|
|
66
|
+
- recce-cloud upload
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
**Download artifacts:**
|
|
70
|
+
|
|
71
|
+
```yaml
|
|
72
|
+
recce-download:
|
|
73
|
+
script:
|
|
74
|
+
- recce-cloud download --prod --target-path target-base
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
## Upload Workflows
|
|
78
|
+
|
|
79
|
+
The `recce-cloud upload` command supports two workflows:
|
|
80
|
+
|
|
81
|
+
### 1. Platform-Specific Workflow (Recommended)
|
|
82
|
+
|
|
83
|
+
**For GitHub Actions and GitLab CI**
|
|
84
|
+
|
|
85
|
+
Automatically creates Recce Cloud sessions using platform-specific APIs. No session ID required.
|
|
86
|
+
|
|
87
|
+
**Features:**
|
|
88
|
+
|
|
89
|
+
- ✅ Auto-creates session with `touch-recce-session` API
|
|
90
|
+
- ✅ Auto-detects PR/MR context and links session
|
|
91
|
+
- ✅ Notifies upload completion
|
|
92
|
+
- ✅ Works with CI-provided tokens (GITHUB_TOKEN, CI_JOB_TOKEN)
|
|
93
|
+
|
|
94
|
+
**Usage:**
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
# GitHub Actions
|
|
98
|
+
recce-cloud upload
|
|
99
|
+
|
|
100
|
+
# GitLab CI
|
|
101
|
+
recce-cloud upload
|
|
102
|
+
|
|
103
|
+
# With custom target path
|
|
104
|
+
recce-cloud upload --target-path custom-target
|
|
105
|
+
|
|
106
|
+
# With manual overrides
|
|
107
|
+
recce-cloud upload --cr 123 --type cr
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
**Requirements:**
|
|
111
|
+
|
|
112
|
+
- Running in GitHub Actions or GitLab CI environment
|
|
113
|
+
- RECCE_API_TOKEN or CI-provided token (GITHUB_TOKEN/CI_JOB_TOKEN)
|
|
114
|
+
- dbt artifacts in target directory
|
|
115
|
+
|
|
116
|
+
### 2. Generic Workflow
|
|
117
|
+
|
|
118
|
+
**For other CI platforms or existing sessions**
|
|
119
|
+
|
|
120
|
+
Uploads to a pre-existing Recce Cloud session using session ID.
|
|
121
|
+
|
|
122
|
+
**Usage:**
|
|
123
|
+
|
|
124
|
+
```bash
|
|
125
|
+
# With session ID parameter
|
|
126
|
+
recce-cloud upload --session-id abc123
|
|
127
|
+
|
|
128
|
+
# With environment variable
|
|
129
|
+
export RECCE_SESSION_ID=abc123
|
|
130
|
+
recce-cloud upload
|
|
131
|
+
|
|
132
|
+
# With custom target path
|
|
133
|
+
recce-cloud upload --session-id abc123 --target-path my-target
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
**Requirements:**
|
|
137
|
+
|
|
138
|
+
- Pre-created session ID (from Recce Cloud web app or API)
|
|
139
|
+
- RECCE_API_TOKEN
|
|
140
|
+
- dbt artifacts in target directory
|
|
141
|
+
|
|
142
|
+
## Download Workflows
|
|
143
|
+
|
|
144
|
+
The `recce-cloud download` command supports two workflows:
|
|
145
|
+
|
|
146
|
+
### 1. Platform-Specific Workflow (Recommended)
|
|
147
|
+
|
|
148
|
+
**For GitHub Actions and GitLab CI**
|
|
149
|
+
|
|
150
|
+
Automatically finds and downloads artifacts from Recce Cloud sessions using platform-specific APIs. No session ID required.
|
|
151
|
+
|
|
152
|
+
**Features:**
|
|
153
|
+
|
|
154
|
+
- ✅ Auto-detects PR/MR context
|
|
155
|
+
- ✅ Supports downloading production/base session with `--prod` flag
|
|
156
|
+
- ✅ Works with CI-provided tokens (GITHUB_TOKEN, CI_JOB_TOKEN)
|
|
157
|
+
|
|
158
|
+
**Usage:**
|
|
159
|
+
|
|
160
|
+
```bash
|
|
161
|
+
# GitHub Actions - Download current PR session
|
|
162
|
+
recce-cloud download
|
|
163
|
+
|
|
164
|
+
# GitLab CI - Download current MR session
|
|
165
|
+
recce-cloud download
|
|
166
|
+
|
|
167
|
+
# Download production/base session
|
|
168
|
+
recce-cloud download --prod
|
|
169
|
+
|
|
170
|
+
# Download to custom target path
|
|
171
|
+
recce-cloud download --target-path target-base
|
|
172
|
+
|
|
173
|
+
# Force overwrite existing files
|
|
174
|
+
recce-cloud download --force
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
**Requirements:**
|
|
178
|
+
|
|
179
|
+
- Running in GitHub Actions or GitLab CI environment
|
|
180
|
+
- CI-provided token (GITHUB_TOKEN/CI_JOB_TOKEN)
|
|
181
|
+
- Session must exist in Recce Cloud
|
|
182
|
+
|
|
183
|
+
### 2. Generic Workflow
|
|
184
|
+
|
|
185
|
+
**For other CI platforms or specific sessions**
|
|
186
|
+
|
|
187
|
+
Downloads from a specific Recce Cloud session using session ID.
|
|
188
|
+
|
|
189
|
+
**Usage:**
|
|
190
|
+
|
|
191
|
+
```bash
|
|
192
|
+
# With session ID parameter
|
|
193
|
+
recce-cloud download --session-id abc123
|
|
194
|
+
|
|
195
|
+
# With environment variable
|
|
196
|
+
export RECCE_SESSION_ID=abc123
|
|
197
|
+
recce-cloud download
|
|
198
|
+
|
|
199
|
+
# With custom target path
|
|
200
|
+
recce-cloud download --session-id abc123 --target-path my-target
|
|
201
|
+
|
|
202
|
+
# Force overwrite
|
|
203
|
+
recce-cloud download --session-id abc123 --force
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
**Requirements:**
|
|
207
|
+
|
|
208
|
+
- Session ID (from Recce Cloud web app or API)
|
|
209
|
+
- RECCE_API_TOKEN
|
|
210
|
+
- Session must exist in Recce Cloud
|
|
211
|
+
|
|
212
|
+
## Command Reference
|
|
213
|
+
|
|
214
|
+
### `recce-cloud upload`
|
|
215
|
+
|
|
216
|
+
Upload dbt artifacts to Recce Cloud session.
|
|
217
|
+
|
|
218
|
+
**Options:**
|
|
219
|
+
|
|
220
|
+
| Option | Type | Default | Description |
|
|
221
|
+
| --------------- | ------- | -------- | --------------------------------------------- |
|
|
222
|
+
| `--target-path` | path | `target` | Path to dbt target directory |
|
|
223
|
+
| `--session-id` | string | - | Session ID for generic workflow (optional) |
|
|
224
|
+
| `--cr` | integer | - | Override PR/MR number |
|
|
225
|
+
| `--type` | choice | - | Override session type: `cr`, `prod`, `dev` |
|
|
226
|
+
| `--dry-run` | flag | false | Show what would be uploaded without uploading |
|
|
227
|
+
|
|
228
|
+
**Environment Variables:**
|
|
229
|
+
|
|
230
|
+
| Variable | Required | Description |
|
|
231
|
+
| ------------------ | ------------- | ------------------------------- |
|
|
232
|
+
| `RECCE_API_TOKEN` | Recommended | Recce Cloud API token |
|
|
233
|
+
| `RECCE_SESSION_ID` | Optional | Session ID for generic workflow |
|
|
234
|
+
| `GITHUB_TOKEN` | Explicit set | GitHub authentication (Actions) |
|
|
235
|
+
| `CI_JOB_TOKEN` | Auto-detected | GitLab authentication (CI) |
|
|
236
|
+
|
|
237
|
+
**Exit Codes:**
|
|
238
|
+
|
|
239
|
+
| Code | Description |
|
|
240
|
+
| ---- | --------------------------------------------------- |
|
|
241
|
+
| 0 | Success |
|
|
242
|
+
| 1 | Platform not supported (platform-specific workflow) |
|
|
243
|
+
| 2 | Authentication error |
|
|
244
|
+
| 3 | File validation error |
|
|
245
|
+
| 4 | Upload error |
|
|
246
|
+
|
|
247
|
+
### `recce-cloud download`
|
|
248
|
+
|
|
249
|
+
Download dbt artifacts (manifest.json, catalog.json) from Recce Cloud session.
|
|
250
|
+
|
|
251
|
+
**Options:**
|
|
252
|
+
|
|
253
|
+
| Option | Type | Default | Description |
|
|
254
|
+
| --------------- | ------ | -------- | ---------------------------------------------------- |
|
|
255
|
+
| `--target-path` | path | `target` | Path to directory where artifacts will be downloaded |
|
|
256
|
+
| `--session-id` | string | - | Session ID for generic workflow (optional) |
|
|
257
|
+
| `--prod` | flag | false | Download production/base session |
|
|
258
|
+
| `--dry-run` | flag | false | Show what would be downloaded without downloading |
|
|
259
|
+
| `--force`, `-f` | flag | false | Overwrite existing files without prompting |
|
|
260
|
+
|
|
261
|
+
**Environment Variables:**
|
|
262
|
+
|
|
263
|
+
| Variable | Required | Description |
|
|
264
|
+
| ------------------ | ------------- | ------------------------------- |
|
|
265
|
+
| `RECCE_API_TOKEN` | Recommended | Recce Cloud API token |
|
|
266
|
+
| `RECCE_SESSION_ID` | Optional | Session ID for generic workflow |
|
|
267
|
+
| `GITHUB_TOKEN` | Explicit set | GitHub authentication (Actions) |
|
|
268
|
+
| `CI_JOB_TOKEN` | Auto-detected | GitLab authentication (CI) |
|
|
269
|
+
|
|
270
|
+
**Exit Codes:**
|
|
271
|
+
|
|
272
|
+
| Code | Description |
|
|
273
|
+
| ---- | --------------------------------------------------- |
|
|
274
|
+
| 0 | Success |
|
|
275
|
+
| 1 | Platform not supported (platform-specific workflow) |
|
|
276
|
+
| 2 | Authentication error |
|
|
277
|
+
| 3 | File validation error |
|
|
278
|
+
| 4 | Download error |
|
|
279
|
+
|
|
280
|
+
**Common Examples:**
|
|
281
|
+
|
|
282
|
+
```bash
|
|
283
|
+
# Auto-find and download current PR/MR session
|
|
284
|
+
recce-cloud download
|
|
285
|
+
|
|
286
|
+
# Download project's production/base session
|
|
287
|
+
recce-cloud download --prod
|
|
288
|
+
|
|
289
|
+
# Download from specific session ID
|
|
290
|
+
recce-cloud download --session-id abc123
|
|
291
|
+
|
|
292
|
+
# Download prod session to target-base
|
|
293
|
+
recce-cloud download --prod --target-path target-base
|
|
294
|
+
|
|
295
|
+
# Force overwrite existing files
|
|
296
|
+
recce-cloud download --force
|
|
297
|
+
|
|
298
|
+
# Dry run - preview what would be downloaded
|
|
299
|
+
recce-cloud download --dry-run
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
### `recce-cloud version`
|
|
303
|
+
|
|
304
|
+
Display the version of recce-cloud.
|
|
305
|
+
|
|
306
|
+
```bash
|
|
307
|
+
recce-cloud version
|
|
308
|
+
```
|
|
309
|
+
|
|
310
|
+
## Authentication
|
|
311
|
+
|
|
312
|
+
The CLI supports multiple authentication methods with the following priority:
|
|
313
|
+
|
|
314
|
+
1. **RECCE_API_TOKEN** (explicit token) - Recommended for production
|
|
315
|
+
2. **CI-provided tokens** - GITHUB_TOKEN (Actions) or CI_JOB_TOKEN (GitLab CI)
|
|
316
|
+
3. Error if no token available
|
|
317
|
+
|
|
318
|
+
### Getting API Tokens
|
|
319
|
+
|
|
320
|
+
**Recce Cloud API Token:**
|
|
321
|
+
|
|
322
|
+
1. Log in to [Recce Cloud](https://cloud.datarecce.io)
|
|
323
|
+
2. Go to Settings → API Tokens
|
|
324
|
+
3. Create a new token
|
|
325
|
+
4. Add to CI/CD secrets as `RECCE_API_TOKEN`
|
|
326
|
+
|
|
327
|
+
**GitHub Token:**
|
|
328
|
+
|
|
329
|
+
- Available as `${{ secrets.GITHUB_TOKEN }}` in Actions
|
|
330
|
+
- Must be explicitly set in `env:` section of your workflow
|
|
331
|
+
|
|
332
|
+
**GitLab Token:**
|
|
333
|
+
|
|
334
|
+
- Automatically available as `$CI_JOB_TOKEN` in GitLab CI
|
|
335
|
+
- No additional configuration needed
|
|
336
|
+
|
|
337
|
+
## Auto-Detection
|
|
338
|
+
|
|
339
|
+
The CLI automatically detects your CI environment:
|
|
340
|
+
|
|
341
|
+
### Detected Information
|
|
342
|
+
|
|
343
|
+
| Information | GitHub Actions | GitLab CI |
|
|
344
|
+
| ------------- | --------------------- | ---------------------------------------- |
|
|
345
|
+
| Platform | ✅ `github-actions` | ✅ `gitlab-ci` |
|
|
346
|
+
| Repository | ✅ `owner/repo` | ✅ `group/project` |
|
|
347
|
+
| PR/MR Number | ✅ From event payload | ✅ From `CI_MERGE_REQUEST_IID` |
|
|
348
|
+
| PR/MR URL | ✅ Constructed | ✅ Constructed (self-hosted support) |
|
|
349
|
+
| Commit SHA | ✅ `GITHUB_SHA` | ✅ `CI_COMMIT_SHA` |
|
|
350
|
+
| Source Branch | ✅ `GITHUB_HEAD_REF` | ✅ `CI_MERGE_REQUEST_SOURCE_BRANCH_NAME` |
|
|
351
|
+
| Base Branch | ✅ `GITHUB_BASE_REF` | ✅ `CI_MERGE_REQUEST_TARGET_BRANCH_NAME` |
|
|
352
|
+
| Session Type | ✅ Auto-determined | ✅ Auto-determined |
|
|
353
|
+
| Access Token | ✅ `GITHUB_TOKEN` | ✅ `CI_JOB_TOKEN` |
|
|
354
|
+
|
|
355
|
+
### Manual Overrides
|
|
356
|
+
|
|
357
|
+
You can override auto-detected values:
|
|
358
|
+
|
|
359
|
+
```bash
|
|
360
|
+
# Override PR/MR number
|
|
361
|
+
recce-cloud upload --cr 456
|
|
362
|
+
|
|
363
|
+
# Override session type
|
|
364
|
+
recce-cloud upload --type prod
|
|
365
|
+
|
|
366
|
+
# Multiple overrides
|
|
367
|
+
recce-cloud upload --cr 789 --type cr
|
|
368
|
+
|
|
369
|
+
# Dry run - preview what would be uploaded
|
|
370
|
+
recce-cloud upload --dry-run
|
|
371
|
+
```
|
|
372
|
+
|
|
373
|
+
## CI/CD Integration Examples
|
|
374
|
+
|
|
375
|
+
### GitHub Actions - Upload Workflow
|
|
376
|
+
|
|
377
|
+
```yaml
|
|
378
|
+
name: Recce CI - Upload
|
|
379
|
+
|
|
380
|
+
on:
|
|
381
|
+
pull_request:
|
|
382
|
+
branches: [main]
|
|
383
|
+
|
|
384
|
+
jobs:
|
|
385
|
+
recce:
|
|
386
|
+
runs-on: ubuntu-latest
|
|
387
|
+
steps:
|
|
388
|
+
- uses: actions/checkout@v4
|
|
389
|
+
|
|
390
|
+
- name: Setup Python
|
|
391
|
+
uses: actions/setup-python@v4
|
|
392
|
+
with:
|
|
393
|
+
python-version: "3.11"
|
|
394
|
+
|
|
395
|
+
- name: Install dependencies
|
|
396
|
+
run: |
|
|
397
|
+
pip install dbt-core dbt-postgres recce-cloud
|
|
398
|
+
|
|
399
|
+
- name: Build dbt project
|
|
400
|
+
run: |
|
|
401
|
+
dbt deps
|
|
402
|
+
dbt build
|
|
403
|
+
dbt docs generate
|
|
404
|
+
|
|
405
|
+
- name: Upload to Recce Cloud
|
|
406
|
+
run: recce-cloud upload
|
|
407
|
+
env:
|
|
408
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
409
|
+
```
|
|
410
|
+
|
|
411
|
+
### GitHub Actions - Download Workflow
|
|
412
|
+
|
|
413
|
+
```yaml
|
|
414
|
+
name: Recce CI - Download
|
|
415
|
+
|
|
416
|
+
on:
|
|
417
|
+
pull_request:
|
|
418
|
+
branches: [main]
|
|
419
|
+
|
|
420
|
+
jobs:
|
|
421
|
+
recce:
|
|
422
|
+
runs-on: ubuntu-latest
|
|
423
|
+
steps:
|
|
424
|
+
- uses: actions/checkout@v4
|
|
425
|
+
|
|
426
|
+
- name: Setup Python
|
|
427
|
+
uses: actions/setup-python@v4
|
|
428
|
+
with:
|
|
429
|
+
python-version: "3.11"
|
|
430
|
+
|
|
431
|
+
- name: Install dependencies
|
|
432
|
+
run: |
|
|
433
|
+
pip install dbt-core dbt-postgres recce-cloud
|
|
434
|
+
|
|
435
|
+
# Download production/base artifacts
|
|
436
|
+
- name: Download base artifacts from Recce Cloud
|
|
437
|
+
run: recce-cloud download --prod --target-path target-base
|
|
438
|
+
env:
|
|
439
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
440
|
+
|
|
441
|
+
# Build current PR version
|
|
442
|
+
- name: Build dbt project (current)
|
|
443
|
+
run: |
|
|
444
|
+
dbt deps
|
|
445
|
+
dbt build
|
|
446
|
+
dbt docs generate
|
|
447
|
+
|
|
448
|
+
# Upload current PR artifacts
|
|
449
|
+
- name: Upload to Recce Cloud
|
|
450
|
+
run: recce-cloud upload
|
|
451
|
+
env:
|
|
452
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
453
|
+
```
|
|
454
|
+
|
|
455
|
+
### GitLab CI - Upload Workflow
|
|
456
|
+
|
|
457
|
+
```yaml
|
|
458
|
+
stages:
|
|
459
|
+
- build
|
|
460
|
+
- upload
|
|
461
|
+
|
|
462
|
+
dbt-build:
|
|
463
|
+
stage: build
|
|
464
|
+
image: python:3.11-slim
|
|
465
|
+
script:
|
|
466
|
+
- pip install dbt-core dbt-postgres
|
|
467
|
+
- dbt deps
|
|
468
|
+
- dbt build
|
|
469
|
+
- dbt docs generate
|
|
470
|
+
artifacts:
|
|
471
|
+
paths:
|
|
472
|
+
- target/
|
|
473
|
+
|
|
474
|
+
recce-upload:
|
|
475
|
+
stage: upload
|
|
476
|
+
image: python:3.11-slim
|
|
477
|
+
script:
|
|
478
|
+
- pip install recce-cloud
|
|
479
|
+
- recce-cloud upload
|
|
480
|
+
dependencies:
|
|
481
|
+
- dbt-build
|
|
482
|
+
only:
|
|
483
|
+
- merge_requests
|
|
484
|
+
- main
|
|
485
|
+
```
|
|
486
|
+
|
|
487
|
+
### GitLab CI - Download Workflow
|
|
488
|
+
|
|
489
|
+
```yaml
|
|
490
|
+
stages:
|
|
491
|
+
- download
|
|
492
|
+
- build
|
|
493
|
+
- upload
|
|
494
|
+
|
|
495
|
+
recce-download-base:
|
|
496
|
+
stage: download
|
|
497
|
+
image: python:3.11-slim
|
|
498
|
+
script:
|
|
499
|
+
- pip install recce-cloud
|
|
500
|
+
- recce-cloud download --prod --target-path target-base
|
|
501
|
+
artifacts:
|
|
502
|
+
paths:
|
|
503
|
+
- target-base/
|
|
504
|
+
only:
|
|
505
|
+
- merge_requests
|
|
506
|
+
|
|
507
|
+
dbt-build:
|
|
508
|
+
stage: build
|
|
509
|
+
image: python:3.11-slim
|
|
510
|
+
script:
|
|
511
|
+
- pip install dbt-core dbt-postgres
|
|
512
|
+
- dbt deps
|
|
513
|
+
- dbt build
|
|
514
|
+
- dbt docs generate
|
|
515
|
+
artifacts:
|
|
516
|
+
paths:
|
|
517
|
+
- target/
|
|
518
|
+
only:
|
|
519
|
+
- merge_requests
|
|
520
|
+
|
|
521
|
+
recce-upload:
|
|
522
|
+
stage: upload
|
|
523
|
+
image: python:3.11-slim
|
|
524
|
+
script:
|
|
525
|
+
- pip install recce-cloud
|
|
526
|
+
- recce-cloud upload
|
|
527
|
+
dependencies:
|
|
528
|
+
- dbt-build
|
|
529
|
+
only:
|
|
530
|
+
- merge_requests
|
|
531
|
+
```
|
|
532
|
+
|
|
533
|
+
### Generic CI Platform
|
|
534
|
+
|
|
535
|
+
For other CI platforms, use the generic workflow with session ID:
|
|
536
|
+
|
|
537
|
+
```yaml
|
|
538
|
+
# Upload
|
|
539
|
+
- name: Upload to Recce Cloud
|
|
540
|
+
script:
|
|
541
|
+
- pip install recce-cloud
|
|
542
|
+
- recce-cloud upload --session-id ${SESSION_ID}
|
|
543
|
+
environment:
|
|
544
|
+
RECCE_API_TOKEN: ${RECCE_API_TOKEN}
|
|
545
|
+
SESSION_ID: ${SESSION_ID}
|
|
546
|
+
|
|
547
|
+
# Download
|
|
548
|
+
- name: Download from Recce Cloud
|
|
549
|
+
script:
|
|
550
|
+
- pip install recce-cloud
|
|
551
|
+
- recce-cloud download --session-id ${SESSION_ID}
|
|
552
|
+
environment:
|
|
553
|
+
RECCE_API_TOKEN: ${RECCE_API_TOKEN}
|
|
554
|
+
SESSION_ID: ${SESSION_ID}
|
|
555
|
+
```
|
|
556
|
+
|
|
557
|
+
## Troubleshooting
|
|
558
|
+
|
|
559
|
+
### Common Issues
|
|
560
|
+
|
|
561
|
+
**1. Missing dbt artifacts**
|
|
562
|
+
|
|
563
|
+
```
|
|
564
|
+
Error: Invalid target path: target
|
|
565
|
+
Please provide a valid target path containing manifest.json and catalog.json.
|
|
566
|
+
```
|
|
567
|
+
|
|
568
|
+
**Solution:** Ensure `dbt docs generate` has been run successfully before upload.
|
|
569
|
+
|
|
570
|
+
```bash
|
|
571
|
+
dbt build
|
|
572
|
+
dbt docs generate # Required!
|
|
573
|
+
recce-cloud upload
|
|
574
|
+
```
|
|
575
|
+
|
|
576
|
+
**2. Authentication failed**
|
|
577
|
+
|
|
578
|
+
```
|
|
579
|
+
Error: No authentication token provided
|
|
580
|
+
Set RECCE_API_TOKEN environment variable or ensure CI token is available
|
|
581
|
+
```
|
|
582
|
+
|
|
583
|
+
**Solution:** Token requirements depend on your workflow type:
|
|
584
|
+
|
|
585
|
+
**For Generic Workflow (with `--session-id`):**
|
|
586
|
+
- Always requires explicit `RECCE_API_TOKEN`
|
|
587
|
+
|
|
588
|
+
```bash
|
|
589
|
+
# Set token and use session ID
|
|
590
|
+
export RECCE_API_TOKEN=your_token_here
|
|
591
|
+
recce-cloud upload --session-id abc123
|
|
592
|
+
recce-cloud download --session-id abc123
|
|
593
|
+
```
|
|
594
|
+
|
|
595
|
+
**For Platform-Specific Workflow:**
|
|
596
|
+
|
|
597
|
+
_GitHub CI_
|
|
598
|
+
- Use `GITHUB_TOKEN` (explicitly set)
|
|
599
|
+
|
|
600
|
+
```yaml
|
|
601
|
+
env:
|
|
602
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
603
|
+
```
|
|
604
|
+
|
|
605
|
+
**3. Platform not supported**
|
|
606
|
+
|
|
607
|
+
```
|
|
608
|
+
Error: Platform-specific upload requires GitHub Actions or GitLab CI environment
|
|
609
|
+
Detected platform: unknown
|
|
610
|
+
```
|
|
611
|
+
|
|
612
|
+
**Solution:** Use generic workflow with session ID, or run in supported CI platform.
|
|
613
|
+
|
|
614
|
+
```bash
|
|
615
|
+
recce-cloud upload --session-id abc123
|
|
616
|
+
```
|
|
617
|
+
|
|
618
|
+
**4. Session not found**
|
|
619
|
+
|
|
620
|
+
```
|
|
621
|
+
Error: Session ID abc123 does not belong to any organization.
|
|
622
|
+
```
|
|
623
|
+
|
|
624
|
+
**Solution:** Verify session ID is correct and accessible with your API token.
|
|
625
|
+
|
|
626
|
+
**5. GitLab self-hosted instance**
|
|
627
|
+
|
|
628
|
+
The CLI automatically detects self-hosted GitLab instances using `CI_SERVER_URL`.
|
|
629
|
+
|
|
630
|
+
```yaml
|
|
631
|
+
# No additional configuration needed
|
|
632
|
+
recce-upload:
|
|
633
|
+
script:
|
|
634
|
+
- recce-cloud upload
|
|
635
|
+
```
|
|
636
|
+
|
|
637
|
+
**6. Target path already exists (download)**
|
|
638
|
+
|
|
639
|
+
```
|
|
640
|
+
Error: Target path already exists: target
|
|
641
|
+
Use --force to overwrite existing directory
|
|
642
|
+
```
|
|
643
|
+
|
|
644
|
+
**Solution:** Use `--force` flag to overwrite existing files, or choose a different target path.
|
|
645
|
+
|
|
646
|
+
```bash
|
|
647
|
+
recce-cloud download --force
|
|
648
|
+
# OR
|
|
649
|
+
recce-cloud download --target-path target-new
|
|
650
|
+
```
|
|
651
|
+
|
|
652
|
+
**7. No production session available**
|
|
653
|
+
|
|
654
|
+
```
|
|
655
|
+
Error: No production session found for this project
|
|
656
|
+
```
|
|
657
|
+
|
|
658
|
+
**Solution:** Upload a production session first, or use a specific session ID.
|
|
659
|
+
|
|
660
|
+
```bash
|
|
661
|
+
# Upload production session (on main branch)
|
|
662
|
+
recce-cloud upload --type prod
|
|
663
|
+
|
|
664
|
+
# Or download from specific session
|
|
665
|
+
recce-cloud download --session-id abc123
|
|
666
|
+
```
|
|
667
|
+
|
|
668
|
+
### Debug Mode
|
|
669
|
+
|
|
670
|
+
Enable verbose logging for troubleshooting:
|
|
671
|
+
|
|
672
|
+
```bash
|
|
673
|
+
# Set log level to DEBUG
|
|
674
|
+
export RECCE_LOG_LEVEL=DEBUG
|
|
675
|
+
recce-cloud upload
|
|
676
|
+
```
|
|
677
|
+
|
|
678
|
+
## Architecture
|
|
679
|
+
|
|
680
|
+
### Platform-Specific APIs
|
|
681
|
+
|
|
682
|
+
The CLI uses platform-specific API endpoints for auto-session creation:
|
|
683
|
+
|
|
684
|
+
**GitHub Actions:**
|
|
685
|
+
|
|
686
|
+
- `POST /api/v2/github/{repository}/touch-recce-session`
|
|
687
|
+
- `POST /api/v2/github/{repository}/upload-completed`
|
|
688
|
+
|
|
689
|
+
**GitLab CI:**
|
|
690
|
+
|
|
691
|
+
- `POST /api/v2/gitlab/{project_path}/touch-recce-session`
|
|
692
|
+
- `POST /api/v2/gitlab/{project_path}/upload-completed`
|
|
693
|
+
|
|
694
|
+
### Upload Process
|
|
695
|
+
|
|
696
|
+
**Platform-Specific Workflow:**
|
|
697
|
+
|
|
698
|
+
1. Detect CI platform and extract context
|
|
699
|
+
2. Validate dbt artifacts
|
|
700
|
+
3. Extract adapter type from manifest
|
|
701
|
+
4. Authenticate with Recce Cloud API
|
|
702
|
+
5. Call `touch-recce-session` (creates or updates session)
|
|
703
|
+
6. Upload manifest.json to presigned S3 URL
|
|
704
|
+
7. Upload catalog.json to presigned S3 URL
|
|
705
|
+
8. Call `upload-completed` (notifies Recce Cloud)
|
|
706
|
+
|
|
707
|
+
**Generic Workflow:**
|
|
708
|
+
|
|
709
|
+
1. Detect CI platform (optional)
|
|
710
|
+
2. Validate dbt artifacts
|
|
711
|
+
3. Extract adapter type from manifest
|
|
712
|
+
4. Authenticate with Recce Cloud API
|
|
713
|
+
5. Get session info (org_id, project_id)
|
|
714
|
+
6. Get presigned upload URLs
|
|
715
|
+
7. Upload manifest.json to S3
|
|
716
|
+
8. Upload catalog.json to S3
|
|
717
|
+
9. Update session metadata
|
|
718
|
+
|
|
719
|
+
### Download Process
|
|
720
|
+
|
|
721
|
+
**Platform-Specific Workflow:**
|
|
722
|
+
|
|
723
|
+
1. Detect CI platform and extract context
|
|
724
|
+
2. Authenticate with Recce Cloud API
|
|
725
|
+
3. Call download API with PR/MR context
|
|
726
|
+
4. Get presigned download URLs and session ID
|
|
727
|
+
5. Create target directory (if needed)
|
|
728
|
+
6. Download manifest.json from S3
|
|
729
|
+
7. Download catalog.json from S3
|
|
730
|
+
|
|
731
|
+
**Generic Workflow (Session ID):**
|
|
732
|
+
|
|
733
|
+
1. Authenticate with Recce Cloud API
|
|
734
|
+
2. Get session info (org_id, project_id)
|
|
735
|
+
3. Get presigned download URLs by session ID
|
|
736
|
+
4. Create target directory (if needed)
|
|
737
|
+
5. Download manifest.json from S3
|
|
738
|
+
6. Download catalog.json from S3
|
|
739
|
+
|
|
740
|
+
## Development
|
|
741
|
+
|
|
742
|
+
### Running Tests
|
|
743
|
+
|
|
744
|
+
```bash
|
|
745
|
+
# Install development dependencies
|
|
746
|
+
pip install -e .[dev]
|
|
747
|
+
|
|
748
|
+
# Run tests
|
|
749
|
+
pytest tests/recce_cloud/
|
|
750
|
+
|
|
751
|
+
# Run with coverage
|
|
752
|
+
pytest --cov=recce_cloud --cov-report=html tests/recce_cloud/
|
|
753
|
+
|
|
754
|
+
# Run specific test file
|
|
755
|
+
pytest tests/recce_cloud/test_platform_clients.py
|
|
756
|
+
```
|
|
757
|
+
|
|
758
|
+
### Code Quality
|
|
759
|
+
|
|
760
|
+
```bash
|
|
761
|
+
# Format code
|
|
762
|
+
make format
|
|
763
|
+
|
|
764
|
+
# Run quality checks
|
|
765
|
+
make check
|
|
766
|
+
|
|
767
|
+
# Run all checks and tests
|
|
768
|
+
make test
|
|
769
|
+
```
|
|
770
|
+
|
|
771
|
+
## Support
|
|
772
|
+
|
|
773
|
+
- **Documentation:** [docs.reccehq.com](https://docs.reccehq.com)
|
|
774
|
+
- **Issues:** [GitHub Issues](https://github.com/DataRecce/recce/issues)
|
|
775
|
+
- **Community:** [Recce Slack](https://getdbt.slack.com/archives/C05C28V7CPP)
|
|
776
|
+
- **Email:** <support@reccehq.com>
|
|
777
|
+
|
|
778
|
+
## License
|
|
779
|
+
|
|
780
|
+
Apache License 2.0 - See [LICENSE](../LICENSE) file for details.
|