Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3586432a08
|
No files matched your search
@@ -80,6 +80,14 @@ required-check unknown states, and the lint image/tool/command/caller contract.
|
||||
|
||||
## Batch orb-version rollout
|
||||
|
||||
For a standard QBit without a manifest, start directly on the managed patch
|
||||
track using `python tools/standardize_qbit.py /checkout --orb-version 0.8
|
||||
--default-branch main`. Inspect the preview, then repeat with `--write`.
|
||||
This preserves the inferred publication and branch-filter policy while writing
|
||||
the same track to the manifest and setup caller. Use `rollout_version.py` below
|
||||
for repositories that already have a manifest. Neither command configures
|
||||
repository protection or automatically enrolls newly created repositories.
|
||||
|
||||
Upgrade existing canonical CircleCI consumers with one command:
|
||||
|
||||
```sh
|
||||
|
||||
@@ -76,6 +76,24 @@ class MigrationTests(unittest.TestCase):
|
||||
manifest = migration.infer_manifest(self.config(), "0.7.0", "main")
|
||||
self.assertFalse(any(manifest["publish"].values()))
|
||||
|
||||
def test_managed_track_preserves_policy_and_caller_pins(self):
|
||||
fixtures = json.loads((Path(__file__).parent / "fixtures/qbit-publication-policies.json").read_text(encoding="utf-8"))
|
||||
for fixture in fixtures:
|
||||
with self.subTest(repository=fixture["name"]):
|
||||
expected = migration.infer_manifest(fixture["config"], "0.8.1", fixture["default_branch"])
|
||||
expected["orb_version"] = "0.8"
|
||||
actual = migration.infer_manifest(fixture["config"], "0.8", fixture["default_branch"])
|
||||
self.assertEqual(actual, expected)
|
||||
caller = migration.canonical_caller("0.8", actual["release_tag_policy"], actual["publish"].get("feature", False))
|
||||
self.assertEqual(caller["orbs"]["qqq-orb"], "kingsrook/qqq-orb@0.8")
|
||||
self.assertEqual(caller["workflows"]["setup"]["jobs"][0]["qqq-orb/generate_pipeline"]["orb_version"], "0.8")
|
||||
self.assertEqual(yaml.safe_load(yaml.safe_dump(actual))["orb_version"], "0.8")
|
||||
|
||||
def test_reject_ambiguous_or_invalid_versions(self):
|
||||
for version in (0.8, None, "0", "latest", "volatile", "0.8.*", "0.8.1.2", ""):
|
||||
with self.subTest(version=version), self.assertRaises(ValueError):
|
||||
migration.infer_manifest(self.config(), version, "main")
|
||||
|
||||
def test_snapshot_does_not_enable_rc_or_release(self):
|
||||
manifest = migration.infer_manifest(
|
||||
self.config("qqq-orb/mvn_publish", branch_type="snapshot",
|
||||
|
||||
@@ -100,8 +100,8 @@ def test_filters(filters):
|
||||
|
||||
|
||||
def infer_manifest(config, version, default_branch):
|
||||
if not re.fullmatch(r"(?:\d+\.\d+\.\d+|dev:[A-Za-z0-9_-]+)", version):
|
||||
raise ValueError("An explicit published orb version is required")
|
||||
if not isinstance(version, str) or not re.fullmatch(r"(?:\d+\.\d+(?:\.\d+)?|dev:[A-Za-z0-9_-]+)", version):
|
||||
raise ValueError("A minor track, exact patch or explicit development orb version is required")
|
||||
if default_branch not in ("main", "develop"):
|
||||
raise ValueError("Unsupported default branch")
|
||||
if set(config) - {"version", "orbs", "commands", "workflows"}:
|
||||
|
||||
Reference in new issue
Block a user