adop-cli 0.1.3__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.
- ado_pipeline/__init__.py +3 -0
- ado_pipeline/api.py +281 -0
- ado_pipeline/cli.py +1402 -0
- ado_pipeline/config.py +225 -0
- ado_pipeline/favorites.py +109 -0
- ado_pipeline/pipelines.py +154 -0
- ado_pipeline/plan.py +164 -0
- adop_cli-0.1.3.dist-info/METADATA +429 -0
- adop_cli-0.1.3.dist-info/RECORD +13 -0
- adop_cli-0.1.3.dist-info/WHEEL +5 -0
- adop_cli-0.1.3.dist-info/entry_points.txt +2 -0
- adop_cli-0.1.3.dist-info/licenses/LICENSE +21 -0
- adop_cli-0.1.3.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,429 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: adop-cli
|
|
3
|
+
Version: 0.1.3
|
|
4
|
+
Summary: CLI tool to trigger Azure DevOps pipelines
|
|
5
|
+
Requires-Python: >=3.10
|
|
6
|
+
Description-Content-Type: text/markdown
|
|
7
|
+
License-File: LICENSE
|
|
8
|
+
Requires-Dist: click>=8.0
|
|
9
|
+
Requires-Dist: rich>=13.0
|
|
10
|
+
Requires-Dist: requests>=2.28
|
|
11
|
+
Provides-Extra: dev
|
|
12
|
+
Requires-Dist: pytest>=7.0; extra == "dev"
|
|
13
|
+
Dynamic: license-file
|
|
14
|
+
|
|
15
|
+
# Azure DevOps Pipeline CLI
|
|
16
|
+
|
|
17
|
+
A command-line tool to trigger and manage Azure DevOps pipelines with ease.
|
|
18
|
+
|
|
19
|
+
## Features
|
|
20
|
+
|
|
21
|
+
- **Trigger Pipelines** - Start builds with a single command
|
|
22
|
+
- **Watch Progress** - Real-time build status with progress bar
|
|
23
|
+
- **Build Management** - View status, logs, cancel, compare builds
|
|
24
|
+
- **Favorites** - Save and reuse common build configurations
|
|
25
|
+
- **Shell Completion** - Tab-complete pipeline aliases and branches
|
|
26
|
+
- **Fuzzy Matching** - Suggests corrections for typos
|
|
27
|
+
|
|
28
|
+
## Installation
|
|
29
|
+
|
|
30
|
+
### Homebrew (macOS/Linux)
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
brew tap SAGARSURI/tap
|
|
34
|
+
brew install adop-cli
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### pip
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
pip install adop-cli
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### From Source
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
git clone https://github.com/SAGARSURI/adop.git
|
|
47
|
+
cd adop
|
|
48
|
+
python3 -m venv .venv
|
|
49
|
+
source .venv/bin/activate
|
|
50
|
+
pip install -e .
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Setup
|
|
54
|
+
|
|
55
|
+
### 1. Configure Azure DevOps Connection
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
ado-pipeline config init
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
You'll be prompted to enter:
|
|
62
|
+
- **Organization** - Your Azure DevOps organization name
|
|
63
|
+
- **Project** - Your Azure DevOps project name
|
|
64
|
+
- **PAT** - Personal Access Token
|
|
65
|
+
|
|
66
|
+
**Required PAT Permissions:**
|
|
67
|
+
- Build: Read & execute
|
|
68
|
+
- Code: Read
|
|
69
|
+
- User Profile: Read (optional, for `--mine` flag)
|
|
70
|
+
|
|
71
|
+
### 2. Add Pipelines
|
|
72
|
+
|
|
73
|
+
After configuring, add pipelines you want to manage:
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
# Import pipelines from Azure DevOps (interactive)
|
|
77
|
+
ado-pipeline pipeline import
|
|
78
|
+
|
|
79
|
+
# Or add manually
|
|
80
|
+
ado-pipeline pipeline add my-build "My Pipeline Name" --description "Build description"
|
|
81
|
+
|
|
82
|
+
# Add with parameters
|
|
83
|
+
ado-pipeline pipeline add android-build "Android_Build" \
|
|
84
|
+
--param "outputFormat:choice:apk:apk,aab" \
|
|
85
|
+
--param "deploy:boolean:false" \
|
|
86
|
+
--param "releaseNotes:string:"
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### 3. Enable Shell Completion (Optional)
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
# Bash - add to ~/.bashrc
|
|
93
|
+
eval "$(_ADO_PIPELINE_COMPLETE=bash_source ado-pipeline)"
|
|
94
|
+
|
|
95
|
+
# Zsh - add to ~/.zshrc
|
|
96
|
+
eval "$(_ADO_PIPELINE_COMPLETE=zsh_source ado-pipeline)"
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
This enables tab-completion for pipeline aliases and git branches.
|
|
100
|
+
|
|
101
|
+
## Quick Start
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
# List available pipelines
|
|
105
|
+
ado-pipeline list
|
|
106
|
+
|
|
107
|
+
# See what would be triggered (dry-run)
|
|
108
|
+
ado-pipeline plan my-build
|
|
109
|
+
|
|
110
|
+
# Trigger a build
|
|
111
|
+
ado-pipeline apply my-build
|
|
112
|
+
|
|
113
|
+
# Trigger and watch progress
|
|
114
|
+
ado-pipeline apply my-build -y -w
|
|
115
|
+
|
|
116
|
+
# Check build status
|
|
117
|
+
ado-pipeline status
|
|
118
|
+
|
|
119
|
+
# Open build in browser
|
|
120
|
+
ado-pipeline open <BUILD_ID>
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
## Commands
|
|
124
|
+
|
|
125
|
+
### Trigger Pipelines
|
|
126
|
+
|
|
127
|
+
#### Plan Mode (Dry Run)
|
|
128
|
+
|
|
129
|
+
Preview what will be triggered without making API calls:
|
|
130
|
+
|
|
131
|
+
```bash
|
|
132
|
+
ado-pipeline plan my-build
|
|
133
|
+
ado-pipeline plan my-build --branch feature/my-feature
|
|
134
|
+
ado-pipeline plan my-build --branch main --deploy
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
#### Apply Mode (Trigger)
|
|
138
|
+
|
|
139
|
+
Actually trigger the pipeline:
|
|
140
|
+
|
|
141
|
+
```bash
|
|
142
|
+
# Basic trigger (prompts for confirmation)
|
|
143
|
+
ado-pipeline apply my-build
|
|
144
|
+
|
|
145
|
+
# Skip confirmation
|
|
146
|
+
ado-pipeline apply my-build -y
|
|
147
|
+
|
|
148
|
+
# Skip confirmation and watch progress
|
|
149
|
+
ado-pipeline apply my-build -y -w
|
|
150
|
+
|
|
151
|
+
# With options
|
|
152
|
+
ado-pipeline apply my-build --branch main --deploy --output-format aab
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
### Build Management
|
|
156
|
+
|
|
157
|
+
#### View Build Status
|
|
158
|
+
|
|
159
|
+
```bash
|
|
160
|
+
# Show recent builds
|
|
161
|
+
ado-pipeline status
|
|
162
|
+
|
|
163
|
+
# Show more builds
|
|
164
|
+
ado-pipeline status -n 20
|
|
165
|
+
|
|
166
|
+
# Filter by pipeline
|
|
167
|
+
ado-pipeline status -p my-build
|
|
168
|
+
|
|
169
|
+
# Show only your builds
|
|
170
|
+
ado-pipeline status --mine
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
#### View Build Logs
|
|
174
|
+
|
|
175
|
+
```bash
|
|
176
|
+
# Show logs for a build
|
|
177
|
+
ado-pipeline logs <BUILD_ID>
|
|
178
|
+
|
|
179
|
+
# Stream logs in real-time
|
|
180
|
+
ado-pipeline logs <BUILD_ID> -f
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
#### Cancel a Build
|
|
184
|
+
|
|
185
|
+
```bash
|
|
186
|
+
ado-pipeline cancel <BUILD_ID>
|
|
187
|
+
ado-pipeline cancel <BUILD_ID> -y # Skip confirmation
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
#### Open Build in Browser
|
|
191
|
+
|
|
192
|
+
```bash
|
|
193
|
+
ado-pipeline open <BUILD_ID>
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
#### Compare Two Builds
|
|
197
|
+
|
|
198
|
+
```bash
|
|
199
|
+
ado-pipeline diff <BUILD_ID_1> <BUILD_ID_2>
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
Shows side-by-side comparison of pipeline, branch, result, duration, and parameters.
|
|
203
|
+
|
|
204
|
+
### Pipeline Management
|
|
205
|
+
|
|
206
|
+
#### List Configured Pipelines
|
|
207
|
+
|
|
208
|
+
```bash
|
|
209
|
+
ado-pipeline pipeline list
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
#### Add a Pipeline
|
|
213
|
+
|
|
214
|
+
```bash
|
|
215
|
+
# Basic
|
|
216
|
+
ado-pipeline pipeline add <alias> "<Azure DevOps Pipeline Name>"
|
|
217
|
+
|
|
218
|
+
# With description
|
|
219
|
+
ado-pipeline pipeline add my-build "My_Build_Pipeline" --description "Main build"
|
|
220
|
+
|
|
221
|
+
# With parameters
|
|
222
|
+
ado-pipeline pipeline add my-build "My_Build_Pipeline" \
|
|
223
|
+
--param "outputFormat:choice:apk:apk,aab" \
|
|
224
|
+
--param "deploy:boolean:false" \
|
|
225
|
+
--param "environment:string:dev"
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
Parameter format: `name:type:default[:choices]`
|
|
229
|
+
- Types: `string`, `boolean`, `choice`
|
|
230
|
+
- For choice type, add comma-separated options after default
|
|
231
|
+
|
|
232
|
+
#### Import from Azure DevOps
|
|
233
|
+
|
|
234
|
+
```bash
|
|
235
|
+
# Interactive import from remote
|
|
236
|
+
ado-pipeline pipeline import
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
This fetches available pipelines from Azure DevOps and lets you add them interactively.
|
|
240
|
+
|
|
241
|
+
#### Remove a Pipeline
|
|
242
|
+
|
|
243
|
+
```bash
|
|
244
|
+
ado-pipeline pipeline remove <alias>
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
### Favorites
|
|
248
|
+
|
|
249
|
+
Save frequently used build configurations for quick access.
|
|
250
|
+
|
|
251
|
+
#### Save a Favorite
|
|
252
|
+
|
|
253
|
+
```bash
|
|
254
|
+
# Save with deploy enabled
|
|
255
|
+
ado-pipeline fav add quick-build my-build --deploy
|
|
256
|
+
|
|
257
|
+
# Save with specific branch
|
|
258
|
+
ado-pipeline fav add release-build my-prod --branch main --deploy
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
#### List Favorites
|
|
262
|
+
|
|
263
|
+
```bash
|
|
264
|
+
ado-pipeline fav list
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
#### Run a Favorite
|
|
268
|
+
|
|
269
|
+
```bash
|
|
270
|
+
ado-pipeline fav run quick-build
|
|
271
|
+
ado-pipeline fav run quick-build -y -w # Skip confirmation + watch
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
#### Remove a Favorite
|
|
275
|
+
|
|
276
|
+
```bash
|
|
277
|
+
ado-pipeline fav remove quick-build
|
|
278
|
+
```
|
|
279
|
+
|
|
280
|
+
### Configuration
|
|
281
|
+
|
|
282
|
+
```bash
|
|
283
|
+
# Initialize or update configuration
|
|
284
|
+
ado-pipeline config init
|
|
285
|
+
|
|
286
|
+
# Show current configuration
|
|
287
|
+
ado-pipeline config show
|
|
288
|
+
```
|
|
289
|
+
|
|
290
|
+
## Parameters
|
|
291
|
+
|
|
292
|
+
Parameters are defined per-pipeline when you add them. Common parameter types:
|
|
293
|
+
|
|
294
|
+
| Type | Description | Example |
|
|
295
|
+
|------|-------------|---------|
|
|
296
|
+
| `string` | Free text input | `--release-notes "Bug fixes"` |
|
|
297
|
+
| `boolean` | True/false flag | `--deploy` / `--no-deploy` |
|
|
298
|
+
| `choice` | Select from options | `--output-format apk` |
|
|
299
|
+
|
|
300
|
+
### Common Options
|
|
301
|
+
|
|
302
|
+
| Option | Description |
|
|
303
|
+
|--------|-------------|
|
|
304
|
+
| `--branch`, `-b` | Branch to build (default: current branch) |
|
|
305
|
+
| `--yes`, `-y` | Skip confirmation prompt |
|
|
306
|
+
| `--watch`, `-w` | Watch build progress until completion |
|
|
307
|
+
|
|
308
|
+
## Configuration Files
|
|
309
|
+
|
|
310
|
+
| File | Purpose |
|
|
311
|
+
|------|---------|
|
|
312
|
+
| `~/.azure-pipeline-cli/config.json` | PAT and organization settings |
|
|
313
|
+
| `~/.azure-pipeline-cli/pipelines.json` | Pipeline definitions |
|
|
314
|
+
| `~/.azure-pipeline-cli/favorites.json` | Saved favorite configurations |
|
|
315
|
+
|
|
316
|
+
All files have `0600` permissions (owner read/write only) since they may contain sensitive data.
|
|
317
|
+
|
|
318
|
+
## Troubleshooting
|
|
319
|
+
|
|
320
|
+
### "Pipeline not found"
|
|
321
|
+
|
|
322
|
+
The CLI suggests similar names if you make a typo:
|
|
323
|
+
```
|
|
324
|
+
Error: Pipeline 'my-bild' not found. Did you mean: my-build?
|
|
325
|
+
```
|
|
326
|
+
|
|
327
|
+
Run `ado-pipeline pipeline list` to see all available aliases.
|
|
328
|
+
|
|
329
|
+
### "No pipelines configured"
|
|
330
|
+
|
|
331
|
+
Add pipelines first:
|
|
332
|
+
```bash
|
|
333
|
+
ado-pipeline pipeline import # Import from Azure DevOps
|
|
334
|
+
# or
|
|
335
|
+
ado-pipeline pipeline add <alias> "<pipeline-name>"
|
|
336
|
+
```
|
|
337
|
+
|
|
338
|
+
### "PAT not configured"
|
|
339
|
+
|
|
340
|
+
Run `ado-pipeline config init` and enter your credentials.
|
|
341
|
+
|
|
342
|
+
### "Branch not found"
|
|
343
|
+
|
|
344
|
+
The branch must exist on the remote. Push it first:
|
|
345
|
+
```bash
|
|
346
|
+
git push -u origin <branch>
|
|
347
|
+
```
|
|
348
|
+
|
|
349
|
+
### "Could not determine current user"
|
|
350
|
+
|
|
351
|
+
The `--mine` flag requires User Profile read permission on your PAT. The command will continue without filtering if this fails.
|
|
352
|
+
|
|
353
|
+
### Shell completion not working
|
|
354
|
+
|
|
355
|
+
Make sure you've added the eval command to your shell config and restarted your terminal.
|
|
356
|
+
|
|
357
|
+
### Build stuck or need to cancel
|
|
358
|
+
|
|
359
|
+
```bash
|
|
360
|
+
ado-pipeline cancel <BUILD_ID> -y
|
|
361
|
+
```
|
|
362
|
+
|
|
363
|
+
## Development
|
|
364
|
+
|
|
365
|
+
### Setup
|
|
366
|
+
|
|
367
|
+
```bash
|
|
368
|
+
git clone https://github.com/SAGARSURI/adop.git
|
|
369
|
+
cd adop
|
|
370
|
+
python3 -m venv .venv
|
|
371
|
+
source .venv/bin/activate
|
|
372
|
+
pip install -e ".[dev]"
|
|
373
|
+
```
|
|
374
|
+
|
|
375
|
+
### Running Tests
|
|
376
|
+
|
|
377
|
+
```bash
|
|
378
|
+
pytest tests/ -v
|
|
379
|
+
```
|
|
380
|
+
|
|
381
|
+
### Project Structure
|
|
382
|
+
|
|
383
|
+
```
|
|
384
|
+
src/ado_pipeline/
|
|
385
|
+
├── __init__.py # Version
|
|
386
|
+
├── api.py # Azure DevOps API client
|
|
387
|
+
├── cli.py # CLI commands (click)
|
|
388
|
+
├── config.py # Configuration management
|
|
389
|
+
├── favorites.py # Favorites system
|
|
390
|
+
├── pipelines.py # Pipeline definitions
|
|
391
|
+
└── plan.py # Execution plan generation
|
|
392
|
+
```
|
|
393
|
+
|
|
394
|
+
## CI/CD
|
|
395
|
+
|
|
396
|
+
### Automated Testing
|
|
397
|
+
|
|
398
|
+
Tests run automatically on:
|
|
399
|
+
- Push to `main`
|
|
400
|
+
- Pull requests to `main`
|
|
401
|
+
|
|
402
|
+
Tests run against Python 3.10, 3.11, and 3.12.
|
|
403
|
+
|
|
404
|
+
[](https://github.com/SAGARSURI/adop/actions/workflows/ci.yml)
|
|
405
|
+
|
|
406
|
+
### Releasing
|
|
407
|
+
|
|
408
|
+
Releases are automated via GitHub Actions:
|
|
409
|
+
|
|
410
|
+
1. Update version in `pyproject.toml`
|
|
411
|
+
2. Commit and tag:
|
|
412
|
+
```bash
|
|
413
|
+
git add pyproject.toml
|
|
414
|
+
git commit -m "chore: bump version to X.Y.Z"
|
|
415
|
+
git tag vX.Y.Z
|
|
416
|
+
git push origin main --tags
|
|
417
|
+
```
|
|
418
|
+
3. The release workflow automatically:
|
|
419
|
+
- Runs tests
|
|
420
|
+
- Publishes to PyPI
|
|
421
|
+
- Updates Homebrew tap
|
|
422
|
+
|
|
423
|
+
## Contributing
|
|
424
|
+
|
|
425
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.
|
|
426
|
+
|
|
427
|
+
## License
|
|
428
|
+
|
|
429
|
+
MIT License - see [LICENSE](LICENSE) for details.
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
ado_pipeline/__init__.py,sha256=tzGtIYUZ6OvzngkK0U7ARyBhiwqb8XjTSyzBSxV_biY,64
|
|
2
|
+
ado_pipeline/api.py,sha256=XwmQjqISxwT3AbYTH_nbvGZECFUr6foVIDquNKShw5A,8971
|
|
3
|
+
ado_pipeline/cli.py,sha256=P9OQmNenKn7KbM5hbBulCy3t_A2ARtTtZoTnggGh1lY,44351
|
|
4
|
+
ado_pipeline/config.py,sha256=SHBxV3klX_wI5F5YyLp_1meFoikFo7GZZNGAxfaCgK0,6491
|
|
5
|
+
ado_pipeline/favorites.py,sha256=_YyonRerHTVKSGSHn3HAKYa1clcMykmaIdvQDtrrU2U,3315
|
|
6
|
+
ado_pipeline/pipelines.py,sha256=rPEN6yKilNN9a5w79DUP4kXs8TLgdC3qSZ5onU4-rLU,4990
|
|
7
|
+
ado_pipeline/plan.py,sha256=HUkxO16FKGyi8muBm1GLOxgDt5rSjXqD1oC1EtUHcXQ,4799
|
|
8
|
+
adop_cli-0.1.3.dist-info/licenses/LICENSE,sha256=dUhuoK-TCRQMpuLEAdfme-qPSJI0TlcH9jlNxeg9_EQ,1056
|
|
9
|
+
adop_cli-0.1.3.dist-info/METADATA,sha256=-FvEihTEmtrVFMDDIFMbCsZCpSbGvRJBVlIl0mdaoY4,8984
|
|
10
|
+
adop_cli-0.1.3.dist-info/WHEEL,sha256=qELbo2s1Yzl39ZmrAibXA2jjPLUYfnVhUNTlyF1rq0Y,92
|
|
11
|
+
adop_cli-0.1.3.dist-info/entry_points.txt,sha256=O_LBtUGzJ5E06wf6Te8v2l79F3JsXZ2-LjGv3ZtD1hI,55
|
|
12
|
+
adop_cli-0.1.3.dist-info/top_level.txt,sha256=lWHKTJxtd4lYXhOUvLMB0oSo-3bThqnK-gpr1VB-LSU,13
|
|
13
|
+
adop_cli-0.1.3.dist-info/RECORD,,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
ado_pipeline
|