Skip to content

Commit 07e1ed8

Browse files
authored
Nebius cxcli 839 (#95)
* new changes * new changes * Prepare release nebius-cxcli-v0.1.5
1 parent 0ebe807 commit 07e1ed8

File tree

16 files changed

+902
-79
lines changed

16 files changed

+902
-79
lines changed

.github/workflows/nebius-cxcli-ci.yml

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -48,16 +48,10 @@ jobs:
4848
- name: Build wheel
4949
env:
5050
RELEASE_REF: ${{ github.sha }}
51+
NEBIUS_CXCLI_BUILD_COMPONENT_SOURCES_FILE: component_sources.release.yaml
5152
run: |
5253
set -euo pipefail
5354
rm -rf build dist
54-
backup="$(mktemp)"
55-
cp component_sources.yaml "${backup}"
56-
trap 'mv "${backup}" component_sources.yaml' EXIT
57-
python -m nebius_cxcli.release_catalog render \
58-
--input component_sources.release.yaml \
59-
--output component_sources.yaml \
60-
--release-ref "${RELEASE_REF}"
6155
python -m build --wheel
6256
6357
- name: Verify bundled component sources in wheel

.github/workflows/nebius-cxcli-release.yml

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -98,16 +98,10 @@ jobs:
9898
env:
9999
RELEASE_REF: ${{ steps.version.outputs.tag }}
100100
RELEASE_VERSION: ${{ steps.version.outputs.version }}
101+
NEBIUS_CXCLI_BUILD_COMPONENT_SOURCES_FILE: component_sources.release.yaml
101102
run: |
102103
set -euo pipefail
103104
rm -rf build dist
104-
backup="$(mktemp)"
105-
cp component_sources.yaml "${backup}"
106-
trap 'mv "${backup}" component_sources.yaml' EXIT
107-
python -m nebius_cxcli.release_catalog render \
108-
--input component_sources.release.yaml \
109-
--output component_sources.yaml \
110-
--release-ref "${RELEASE_REF}"
111105
SETUPTOOLS_SCM_PRETEND_VERSION="${RELEASE_VERSION}" python -m build --wheel
112106
113107
- name: Resolve and verify release assets

services/nebius-cxcli/CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,17 @@ All notable changes to this project are tracked here. This changelog follows
66

77
## [Unreleased]
88

9+
## [nebius-cxcli-v0.1.5] - 2026-03-22
10+
11+
- Added PR-side coverage for `bootstrap-ci` workflow generation across both development (`main`) and stable tagged (`nebius-cxcli-v<version>`) default CLI refs.
12+
- Hardened `bootstrap-ci` to fail before writing the customer workflow when GitHub auth-bootstrap prerequisites are missing, and documented `--github-repo` as an override over target-repo auto-detection.
13+
- Added explicit render profiles: generator-side `validate` and `render` now default to portable output, while `--render-profile local-dev` keeps checked-out Terraform module paths for workstation testing.
14+
- Hardened generated-bundle validation and customer workflows with `validate-generated --portable`, so PR/apply pipelines reject non-portable local Terraform module sources before plan/apply.
15+
- Simplified wheel/release packaging to bundle the portable catalog via the build override path instead of rewriting the working-tree root catalog during GitHub Actions builds.
16+
- Aligned the generated customer workflow with the example repo by using a shared Python-version env and compact JSON discovery output for deterministic GitHub Actions matrix handoff.
17+
- Added repo-side coverage that the checked-in local and portable catalogs stay semantically aligned except for Terraform module source addresses.
18+
- Added direct tests for the `validate-sources` CLI command surface and GitHub environment-secret bootstrap helpers so those paths no longer rely only on indirect coverage.
19+
920
## [nebius-cxcli-v0.1.4] - 2026-03-22
1021

1122
- Fixed packaged/bundled `component_sources.yaml` to always use the portable Git-backed catalog so source installs and customer CI no longer fall back to repo-local Terraform module paths.

services/nebius-cxcli/README.md

Lines changed: 43 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -167,25 +167,29 @@ Recommended catalog split:
167167

168168
- `component_sources.yaml`: repo-local developer catalog, using local filesystem module paths for fast iteration
169169
- `component_sources.release.yaml`: portable/release catalog, using Git module sources so generated artifacts work on other machines and in CI
170+
- The checked-in developer and portable catalogs should stay semantically identical apart from Terraform module `source` values; only the transport changes between local-dev and portable renders.
170171

171172
The portable/release catalog is a template. Build/package steps derive the bundled `nebius_cxcli/component_sources.yaml` fallback from `component_sources.release.yaml`, and the CI/release workflows rewrite its Terraform Git module refs from `?ref=main` to the current commit/tag before building the wheel or publishing the raw catalog asset.
172173
If you use `component_sources.release.yaml` manually outside those workflows, pin its Git refs to a released tag or commit first instead of using `main`.
173174

174175
Recommended workflow:
175176

176177
- Automatic catalog resolution is a convenience default, not a portability guarantee.
178+
- `validate` and `render` default to the `portable` render profile, which emits deployable Terraform module sources suitable for CI and other machines.
177179
- Installed-package fallback is portable by default: when no repo-local/user/global override is present, the packaged `nebius_cxcli/component_sources.yaml` uses Git Terraform module sources.
178-
- For generator-side automation that must be deterministic and portable, set `--component-sources-file` or `NEBIUS_CXCLI_COMPONENT_SOURCES_FILE` explicitly.
180+
- Use `--render-profile local-dev` when you intentionally want generated Terraform to point at checked-out local module paths for workstation testing.
181+
- Use `--component-sources-file` or `NEBIUS_CXCLI_COMPONENT_SOURCES_FILE` only when you need to override which catalog is active; it is not the primary portable-vs-local switch.
179182
- Customer-side commands that operate on `generated/` do not need the source catalog to resolve Terraform module paths from the original render environment.
180183

181184
Typical usage:
182185

183186
```bash
184187
# Local development against checked-out Terraform modules
185-
nebius-cxcli --component-sources-file ./component_sources.yaml validate --strict /path/to/config.yaml
188+
nebius-cxcli validate --strict --render-profile local-dev /path/to/config.yaml
189+
nebius-cxcli render --render-profile local-dev /path/to/config.yaml
186190
187191
# Portable generation for CI / another repository / another machine
188-
nebius-cxcli --component-sources-file ./component_sources.release.yaml render /path/to/config.yaml
192+
nebius-cxcli render /path/to/config.yaml
189193
```
190194

191195
Managed vs external local tools:
@@ -263,6 +267,7 @@ Terraform render output (canonical):
263267
- `generated/infra/providers.tf`
264268
- `generated/infra/variables.tf`
265269
- `generated/infra/main.tf`
270+
- `generated/infra/outputs.tf`
266271
- `generated/infra/terraform.auto.tfvars.json`
267272
- `generated/infra/.terraform.lock.hcl` (generated during `render` when Terraform is available from `PATH` or the managed download path and backend init succeeds)
268273
- Local Terraform module sources are rendered as resolved filesystem paths. Use an explicit `git::...//subdir?ref=...` source in `component_sources.yaml` when you want a portable or pinned remote module reference.
@@ -290,7 +295,7 @@ Wizard field behavior:
290295
- `project_subnets`
291296
- `project_networks`
292297
- `tenant_projects`
293-
- `mk8s_control_plane_versions`
298+
- `mk8s_control_plane_versions`
294299
- When live provider options are unavailable, the wizard falls back to manual input.
295300

296301
Shared-derived default example:
@@ -489,12 +494,16 @@ nebius-cxcli render /path/to/config.yaml
489494
- Validates the active `component_sources.yaml` catalog: Terraform module sources, Helm chart sources, and catalog contract shape.
490495
- `validate <config.yaml>`
491496
- Validates the instance contract and runtime shape without the stricter deployment-readiness checks.
497+
- Defaults to `--render-profile portable`, so validation fails when the requested render contract would rely on non-portable local Terraform module paths.
492498
- `validate --strict <config.yaml>`
493499
- Adds stricter deployment-readiness checks on top of `validate`, including source-backed and runtime-backed checks used before rendering.
500+
- Accepts `--render-profile {portable|local-dev}` like `validate`.
494501
- `render <config.yaml>`
495502
- Generates the deployable bundle under `generated/`, refreshes inventory, writes `generated/nebius-cxcli-manifest.json`, and treats rerender as a reset operation.
496503
- Rerender recreates the managed generated bundle from a clean canonical layout without stale files from earlier renders, while preserving bootstrap-owned `generated/flux/flux-system`.
497-
- Automatic catalog resolution is acceptable for local development, but deterministic portable generation should set `--component-sources-file` or `NEBIUS_CXCLI_COMPONENT_SOURCES_FILE` explicitly.
504+
- Defaults to `--render-profile portable`, which rewrites active local module sources to their portable Git/registry equivalents when available.
505+
- Use `--render-profile local-dev` only for workstation testing against checked-out local Terraform modules; those generated artifacts are intentionally non-portable.
506+
- Use `--component-sources-file` or `NEBIUS_CXCLI_COMPONENT_SOURCES_FILE` only when you need to select a non-default catalog file.
498507
- If `generated/` already contains files, `render` prompts before overwrite in an interactive terminal.
499508
- In non-interactive contexts, use `nebius-cxcli render --force <config.yaml>` to confirm the reset explicitly.
500509

@@ -510,6 +519,7 @@ nebius-cxcli flux bootstrap /path/to/generated
510519

511520
- `validate-generated <generated-dir>`
512521
- Validates an existing generated bundle without rerendering it. Runs `terraform validate` against `generated/infra` and `kubectl kustomize` against `generated/flux` when apps exist.
522+
- Add `--portable` in CI or pre-commit checks to reject generated Terraform bundles that still embed local filesystem module paths.
513523
- Uses the generated bundle as the deploy contract; it does not need the original render machine's local module paths.
514524
- `deploy <generated-dir>`
515525
- Full local deploy from the generated bundle: Terraform apply first, then inventory refresh for both infra and apps artifacts, then Flux apply. If GitOps bootstrap is not configured yet, the CLI warns and prints the follow-up `flux bootstrap` command.
@@ -537,8 +547,14 @@ nebius-cxcli auth --instance-config /path/to/config.yaml --validate-profile
537547
- Scaffolds or reconciles the instance `config.yaml` and generated-folder skeleton.
538548
- `bootstrap-ci <config.yaml>`
539549
- Generates the customer GitHub Actions workflow and can optionally bootstrap/sync CI auth secrets. The generated workflow watches and deploys only `generated/**`.
550+
- Generated workflows validate changed bundles with `nebius-cxcli validate-generated --portable` before Terraform plan/apply.
551+
- Generated workflows also keep the Python version in one env var and emit compact single-line discovery JSON into `GITHUB_OUTPUT` so matrix handoff stays deterministic.
552+
- The target `config.yaml` must already live inside the customer git repository because the workflow is written at that repo root under `.github/workflows/`.
553+
- With default `--auth-bootstrap`, the command auto-detects the target GitHub repo from that checkout's `origin` remote. Use `--github-repo <owner/repo>` only as an explicit override when the remote is missing, non-GitHub, or not the repo you want to manage.
554+
- When `--cli-ref` is omitted, generated workflows default to `main` for development builds and to `nebius-cxcli-v<version>` for stable tagged releases.
540555
- Use `--cli-ref <branch|tag|sha>` when the workflow should install a specific nebius-cxcli ref for PR or branch validation instead of the default release tag or `main`.
541556
- Generated workflows also honor an optional GitHub repo/org variable `NEBIUS_CXCLI_REF`; when set, it overrides the generated default ref without editing the workflow file.
557+
- `bootstrap-ci` creates the GitHub Environment and syncs Environment Secrets. It does not create GitHub repo/org variables; `NEBIUS_CXCLI_REF` remains an optional manual override.
542558
- `discover <target_path>`
543559
- Returns changed deployment instances for CI matrix generation.
544560
- `terraform plan <generated-dir>`
@@ -558,11 +574,15 @@ Common command flags:
558574
`--client-name`, `--tenant-id`, `--project-id`, `--region-id`, `--email`, `--infra`, `--app`, `--app-namespace`, `--app-releasename`, `--validate-sources/--no-validate-sources`, `--no-interactive`, `--force`
559575
- `bootstrap-ci`:
560576
`--force`, `--auth-bootstrap/--no-auth-bootstrap`, `--github-repo`, `--github-token-env`, `--cli-ref`
561-
- `validate`: `--strict`
577+
- `validate`: `--strict`, `--render-profile`
578+
- `validate-generated`: `--auto-auth-bootstrap/--no-auto-auth-bootstrap`, `--portable`
579+
- `render`: `--force`, `--render-profile`
562580
- `deploy`: `--auto-auth-bootstrap/--no-auto-auth-bootstrap`
563581
- `discover`: `--all`
564582
- `terraform plan`: `--auto-auth-bootstrap/--no-auto-auth-bootstrap`
565583
- `terraform apply`: `--auto-auth-bootstrap/--no-auto-auth-bootstrap`
584+
- `terraform unlock`: `--auto-auth-bootstrap/--no-auto-auth-bootstrap`, `--force`
585+
- `flux apply`: `--auto-auth-bootstrap/--no-auto-auth-bootstrap`
566586
- `flux bootstrap`: `--auto-auth-bootstrap/--no-auto-auth-bootstrap`
567587
- `auth`:
568588
`--project-id`, `--instance-config`, `--client-name`, `--profile`, `--endpoint`, `--sdk-config-file`, `--github-repo`, `--github-token-env`, `--validate-profile`, `--create`, `--recreate`, `--bootstrap-ci`
@@ -597,20 +617,21 @@ Terraform runtime auth behavior:
597617
- GitHub environment name is `<client_name>-<project_id>`.
598618
- Requires existing local runtime auth profile (create first if missing).
599619

600-
`bootstrap-ci <config.yaml>` remains the full CI workflow bootstrap command and can still perform complete CI auth bootstrap/sync for that config. The generated customer workflow is artifact-driven: it watches and deploys only `generated/**`.
620+
`bootstrap-ci <config.yaml>` remains the full CI workflow bootstrap command and can still perform complete CI auth bootstrap/sync for that config. The generated customer workflow is artifact-driven: it watches and deploys only `generated/**`. The command requires the target config to be inside the customer git repository, auto-detects the GitHub repo from that checkout when `--auth-bootstrap` is enabled, and uses `--github-repo` only as an explicit override.
601621

602622
Generated workflow CLI ref:
603623

604624
- The generated customer workflow sets `NEBIUS_CXCLI_REF` and installs `nebius-cxcli` from that git ref.
625+
- `bootstrap-ci` does not create the optional `NEBIUS_CXCLI_REF` GitHub repo/org variable; create that override manually only when you want to supersede the generated default ref.
605626
- `NEBIUS_CXCLI_REF: main` means the workflow installs the latest code from the repository main branch on each run. That is appropriate during active development before a release is cut.
606-
- After you cut and trust a released version, change `NEBIUS_CXCLI_REF` in `.github/workflows/nebius-deployments.yml` to the release tag, for example:
627+
- To pin the generated workflow up front, run `bootstrap-ci --cli-ref <branch|tag|sha>`.
628+
- To override the generated default later without editing the workflow YAML, create a GitHub repo/org variable `NEBIUS_CXCLI_REF`, for example:
607629

608630
```yaml
609-
env:
610-
NEBIUS_CXCLI_REF: nebius-cxcli-v0.1.0
631+
NEBIUS_CXCLI_REF: nebius-cxcli-v0.1.0
611632
```
612633

613-
- Use a release tag in customer repos when you want reproducible CI behavior and do not want workflow runs to pick up new `main` branch changes automatically.
634+
- Use a release tag or commit SHA in customer repos when you want reproducible CI behavior and do not want workflow runs to pick up new `main` branch changes automatically.
614635

615636
`deploy <generated-dir>` (default `--auto-auth-bootstrap`) uses the same runtime auth creation core as `auth --create` when auth material is missing.
616637

@@ -638,9 +659,13 @@ nebius-cxcli create /path/to/deployments-root \
638659
nebius-cxcli validate --strict /path/to/config.yaml
639660
nebius-cxcli render /path/to/config.yaml
640661
662+
# Local-dev render against checked-out Terraform modules
663+
nebius-cxcli validate --strict --render-profile local-dev /path/to/config.yaml
664+
nebius-cxcli render --render-profile local-dev /path/to/config.yaml
665+
641666
# Customer side: validate and deploy generated bundle
642667
# Validate generated bundle before deploy
643-
nebius-cxcli validate-generated /path/to/generated
668+
nebius-cxcli validate-generated --portable /path/to/generated
644669
645670
# Local deploy from generated artifacts
646671
nebius-cxcli deploy /path/to/generated
@@ -702,6 +727,12 @@ python -m nebius_cxcli create --help
702727
python -m nebius_cxcli auth --help
703728
```
704729

730+
Test suite focus:
731+
732+
- `tests/test_cli.py` and `tests/test_cli_command_coverage.py` cover the command contract, including `bootstrap-ci`, render-profile behavior, and generated-bundle validation paths.
733+
- `tests/test_component_sources.py` covers source-catalog loading and `validate-sources` registry validation rules.
734+
- `tests/test_github_secrets.py` covers GitHub repo/environment secret helper routing and environment-secret upsert orchestration.
735+
705736
Runtime plugin env knobs:
706737

707738
- `NEBIUS_CXCLI_RUNTIME_VALIDATION_PLUGINS`: comma-separated `module.path:function` plugins.

0 commit comments

Comments
 (0)