mystack-rig 1.0.0__tar.gz → 1.2.0__tar.gz
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.
- mystack_rig-1.2.0/GLOSSARY.md +21 -0
- {mystack_rig-1.0.0 → mystack_rig-1.2.0}/Makefile +28 -19
- {mystack_rig-1.0.0 → mystack_rig-1.2.0}/PKG-INFO +31 -13
- {mystack_rig-1.0.0 → mystack_rig-1.2.0}/README.md +30 -12
- mystack_rig-1.2.0/docs/adr/0001-per-profile-generated-state-bucket.md +23 -0
- {mystack_rig-1.0.0 → mystack_rig-1.2.0}/src/cli/main.py +82 -22
- {mystack_rig-1.0.0 → mystack_rig-1.2.0}/src/cli/remote_dev.py +584 -188
- mystack_rig-1.2.0/src/cli/state_bucket.py +118 -0
- {mystack_rig-1.0.0 → mystack_rig-1.2.0}/src/cli/storage.py +21 -2
- {mystack_rig-1.0.0 → mystack_rig-1.2.0}/src/mystack_rig.egg-info/PKG-INFO +31 -13
- {mystack_rig-1.0.0 → mystack_rig-1.2.0}/src/mystack_rig.egg-info/SOURCES.txt +4 -0
- {mystack_rig-1.0.0 → mystack_rig-1.2.0}/src/mystack_rig.egg-info/scm_file_list.json +4 -0
- mystack_rig-1.2.0/src/mystack_rig.egg-info/scm_version.json +8 -0
- {mystack_rig-1.0.0 → mystack_rig-1.2.0}/tests/conftest.py +11 -0
- {mystack_rig-1.0.0 → mystack_rig-1.2.0}/tests/test_attach_command.py +1 -1
- {mystack_rig-1.0.0 → mystack_rig-1.2.0}/tests/test_destroy_command.py +22 -7
- mystack_rig-1.2.0/tests/test_firewall_client_ip.py +492 -0
- {mystack_rig-1.0.0 → mystack_rig-1.2.0}/tests/test_init_command.py +72 -1
- {mystack_rig-1.0.0 → mystack_rig-1.2.0}/tests/test_main_coverage.py +26 -5
- {mystack_rig-1.0.0 → mystack_rig-1.2.0}/tests/test_remote_dev.py +0 -18
- {mystack_rig-1.0.0 → mystack_rig-1.2.0}/tests/test_remote_dev_coverage_extensions.py +90 -7
- {mystack_rig-1.0.0 → mystack_rig-1.2.0}/tests/test_rig_ansible_vars.py +8 -0
- {mystack_rig-1.0.0 → mystack_rig-1.2.0}/tests/test_setup_provision.py +79 -1
- mystack_rig-1.2.0/tests/test_state_bucket.py +463 -0
- {mystack_rig-1.0.0 → mystack_rig-1.2.0}/tests/test_storage_basic.py +42 -0
- mystack_rig-1.0.0/src/mystack_rig.egg-info/scm_version.json +0 -8
- mystack_rig-1.0.0/tests/test_firewall_client_ip.py +0 -259
- {mystack_rig-1.0.0 → mystack_rig-1.2.0}/.coveragerc +0 -0
- {mystack_rig-1.0.0 → mystack_rig-1.2.0}/.flake8 +0 -0
- {mystack_rig-1.0.0 → mystack_rig-1.2.0}/.github/workflows/release.yml +0 -0
- {mystack_rig-1.0.0 → mystack_rig-1.2.0}/.github/workflows/tests.yml +0 -0
- {mystack_rig-1.0.0 → mystack_rig-1.2.0}/.gitignore +0 -0
- {mystack_rig-1.0.0 → mystack_rig-1.2.0}/.rig/playbooks/README.md +0 -0
- {mystack_rig-1.0.0 → mystack_rig-1.2.0}/.rig/playbooks/vpn-gateway.yml +0 -0
- {mystack_rig-1.0.0 → mystack_rig-1.2.0}/CLI_STORAGE_SUMMARY.md +0 -0
- {mystack_rig-1.0.0 → mystack_rig-1.2.0}/Dockerfile +0 -0
- {mystack_rig-1.0.0 → mystack_rig-1.2.0}/GIT_CLONE_FEATURE.md +0 -0
- {mystack_rig-1.0.0 → mystack_rig-1.2.0}/HETZNER_STORAGE_GUIDE.md +0 -0
- {mystack_rig-1.0.0 → mystack_rig-1.2.0}/HETZNER_STORAGE_SECURITY_GUIDE.md +0 -0
- {mystack_rig-1.0.0 → mystack_rig-1.2.0}/LICENSE +0 -0
- {mystack_rig-1.0.0 → mystack_rig-1.2.0}/README_REAL_E2E.md +0 -0
- {mystack_rig-1.0.0 → mystack_rig-1.2.0}/STORAGE_CLI_GUIDE.md +0 -0
- {mystack_rig-1.0.0 → mystack_rig-1.2.0}/docs/architecture.md +0 -0
- {mystack_rig-1.0.0 → mystack_rig-1.2.0}/docs/architecture.png +0 -0
- {mystack_rig-1.0.0 → mystack_rig-1.2.0}/docs/architecture.svg +0 -0
- {mystack_rig-1.0.0 → mystack_rig-1.2.0}/forged-idea.md +0 -0
- {mystack_rig-1.0.0 → mystack_rig-1.2.0}/pyproject.toml +0 -0
- {mystack_rig-1.0.0 → mystack_rig-1.2.0}/pytest.ini +0 -0
- {mystack_rig-1.0.0 → mystack_rig-1.2.0}/requirements.txt +0 -0
- {mystack_rig-1.0.0 → mystack_rig-1.2.0}/sample.env +0 -0
- {mystack_rig-1.0.0 → mystack_rig-1.2.0}/scripts/coverage_badge.py +0 -0
- {mystack_rig-1.0.0 → mystack_rig-1.2.0}/scripts/pypi_version.py +0 -0
- {mystack_rig-1.0.0 → mystack_rig-1.2.0}/setup.cfg +0 -0
- {mystack_rig-1.0.0 → mystack_rig-1.2.0}/src/__init__.py +0 -0
- {mystack_rig-1.0.0 → mystack_rig-1.2.0}/src/cli/__init__.py +0 -0
- {mystack_rig-1.0.0 → mystack_rig-1.2.0}/src/cli/__main__.py +0 -0
- {mystack_rig-1.0.0 → mystack_rig-1.2.0}/src/cli/agents.py +0 -0
- {mystack_rig-1.0.0 → mystack_rig-1.2.0}/src/cli/config.py +0 -0
- {mystack_rig-1.0.0 → mystack_rig-1.2.0}/src/cli/encrypt.py +0 -0
- {mystack_rig-1.0.0 → mystack_rig-1.2.0}/src/cli/git.py +0 -0
- {mystack_rig-1.0.0 → mystack_rig-1.2.0}/src/cli/last_env.py +0 -0
- {mystack_rig-1.0.0 → mystack_rig-1.2.0}/src/cli/last_session.py +0 -0
- {mystack_rig-1.0.0 → mystack_rig-1.2.0}/src/cli/log.py +0 -0
- {mystack_rig-1.0.0 → mystack_rig-1.2.0}/src/cli/requirements.txt +0 -0
- {mystack_rig-1.0.0 → mystack_rig-1.2.0}/src/cli/snapshots.py +0 -0
- {mystack_rig-1.0.0 → mystack_rig-1.2.0}/src/cli/vault_keys.py +0 -0
- {mystack_rig-1.0.0 → mystack_rig-1.2.0}/src/cli/vpn.py +0 -0
- {mystack_rig-1.0.0 → mystack_rig-1.2.0}/src/mystack_rig.egg-info/dependency_links.txt +0 -0
- {mystack_rig-1.0.0 → mystack_rig-1.2.0}/src/mystack_rig.egg-info/entry_points.txt +0 -0
- {mystack_rig-1.0.0 → mystack_rig-1.2.0}/src/mystack_rig.egg-info/requires.txt +0 -0
- {mystack_rig-1.0.0 → mystack_rig-1.2.0}/src/mystack_rig.egg-info/top_level.txt +0 -0
- {mystack_rig-1.0.0 → mystack_rig-1.2.0}/test_hetzner_integration.py +0 -0
- {mystack_rig-1.0.0 → mystack_rig-1.2.0}/tests/test_agents.py +0 -0
- {mystack_rig-1.0.0 → mystack_rig-1.2.0}/tests/test_ansible_galaxy.py +0 -0
- {mystack_rig-1.0.0 → mystack_rig-1.2.0}/tests/test_credential_security.py +0 -0
- {mystack_rig-1.0.0 → mystack_rig-1.2.0}/tests/test_dev_command.py +0 -0
- {mystack_rig-1.0.0 → mystack_rig-1.2.0}/tests/test_encrypt_command.py +0 -0
- {mystack_rig-1.0.0 → mystack_rig-1.2.0}/tests/test_encrypt_coverage.py +0 -0
- {mystack_rig-1.0.0 → mystack_rig-1.2.0}/tests/test_git_clone_unit.py +0 -0
- {mystack_rig-1.0.0 → mystack_rig-1.2.0}/tests/test_git_manager.py +0 -0
- {mystack_rig-1.0.0 → mystack_rig-1.2.0}/tests/test_gitignore_init.py +0 -0
- {mystack_rig-1.0.0 → mystack_rig-1.2.0}/tests/test_hetzner_storage.py +0 -0
- {mystack_rig-1.0.0 → mystack_rig-1.2.0}/tests/test_last_env.py +0 -0
- {mystack_rig-1.0.0 → mystack_rig-1.2.0}/tests/test_last_session.py +0 -0
- {mystack_rig-1.0.0 → mystack_rig-1.2.0}/tests/test_log.py +0 -0
- {mystack_rig-1.0.0 → mystack_rig-1.2.0}/tests/test_pypi_version.py +0 -0
- {mystack_rig-1.0.0 → mystack_rig-1.2.0}/tests/test_real_e2e_integration.py +0 -0
- {mystack_rig-1.0.0 → mystack_rig-1.2.0}/tests/test_real_e2e_storage.py +0 -0
- {mystack_rig-1.0.0 → mystack_rig-1.2.0}/tests/test_real_e2e_vpn.py +0 -0
- {mystack_rig-1.0.0 → mystack_rig-1.2.0}/tests/test_real_e2e_vpn_tunnel.py +0 -0
- {mystack_rig-1.0.0 → mystack_rig-1.2.0}/tests/test_rig_config.py +0 -0
- {mystack_rig-1.0.0 → mystack_rig-1.2.0}/tests/test_simulation_storage.py +0 -0
- {mystack_rig-1.0.0 → mystack_rig-1.2.0}/tests/test_small_module_coverage.py +0 -0
- {mystack_rig-1.0.0 → mystack_rig-1.2.0}/tests/test_snapshots.py +0 -0
- {mystack_rig-1.0.0 → mystack_rig-1.2.0}/tests/test_vault_keys.py +0 -0
- {mystack_rig-1.0.0 → mystack_rig-1.2.0}/tests/test_vpn_optional.py +0 -0
- {mystack_rig-1.0.0 → mystack_rig-1.2.0}/tests/test_vpn_unit.py +0 -0
- {mystack_rig-1.0.0 → mystack_rig-1.2.0}/tests/test_workspace_git_clone.py +0 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# Rig
|
|
2
|
+
|
|
3
|
+
Rig provisions and tracks remote development environments on Hetzner Cloud for a team.
|
|
4
|
+
|
|
5
|
+
## Language
|
|
6
|
+
|
|
7
|
+
**Profile**:
|
|
8
|
+
A named set of credentials for one Hetzner Cloud project, stored in the developer's personal rig config.
|
|
9
|
+
_Avoid_: Installation, account
|
|
10
|
+
|
|
11
|
+
**State bucket**:
|
|
12
|
+
The storage bucket holding environment state for one Profile within one workspace, shared by everyone working in that workspace.
|
|
13
|
+
_Avoid_: Production bucket, installation bucket
|
|
14
|
+
|
|
15
|
+
**Workspace**:
|
|
16
|
+
A project repository containing a `.rig/` directory, which owns its own State buckets.
|
|
17
|
+
_Avoid_: Project (ambiguous with a Hetzner Cloud project)
|
|
18
|
+
|
|
19
|
+
**Test bucket**:
|
|
20
|
+
A throwaway state bucket used only by automated test runs.
|
|
21
|
+
_Avoid_: Dev bucket
|
|
@@ -1,44 +1,53 @@
|
|
|
1
|
-
|
|
1
|
+
VENV := .venv
|
|
2
|
+
PY := $(VENV)/bin/python3
|
|
3
|
+
|
|
4
|
+
.PHONY: venv install test test-e2e test-remote-dev test-remote-dev-e2e coverage run lint clean
|
|
5
|
+
|
|
6
|
+
# Create local venv (avoids PEP 668 on Homebrew/system Python)
|
|
7
|
+
venv: $(PY)
|
|
8
|
+
|
|
9
|
+
$(PY):
|
|
10
|
+
python3 -m venv $(VENV)
|
|
2
11
|
|
|
3
12
|
# Install dependencies
|
|
4
|
-
install:
|
|
5
|
-
pip install -r requirements.txt
|
|
6
|
-
pip install -e .
|
|
13
|
+
install: venv
|
|
14
|
+
$(PY) -m pip install -r requirements.txt
|
|
15
|
+
$(PY) -m pip install -e .
|
|
7
16
|
|
|
8
17
|
# Run the CLI
|
|
9
|
-
run:
|
|
10
|
-
|
|
18
|
+
run: venv
|
|
19
|
+
$(PY) -m cli.main
|
|
11
20
|
|
|
12
21
|
# Run tests
|
|
13
|
-
test:
|
|
14
|
-
|
|
22
|
+
test: venv
|
|
23
|
+
$(PY) -m pytest tests/
|
|
15
24
|
|
|
16
25
|
# Measure src coverage and refresh the README badge
|
|
17
|
-
coverage:
|
|
18
|
-
|
|
26
|
+
coverage: venv
|
|
27
|
+
$(PY) -m pytest tests/ --cov=src --cov-report=term-missing --cov-report=xml \
|
|
19
28
|
--ignore=tests/test_real_e2e_integration.py \
|
|
20
29
|
--ignore=tests/test_real_e2e_storage.py \
|
|
21
30
|
--ignore=tests/test_hetzner_storage.py \
|
|
22
31
|
--ignore=tests/test_workspace_git_clone.py \
|
|
23
32
|
--ignore=tests/test_real_e2e_vpn.py \
|
|
24
33
|
--ignore=tests/test_real_e2e_vpn_tunnel.py
|
|
25
|
-
|
|
34
|
+
$(PY) scripts/coverage_badge.py --write
|
|
26
35
|
|
|
27
36
|
# Run E2E tests with Hetzner integration
|
|
28
|
-
test-e2e:
|
|
29
|
-
|
|
37
|
+
test-e2e: venv
|
|
38
|
+
$(PY) test_hetzner_integration.py
|
|
30
39
|
|
|
31
40
|
# Run remote dev unit tests
|
|
32
|
-
test-remote-dev:
|
|
33
|
-
|
|
41
|
+
test-remote-dev: venv
|
|
42
|
+
$(PY) -m pytest tests/test_remote_dev.py -v
|
|
34
43
|
|
|
35
44
|
# Run remote dev E2E tests
|
|
36
|
-
test-remote-dev-e2e:
|
|
37
|
-
|
|
45
|
+
test-remote-dev-e2e: venv
|
|
46
|
+
$(PY) -m pytest tests/test_workspace_git_clone.py -v -m e2e
|
|
38
47
|
|
|
39
48
|
# Run linting
|
|
40
|
-
lint:
|
|
41
|
-
pylint src/
|
|
49
|
+
lint: venv
|
|
50
|
+
$(PY) -m pylint src/
|
|
42
51
|
|
|
43
52
|
# Clean build artifacts
|
|
44
53
|
clean:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: mystack-rig
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.2.0
|
|
4
4
|
Summary: Ephemeral remotes with full local parity for coding agents
|
|
5
5
|
Author: mystack-cloud
|
|
6
6
|
License-Expression: MIT
|
|
@@ -21,6 +21,7 @@ Requires-Dist: cryptography>=41.0.0
|
|
|
21
21
|
Requires-Dist: importlib-metadata>=4.0; python_version < "3.8"
|
|
22
22
|
Dynamic: license-file
|
|
23
23
|
|
|
24
|
+
[](https://pypi.org/project/mystack-rig/)
|
|
24
25
|
[](https://github.com/mystack-cloud/rig/actions/workflows/tests.yml)
|
|
25
26
|
[](https://codecov.io/gh/mystack-cloud/rig)
|
|
26
27
|
|
|
@@ -34,8 +35,6 @@ rig init
|
|
|
34
35
|
rig create
|
|
35
36
|
```
|
|
36
37
|
|
|
37
|
-
The published project name is `mystack-rig` (the PyPI name `rig` belongs to another project). The command is still `rig`. From a checkout, `pip install .` installs the same command.
|
|
38
|
-
|
|
39
38
|
## Architecture
|
|
40
39
|
|
|
41
40
|
Run `rig` from your machine, CI/CD, or a control plane: it provisions cloud VMs you can create and dispose anytime, and you work on `/workspace` via agent TTY or editor. SSH/HTTPS reaches VMs through the firewall; HTTPS reaches the provider. The CLI stores env state in S3-compatible object storage.
|
|
@@ -113,7 +112,7 @@ host:
|
|
|
113
112
|
firewall:
|
|
114
113
|
mode: dynamic_add # open | static | dynamic_replace | dynamic_add
|
|
115
114
|
allowed_ips: [] # static allow-list; also merged into dynamic modes
|
|
116
|
-
ports: [] # extra inbound ports
|
|
115
|
+
ports: [] # extra inbound ports; each may set mode and allowed_ips
|
|
117
116
|
agent:
|
|
118
117
|
default: opencode # default for `rig attach`; or claude | cursor
|
|
119
118
|
enabled: [opencode] # agents installed on the VM
|
|
@@ -138,16 +137,26 @@ Firewall modes:
|
|
|
138
137
|
| `dynamic_replace` | Set allow-list to current CLI public IP (+ `allowed_ips`); drops previous IPs |
|
|
139
138
|
| `dynamic_add` (default) | Keep existing allow-list entries; add current CLI public IP if missing |
|
|
140
139
|
|
|
141
|
-
Attach / apply / dev /
|
|
140
|
+
Attach / apply / dev / delete refresh the firewall for dynamic modes when the client IP changes, and keep `ports` in sync.
|
|
142
141
|
|
|
143
|
-
`firewall.ports` opens extra inbound listeners with
|
|
142
|
+
`firewall.ports` opens extra inbound listeners. A bare port or a mapping with no `mode` uses `firewall.mode` and `firewall.allowed_ips`, same as SSH (TCP by default; use `{port, protocol}` for UDP). Set `mode` to `open`, `static`, `dynamic_replace`, or `dynamic_add` for that port only. Set `allowed_ips` to replace the firewall list for that port; omit it to inherit. `allowed_ips: []` on a `static` port does not fall back to world access. SSH (22) and ICMP stay on `firewall.mode`.
|
|
143
|
+
|
|
144
|
+
```yaml
|
|
145
|
+
ports:
|
|
146
|
+
- 8080 # firewall.mode + firewall.allowed_ips
|
|
147
|
+
- port: 443
|
|
148
|
+
mode: open # 0.0.0.0/0 and ::/0
|
|
149
|
+
- port: 9090
|
|
150
|
+
mode: static
|
|
151
|
+
allowed_ips: ["198.51.100.10/32"]
|
|
152
|
+
```
|
|
144
153
|
|
|
145
154
|
Remote project files live under `/workspace` (not `/root`).
|
|
146
155
|
|
|
147
156
|
## Lifecycle
|
|
148
157
|
|
|
149
158
|
```text
|
|
150
|
-
init → create → attach | dev | apply →
|
|
159
|
+
init → create → attach | dev | apply → delete
|
|
151
160
|
↓
|
|
152
161
|
snapshots (reuse on next create)
|
|
153
162
|
|
|
@@ -171,10 +180,10 @@ destroy playbooks:
|
|
|
171
180
|
| --- | --- |
|
|
172
181
|
| **init** | Scaffold `rig.yml` + `.rig/`. Collect Hetzner creds, repo PATs, agent choices and a key per agent. |
|
|
173
182
|
| **create** | Boot VM (base/system snapshot). Run provision → configure → authorize → materialize. Snapshot after **configure** only. |
|
|
174
|
-
| **apply** | Default: authorize → materialize. Flags: `--provision` / `--configure` / `--authorize` / `--materialize
|
|
183
|
+
| **apply** | Default: authorize → materialize. Flags: `--provision` / `--configure` / `--authorize` / `--materialize` / `--finalize` / `--destroy` (playbooks only; the VM stays). `--tags` is passed to every playbook in the run. |
|
|
175
184
|
| **attach** | SSH TTY into `opencode` / `claude` / Cursor `agent` on `/workspace`. `--agent` picks among installed agents. |
|
|
176
185
|
| **dev** | Open VS Code/Cursor via Remote-SSH on `/workspace` (or `--browser` for code-server). |
|
|
177
|
-
| **
|
|
186
|
+
| **delete** | Run finalize → destroy playbooks, then delete VM / firewall / SSH key. `--tags` is passed to both playbooks. |
|
|
178
187
|
|
|
179
188
|
Put secret-free installs in `configure.yml` (cached). Put clone/setup that needs credentials in `materialize.yml`.
|
|
180
189
|
|
|
@@ -213,12 +222,12 @@ Global: `-v` playbook tasks and debug · `-vv`/`-vvv`/`-vvvv` ansible verbosity
|
|
|
213
222
|
| --- | --- | --- |
|
|
214
223
|
| `init` | | Interactive scaffold |
|
|
215
224
|
| `create` | `[--name]` `[--provider]` `[--type]` `[--availability-zone]` `[--image]` `[--no-attach]` `[--force-playbooks\|--force-system\|--force-workspace]` | Host defaults from `rig.yml`. `--provider` defaults to `hetzner`. `--type` sets `host.server_type`. `host.type` defaults to `vm`. `--region` aliases `--availability-zone`. |
|
|
216
|
-
| `apply` | `[name]` `[--provision\|--configure\|--authorize\|--materialize]` | Default: authorize then materialize |
|
|
225
|
+
| `apply` | `[name]` `[--provision\|--configure\|--authorize\|--materialize\|--finalize\|--destroy]` `[--tags TAGS]` | Default: authorize then materialize. Each flag runs that playbook (`--provision` also runs configure and authorize; `--materialize` also runs authorize). `--finalize` and `--destroy` do not delete the VM. `--tags` limits every playbook in the run |
|
|
217
226
|
| `attach` | `[name]` `[-c\|--continue]` `[-s\|--session ID]` `[--resume [ID]]` `[--agent opencode\|claude\|cursor]` `[-- …agent args]` | Reopens last remembered session by default; `--agent` picks which installed agent |
|
|
218
227
|
| `ssh` | `[name]` `[-- command]` | Shell on the VM in `/workspace`. A command after `--` runs instead of a login shell |
|
|
219
228
|
| `dev` | `[name]` `[--path /workspace]` `[--browser]` `[--editor code\|cursor\|…]` | Remote-SSH by default; `--editor` opens another IDE from `editor.enabled`. Defaults to `editor.default` |
|
|
220
229
|
| `list` | | Lists envs, or `No remote environments` |
|
|
221
|
-
| `
|
|
230
|
+
| `delete` | `[name …]` `[--tags TAGS]` | Runs finalize then destroy playbooks, then deletes the VM; multi-name OK. `--tags` limits both playbooks |
|
|
222
231
|
| `cache` | `list\|clear` `[--system\|--workspace] [--all] [-y]` | List or clear; unused by default, `--all` includes current |
|
|
223
232
|
| `vars encrypt` | `[--stdin-name VAR]` `[--personal]` | Vault into shared or identity vars (after master-key unlock) |
|
|
224
233
|
| `vars decrypt` | `[VAR]` | Decrypt from shared or identity vars |
|
|
@@ -245,7 +254,7 @@ Playbooks load `.rig/vars.yml` then `.rig/vars.{identity}.yml` (personal wins),
|
|
|
245
254
|
| `rig_workspace_root` | `/workspace` |
|
|
246
255
|
| `rig_version` | Installed `rig` package version |
|
|
247
256
|
| `rig_boot_source` | `base` \| `system` \| `workspace` |
|
|
248
|
-
| `rig_action` | `create` \| `apply` \| `destroy` |
|
|
257
|
+
| `rig_action` | `create` \| `apply` \| `destroy` (`rig delete` still sets `destroy`) |
|
|
249
258
|
| `rig_project_dir` | Local project path |
|
|
250
259
|
| `rig_ssh_key_name` / `rig_ssh_key_path` | Local key under `/tmp` |
|
|
251
260
|
| `rig_firewall_name` | Firewall resource name |
|
|
@@ -264,12 +273,21 @@ Also available from vars files (defaults): `workspace_root`, `coding_agent_type`
|
|
|
264
273
|
| Personal master key | Prompted on init/unlock; **never stored**. Unwraps data keys from `vars.{identity}.yml`. |
|
|
265
274
|
| `rig_identity_data_key` / `rig_shared_data_key` | Master-key wraps inside `vars.{identity}.yml` (committed). |
|
|
266
275
|
| `/tmp/.rig/.personal-data-key` / `.shared-data-key` | Materialized Ansible vault passwords after unlock (tmpfs). |
|
|
267
|
-
| `/tmp/<env>-key` | Per-env SSH private key (attach / apply /
|
|
276
|
+
| `/tmp/<env>-key` | Per-env SSH private key (attach / apply / delete finalizers). |
|
|
268
277
|
|
|
269
278
|
`RIG_IDENTITY` overrides the configured identity. Teammates joining an existing workspace paste the shared data key once (`rig vars export-shared-key` from an unlocked machine).
|
|
270
279
|
|
|
271
280
|
OpenCode without an API key uses free Zen models. With a key, config switches to the paid provider path. When several agents are selected, keys are `opencode_api_key`, `claude_api_key`, and `cursor_api_key` (`RIG_OPENCODE_API_KEY`, `RIG_ANTHROPIC_API_KEY`, `RIG_CURSOR_API_KEY`). A single agent still uses `coding_agent_api_key` (`RIG_CODING_AGENT_API_KEY`).
|
|
272
281
|
|
|
282
|
+
## Development
|
|
283
|
+
|
|
284
|
+
From a checkout, `pip install .` installs the same `rig` command. Use an editable install so the command keeps using this tree while you change it:
|
|
285
|
+
|
|
286
|
+
```bash
|
|
287
|
+
pip install -e .
|
|
288
|
+
rig --version
|
|
289
|
+
```
|
|
290
|
+
|
|
273
291
|
## Tests
|
|
274
292
|
|
|
275
293
|
```bash
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
[](https://pypi.org/project/mystack-rig/)
|
|
1
2
|
[](https://github.com/mystack-cloud/rig/actions/workflows/tests.yml)
|
|
2
3
|
[](https://codecov.io/gh/mystack-cloud/rig)
|
|
3
4
|
|
|
@@ -11,8 +12,6 @@ rig init
|
|
|
11
12
|
rig create
|
|
12
13
|
```
|
|
13
14
|
|
|
14
|
-
The published project name is `mystack-rig` (the PyPI name `rig` belongs to another project). The command is still `rig`. From a checkout, `pip install .` installs the same command.
|
|
15
|
-
|
|
16
15
|
## Architecture
|
|
17
16
|
|
|
18
17
|
Run `rig` from your machine, CI/CD, or a control plane: it provisions cloud VMs you can create and dispose anytime, and you work on `/workspace` via agent TTY or editor. SSH/HTTPS reaches VMs through the firewall; HTTPS reaches the provider. The CLI stores env state in S3-compatible object storage.
|
|
@@ -90,7 +89,7 @@ host:
|
|
|
90
89
|
firewall:
|
|
91
90
|
mode: dynamic_add # open | static | dynamic_replace | dynamic_add
|
|
92
91
|
allowed_ips: [] # static allow-list; also merged into dynamic modes
|
|
93
|
-
ports: [] # extra inbound ports
|
|
92
|
+
ports: [] # extra inbound ports; each may set mode and allowed_ips
|
|
94
93
|
agent:
|
|
95
94
|
default: opencode # default for `rig attach`; or claude | cursor
|
|
96
95
|
enabled: [opencode] # agents installed on the VM
|
|
@@ -115,16 +114,26 @@ Firewall modes:
|
|
|
115
114
|
| `dynamic_replace` | Set allow-list to current CLI public IP (+ `allowed_ips`); drops previous IPs |
|
|
116
115
|
| `dynamic_add` (default) | Keep existing allow-list entries; add current CLI public IP if missing |
|
|
117
116
|
|
|
118
|
-
Attach / apply / dev /
|
|
117
|
+
Attach / apply / dev / delete refresh the firewall for dynamic modes when the client IP changes, and keep `ports` in sync.
|
|
119
118
|
|
|
120
|
-
`firewall.ports` opens extra inbound listeners with
|
|
119
|
+
`firewall.ports` opens extra inbound listeners. A bare port or a mapping with no `mode` uses `firewall.mode` and `firewall.allowed_ips`, same as SSH (TCP by default; use `{port, protocol}` for UDP). Set `mode` to `open`, `static`, `dynamic_replace`, or `dynamic_add` for that port only. Set `allowed_ips` to replace the firewall list for that port; omit it to inherit. `allowed_ips: []` on a `static` port does not fall back to world access. SSH (22) and ICMP stay on `firewall.mode`.
|
|
120
|
+
|
|
121
|
+
```yaml
|
|
122
|
+
ports:
|
|
123
|
+
- 8080 # firewall.mode + firewall.allowed_ips
|
|
124
|
+
- port: 443
|
|
125
|
+
mode: open # 0.0.0.0/0 and ::/0
|
|
126
|
+
- port: 9090
|
|
127
|
+
mode: static
|
|
128
|
+
allowed_ips: ["198.51.100.10/32"]
|
|
129
|
+
```
|
|
121
130
|
|
|
122
131
|
Remote project files live under `/workspace` (not `/root`).
|
|
123
132
|
|
|
124
133
|
## Lifecycle
|
|
125
134
|
|
|
126
135
|
```text
|
|
127
|
-
init → create → attach | dev | apply →
|
|
136
|
+
init → create → attach | dev | apply → delete
|
|
128
137
|
↓
|
|
129
138
|
snapshots (reuse on next create)
|
|
130
139
|
|
|
@@ -148,10 +157,10 @@ destroy playbooks:
|
|
|
148
157
|
| --- | --- |
|
|
149
158
|
| **init** | Scaffold `rig.yml` + `.rig/`. Collect Hetzner creds, repo PATs, agent choices and a key per agent. |
|
|
150
159
|
| **create** | Boot VM (base/system snapshot). Run provision → configure → authorize → materialize. Snapshot after **configure** only. |
|
|
151
|
-
| **apply** | Default: authorize → materialize. Flags: `--provision` / `--configure` / `--authorize` / `--materialize
|
|
160
|
+
| **apply** | Default: authorize → materialize. Flags: `--provision` / `--configure` / `--authorize` / `--materialize` / `--finalize` / `--destroy` (playbooks only; the VM stays). `--tags` is passed to every playbook in the run. |
|
|
152
161
|
| **attach** | SSH TTY into `opencode` / `claude` / Cursor `agent` on `/workspace`. `--agent` picks among installed agents. |
|
|
153
162
|
| **dev** | Open VS Code/Cursor via Remote-SSH on `/workspace` (or `--browser` for code-server). |
|
|
154
|
-
| **
|
|
163
|
+
| **delete** | Run finalize → destroy playbooks, then delete VM / firewall / SSH key. `--tags` is passed to both playbooks. |
|
|
155
164
|
|
|
156
165
|
Put secret-free installs in `configure.yml` (cached). Put clone/setup that needs credentials in `materialize.yml`.
|
|
157
166
|
|
|
@@ -190,12 +199,12 @@ Global: `-v` playbook tasks and debug · `-vv`/`-vvv`/`-vvvv` ansible verbosity
|
|
|
190
199
|
| --- | --- | --- |
|
|
191
200
|
| `init` | | Interactive scaffold |
|
|
192
201
|
| `create` | `[--name]` `[--provider]` `[--type]` `[--availability-zone]` `[--image]` `[--no-attach]` `[--force-playbooks\|--force-system\|--force-workspace]` | Host defaults from `rig.yml`. `--provider` defaults to `hetzner`. `--type` sets `host.server_type`. `host.type` defaults to `vm`. `--region` aliases `--availability-zone`. |
|
|
193
|
-
| `apply` | `[name]` `[--provision\|--configure\|--authorize\|--materialize]` | Default: authorize then materialize |
|
|
202
|
+
| `apply` | `[name]` `[--provision\|--configure\|--authorize\|--materialize\|--finalize\|--destroy]` `[--tags TAGS]` | Default: authorize then materialize. Each flag runs that playbook (`--provision` also runs configure and authorize; `--materialize` also runs authorize). `--finalize` and `--destroy` do not delete the VM. `--tags` limits every playbook in the run |
|
|
194
203
|
| `attach` | `[name]` `[-c\|--continue]` `[-s\|--session ID]` `[--resume [ID]]` `[--agent opencode\|claude\|cursor]` `[-- …agent args]` | Reopens last remembered session by default; `--agent` picks which installed agent |
|
|
195
204
|
| `ssh` | `[name]` `[-- command]` | Shell on the VM in `/workspace`. A command after `--` runs instead of a login shell |
|
|
196
205
|
| `dev` | `[name]` `[--path /workspace]` `[--browser]` `[--editor code\|cursor\|…]` | Remote-SSH by default; `--editor` opens another IDE from `editor.enabled`. Defaults to `editor.default` |
|
|
197
206
|
| `list` | | Lists envs, or `No remote environments` |
|
|
198
|
-
| `
|
|
207
|
+
| `delete` | `[name …]` `[--tags TAGS]` | Runs finalize then destroy playbooks, then deletes the VM; multi-name OK. `--tags` limits both playbooks |
|
|
199
208
|
| `cache` | `list\|clear` `[--system\|--workspace] [--all] [-y]` | List or clear; unused by default, `--all` includes current |
|
|
200
209
|
| `vars encrypt` | `[--stdin-name VAR]` `[--personal]` | Vault into shared or identity vars (after master-key unlock) |
|
|
201
210
|
| `vars decrypt` | `[VAR]` | Decrypt from shared or identity vars |
|
|
@@ -222,7 +231,7 @@ Playbooks load `.rig/vars.yml` then `.rig/vars.{identity}.yml` (personal wins),
|
|
|
222
231
|
| `rig_workspace_root` | `/workspace` |
|
|
223
232
|
| `rig_version` | Installed `rig` package version |
|
|
224
233
|
| `rig_boot_source` | `base` \| `system` \| `workspace` |
|
|
225
|
-
| `rig_action` | `create` \| `apply` \| `destroy` |
|
|
234
|
+
| `rig_action` | `create` \| `apply` \| `destroy` (`rig delete` still sets `destroy`) |
|
|
226
235
|
| `rig_project_dir` | Local project path |
|
|
227
236
|
| `rig_ssh_key_name` / `rig_ssh_key_path` | Local key under `/tmp` |
|
|
228
237
|
| `rig_firewall_name` | Firewall resource name |
|
|
@@ -241,12 +250,21 @@ Also available from vars files (defaults): `workspace_root`, `coding_agent_type`
|
|
|
241
250
|
| Personal master key | Prompted on init/unlock; **never stored**. Unwraps data keys from `vars.{identity}.yml`. |
|
|
242
251
|
| `rig_identity_data_key` / `rig_shared_data_key` | Master-key wraps inside `vars.{identity}.yml` (committed). |
|
|
243
252
|
| `/tmp/.rig/.personal-data-key` / `.shared-data-key` | Materialized Ansible vault passwords after unlock (tmpfs). |
|
|
244
|
-
| `/tmp/<env>-key` | Per-env SSH private key (attach / apply /
|
|
253
|
+
| `/tmp/<env>-key` | Per-env SSH private key (attach / apply / delete finalizers). |
|
|
245
254
|
|
|
246
255
|
`RIG_IDENTITY` overrides the configured identity. Teammates joining an existing workspace paste the shared data key once (`rig vars export-shared-key` from an unlocked machine).
|
|
247
256
|
|
|
248
257
|
OpenCode without an API key uses free Zen models. With a key, config switches to the paid provider path. When several agents are selected, keys are `opencode_api_key`, `claude_api_key`, and `cursor_api_key` (`RIG_OPENCODE_API_KEY`, `RIG_ANTHROPIC_API_KEY`, `RIG_CURSOR_API_KEY`). A single agent still uses `coding_agent_api_key` (`RIG_CODING_AGENT_API_KEY`).
|
|
249
258
|
|
|
259
|
+
## Development
|
|
260
|
+
|
|
261
|
+
From a checkout, `pip install .` installs the same `rig` command. Use an editable install so the command keeps using this tree while you change it:
|
|
262
|
+
|
|
263
|
+
```bash
|
|
264
|
+
pip install -e .
|
|
265
|
+
rig --version
|
|
266
|
+
```
|
|
267
|
+
|
|
250
268
|
## Tests
|
|
251
269
|
|
|
252
270
|
```bash
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# Per-workspace, per-Profile generated state bucket in vars.yml
|
|
2
|
+
|
|
3
|
+
The fixed default bucket name `rig` collided with other Hetzner customers, because bucket names are unique across the whole location. Each Profile (one Hetzner Cloud project) in each Workspace now gets a generated `rig-{8 hex}` State bucket. The name is recorded in `.rig/vars.yml` under `rig_state_buckets`, keyed by Profile name, so the whole team shares it. It is not stored in the developer's `~/.rig/config`.
|
|
4
|
+
|
|
5
|
+
## Considered Options
|
|
6
|
+
|
|
7
|
+
- **Fixed name `rig`**: rejected, since it collides across customers.
|
|
8
|
+
- **Per-machine name in `~/.rig/config`**: rejected, since teammates would each get a different bucket and lose shared state.
|
|
9
|
+
- **Name derived from the account or token**: rejected, since a Hetzner token doesn't reveal its project id.
|
|
10
|
+
|
|
11
|
+
## Consequences
|
|
12
|
+
|
|
13
|
+
- The bucket is scoped to Workspace and Profile. Two Workspaces using the same Profile get different buckets, and each only sees environments created from itself. Sharing one bucket across Workspaces was considered and rejected; it could be added later as an opt-in "adopt existing bucket" at init.
|
|
14
|
+
|
|
15
|
+
- Teammates must use the same Profile names for the same Hetzner project, and Rig can't verify this.
|
|
16
|
+
- Resolution order is `STATE_BUCKET` env var, then `vars.yml`, then generate. Only provisioning commands generate and write a name. `list`, `status` and `destroy` fail with "no state bucket configured" if none exists.
|
|
17
|
+
- A generated name is retried on a name-taken error. A configured name (from `vars.yml` or `STATE_BUCKET`) never is, and fails hard with a message pointing at a likely Profile mismatch.
|
|
18
|
+
- If `vars.yml` can't be written, the command fails. There is no ephemeral fallback bucket.
|
|
19
|
+
- Generating a name edits `vars.yml`, so init prints a reminder to commit it.
|
|
20
|
+
- There is no migration from the legacy `rig` bucket. Existing environments there must be cleaned up manually.
|
|
21
|
+
- Test mode (`is_test`) uses its own Test bucket and never reads or writes `vars.yml` or `~/.rig/config`.
|
|
22
|
+
- The bucket is shared by every Identity using the Profile, but visibility is per Identity. Each environment record stores an `owner` (the Identity that created it). `rig list` shows only the caller's environments; `rig list --all` shows everyone's, labelled with the owner. Records without an `owner` (created before this) appear only under `--all`. This is a visibility default, not access control: anyone with the bucket credentials can read all records.
|
|
23
|
+
- Environment records are one object each, at `remote-dev/environments/by-owner/<owner>/<name>.yml`. A save or destroy touches only that key, so concurrent runs by different Identities cannot overwrite each other (the earlier single `state.yml` index was read-merge-overwrite and could lose entries). The legacy `state.yml` index is still read, never written except to remove an entry on destroy.
|
|
@@ -363,7 +363,8 @@ def _cmd_apply(args: argparse.Namespace) -> int:
|
|
|
363
363
|
log.error("Environment name is required (no last environment remembered)")
|
|
364
364
|
log.info(
|
|
365
365
|
"Usage: rig apply [name] "
|
|
366
|
-
"[--provision|--configure|--authorize|--materialize]"
|
|
366
|
+
"[--provision|--configure|--authorize|--materialize|--finalize|--destroy] "
|
|
367
|
+
"[--tags TAGS]"
|
|
367
368
|
)
|
|
368
369
|
return 1
|
|
369
370
|
|
|
@@ -372,13 +373,23 @@ def _cmd_apply(args: argparse.Namespace) -> int:
|
|
|
372
373
|
want_configure = getattr(args, "configure", False)
|
|
373
374
|
want_authorize = getattr(args, "authorize", False) or getattr(args, "authnz", False)
|
|
374
375
|
want_materialize = getattr(args, "materialize", False)
|
|
376
|
+
want_finalize = getattr(args, "finalize", False)
|
|
377
|
+
want_destroy_playbook = getattr(args, "destroy", False)
|
|
375
378
|
|
|
376
379
|
selected = []
|
|
377
380
|
if want_provision:
|
|
378
381
|
selected.extend(["provision", "configure", "authorize"])
|
|
379
382
|
if want_configure and "configure" not in selected:
|
|
380
383
|
selected.append("configure")
|
|
381
|
-
|
|
384
|
+
authorize_only = (
|
|
385
|
+
want_authorize
|
|
386
|
+
and not want_provision
|
|
387
|
+
and not want_configure
|
|
388
|
+
and not want_materialize
|
|
389
|
+
and not want_finalize
|
|
390
|
+
and not want_destroy_playbook
|
|
391
|
+
)
|
|
392
|
+
if authorize_only:
|
|
382
393
|
selected = ["authorize"]
|
|
383
394
|
elif want_authorize and "authorize" not in selected:
|
|
384
395
|
selected.append("authorize")
|
|
@@ -387,12 +398,17 @@ def _cmd_apply(args: argparse.Namespace) -> int:
|
|
|
387
398
|
selected.append("authorize")
|
|
388
399
|
if "materialize" not in selected:
|
|
389
400
|
selected.append("materialize")
|
|
401
|
+
if want_finalize and "finalize" not in selected:
|
|
402
|
+
selected.append("finalize")
|
|
403
|
+
if want_destroy_playbook and "destroy" not in selected:
|
|
404
|
+
selected.append("destroy")
|
|
390
405
|
if not selected:
|
|
391
406
|
# Default apply: re-authorize then materialize.
|
|
392
407
|
selected = ["authorize", "materialize"]
|
|
393
408
|
|
|
394
|
-
# Preserve lifecycle order.
|
|
395
|
-
|
|
409
|
+
# Preserve lifecycle order. finalize/destroy run the playbooks only;
|
|
410
|
+
# deleting the VM is ``rig delete``.
|
|
411
|
+
order = ("provision", "configure", "authorize", "materialize", "finalize", "destroy")
|
|
396
412
|
playbooks = tuple(stage for stage in order if stage in selected)
|
|
397
413
|
|
|
398
414
|
storage_manager = None
|
|
@@ -421,6 +437,7 @@ def _cmd_apply(args: argparse.Namespace) -> int:
|
|
|
421
437
|
playbooks=playbooks,
|
|
422
438
|
soft_fail_materialize=False,
|
|
423
439
|
action="apply",
|
|
440
|
+
ansible_tags=getattr(args, "tags", None),
|
|
424
441
|
)
|
|
425
442
|
return 0 if ok else 1
|
|
426
443
|
except Exception as e:
|
|
@@ -501,7 +518,7 @@ def _cmd_dev(args: argparse.Namespace) -> int:
|
|
|
501
518
|
return 1
|
|
502
519
|
|
|
503
520
|
|
|
504
|
-
def _cmd_list(
|
|
521
|
+
def _cmd_list(args: argparse.Namespace) -> int:
|
|
505
522
|
_load_credentials()
|
|
506
523
|
hetzner_token = os.getenv('HETZNER_CLOUD_API_TOKEN')
|
|
507
524
|
if not hetzner_token:
|
|
@@ -516,20 +533,22 @@ def _cmd_list(_args: argparse.Namespace) -> int:
|
|
|
516
533
|
|
|
517
534
|
try:
|
|
518
535
|
env = RemoteDevEnvironment(storage_manager=storage_manager)
|
|
519
|
-
|
|
536
|
+
all_ids = bool(getattr(args, "all", False))
|
|
537
|
+
environments = env.list_environments(all_identities=True) if all_ids else env.list_environments()
|
|
520
538
|
if not environments:
|
|
521
539
|
log.info("No remote environments")
|
|
522
540
|
return 0
|
|
523
541
|
log.info("Remote environments:")
|
|
524
542
|
for env_info in environments:
|
|
525
|
-
|
|
543
|
+
owner = f" [{env_info.get('owner') or 'unknown'}]" if all_ids else ""
|
|
544
|
+
log.info(" - %s (%s)%s", env_info.get("name"), env_info.get("status"), owner)
|
|
526
545
|
return 0
|
|
527
546
|
except Exception as e:
|
|
528
547
|
log.error("Error listing environments: %s", e)
|
|
529
548
|
return 1
|
|
530
549
|
|
|
531
550
|
|
|
532
|
-
def
|
|
551
|
+
def _cmd_delete(args: argparse.Namespace) -> int:
|
|
533
552
|
_load_credentials()
|
|
534
553
|
hetzner_token = os.getenv('HETZNER_CLOUD_API_TOKEN')
|
|
535
554
|
if not hetzner_token:
|
|
@@ -555,7 +574,7 @@ def _cmd_destroy(args: argparse.Namespace) -> int:
|
|
|
555
574
|
log.info("Using last environment '%s'", last)
|
|
556
575
|
else:
|
|
557
576
|
log.error("At least one environment name is required (no last environment remembered)")
|
|
558
|
-
log.info("Usage: rig
|
|
577
|
+
log.info("Usage: rig delete [name ...] [--tags TAGS] or rig delete --name <name>")
|
|
559
578
|
return 1
|
|
560
579
|
|
|
561
580
|
storage_manager = None
|
|
@@ -568,16 +587,19 @@ def _cmd_destroy(args: argparse.Namespace) -> int:
|
|
|
568
587
|
for name in names:
|
|
569
588
|
try:
|
|
570
589
|
env = RemoteDevEnvironment(name=name, storage_manager=storage_manager)
|
|
571
|
-
env.cleanup(
|
|
590
|
+
env.cleanup(
|
|
591
|
+
project_dir=os.getcwd(),
|
|
592
|
+
ansible_tags=getattr(args, "tags", None),
|
|
593
|
+
)
|
|
572
594
|
clear_last_env(name)
|
|
573
595
|
clear_last_session(name)
|
|
574
|
-
log.info("Environment '%s'
|
|
596
|
+
log.info("Environment '%s' deleted", name)
|
|
575
597
|
except Exception as e:
|
|
576
|
-
log.error("Error
|
|
598
|
+
log.error("Error deleting environment '%s': %s", name, e)
|
|
577
599
|
failures.append(name)
|
|
578
600
|
|
|
579
601
|
if failures:
|
|
580
|
-
log.error("Failed to
|
|
602
|
+
log.error("Failed to delete: %s", ", ".join(failures))
|
|
581
603
|
return 1
|
|
582
604
|
return 0
|
|
583
605
|
|
|
@@ -964,6 +986,26 @@ def main(argv=None):
|
|
|
964
986
|
action="store_true",
|
|
965
987
|
help="Run authorize then materialize (or materialize with other flags)",
|
|
966
988
|
)
|
|
989
|
+
apply_parser.add_argument(
|
|
990
|
+
"--finalize",
|
|
991
|
+
action="store_true",
|
|
992
|
+
help="Run finalize.yml (does not delete the VM)",
|
|
993
|
+
)
|
|
994
|
+
apply_parser.add_argument(
|
|
995
|
+
"--destroy",
|
|
996
|
+
action="store_true",
|
|
997
|
+
help="Run destroy.yml (does not delete the VM)",
|
|
998
|
+
)
|
|
999
|
+
apply_parser.add_argument(
|
|
1000
|
+
"--tags",
|
|
1001
|
+
action="append",
|
|
1002
|
+
default=None,
|
|
1003
|
+
metavar="TAGS",
|
|
1004
|
+
help=(
|
|
1005
|
+
"Ansible --tags for every playbook in this run "
|
|
1006
|
+
"(comma-separated; may be repeated)."
|
|
1007
|
+
),
|
|
1008
|
+
)
|
|
967
1009
|
# Legacy aliases
|
|
968
1010
|
apply_parser.add_argument(
|
|
969
1011
|
"--system",
|
|
@@ -1081,7 +1123,15 @@ def main(argv=None):
|
|
|
1081
1123
|
),
|
|
1082
1124
|
)
|
|
1083
1125
|
|
|
1084
|
-
subparsers.add_parser(
|
|
1126
|
+
list_parser = subparsers.add_parser(
|
|
1127
|
+
"list",
|
|
1128
|
+
help="List your remote environments (--all: every identity's)",
|
|
1129
|
+
)
|
|
1130
|
+
list_parser.add_argument(
|
|
1131
|
+
"--all",
|
|
1132
|
+
action="store_true",
|
|
1133
|
+
help="Include environments owned by other identities in this workspace",
|
|
1134
|
+
)
|
|
1085
1135
|
|
|
1086
1136
|
cache_parser = subparsers.add_parser(
|
|
1087
1137
|
"cache",
|
|
@@ -1124,25 +1174,35 @@ def main(argv=None):
|
|
|
1124
1174
|
help="list = show only; clear = list, confirm, delete (default: clear)",
|
|
1125
1175
|
)
|
|
1126
1176
|
|
|
1127
|
-
|
|
1128
|
-
"
|
|
1177
|
+
delete_parser = subparsers.add_parser(
|
|
1178
|
+
"delete",
|
|
1129
1179
|
help=(
|
|
1130
|
-
"
|
|
1180
|
+
"Delete remote environments (runs finalize then destroy playbooks first; "
|
|
1131
1181
|
"uses last env if name omitted)"
|
|
1132
1182
|
),
|
|
1133
1183
|
)
|
|
1134
|
-
|
|
1184
|
+
delete_parser.add_argument(
|
|
1135
1185
|
"names",
|
|
1136
1186
|
nargs="*",
|
|
1137
1187
|
metavar="name",
|
|
1138
|
-
help="Environment name(s) to
|
|
1188
|
+
help="Environment name(s) to delete (defaults to last handled env in /tmp/.rig/last-env)",
|
|
1139
1189
|
)
|
|
1140
|
-
|
|
1190
|
+
delete_parser.add_argument(
|
|
1141
1191
|
"--name",
|
|
1142
1192
|
action="append",
|
|
1143
1193
|
dest="name_flags",
|
|
1144
1194
|
help="Environment name (repeatable; kept for compatibility)",
|
|
1145
1195
|
)
|
|
1196
|
+
delete_parser.add_argument(
|
|
1197
|
+
"--tags",
|
|
1198
|
+
action="append",
|
|
1199
|
+
default=None,
|
|
1200
|
+
metavar="TAGS",
|
|
1201
|
+
help=(
|
|
1202
|
+
"Ansible --tags for the finalize and destroy playbooks "
|
|
1203
|
+
"(comma-separated; may be repeated)"
|
|
1204
|
+
),
|
|
1205
|
+
)
|
|
1146
1206
|
|
|
1147
1207
|
vars_parser = subparsers.add_parser(
|
|
1148
1208
|
"vars",
|
|
@@ -1212,8 +1272,8 @@ def main(argv=None):
|
|
|
1212
1272
|
return _cmd_list(args)
|
|
1213
1273
|
if args.command == "cache":
|
|
1214
1274
|
return _cmd_cache(args)
|
|
1215
|
-
if args.command == "
|
|
1216
|
-
return
|
|
1275
|
+
if args.command == "delete":
|
|
1276
|
+
return _cmd_delete(args)
|
|
1217
1277
|
if args.command == "vars":
|
|
1218
1278
|
if args.vars_command == "encrypt":
|
|
1219
1279
|
return _cmd_encrypt(args)
|