Compare commits
6
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7e5de64dae | ||
|
|
12eccc9e7d | ||
|
|
9e2652d735 | ||
|
|
c4e41dea6b | ||
|
|
4562d5c2d2 | ||
|
|
322a194c05 |
No files matched your search
+34
-1
@@ -4,6 +4,9 @@ parameters:
|
||||
run_rc_finalize_sweep:
|
||||
type: boolean
|
||||
default: false
|
||||
run_enrollment_reconcile:
|
||||
type: boolean
|
||||
default: false
|
||||
orbs:
|
||||
orb-tools: circleci/orb-tools@12.3
|
||||
shellcheck: circleci/shellcheck@3.2
|
||||
@@ -13,6 +16,23 @@ filters: &filters
|
||||
only: /.*/
|
||||
|
||||
jobs:
|
||||
enrollment-reconcile:
|
||||
docker:
|
||||
- image: cimg/python:3.12
|
||||
resource_class: small
|
||||
steps:
|
||||
- checkout
|
||||
- run:
|
||||
name: Install reconciliation tools
|
||||
command: |
|
||||
bash tools/install_reconcile_gh.sh
|
||||
python3 -m pip install --disable-pip-version-check PyYAML==6.0.3
|
||||
- run:
|
||||
name: Reconcile current QQQ branches
|
||||
no_output_timeout: 21m
|
||||
command: python3 tools/run_enrollment.py
|
||||
- store_artifacts:
|
||||
path: artifacts/enrollment
|
||||
rc-finalize-sweep:
|
||||
docker:
|
||||
- image: cimg/python:3.12
|
||||
@@ -28,7 +48,10 @@ jobs:
|
||||
workflows:
|
||||
lint-pack:
|
||||
when:
|
||||
not: << pipeline.parameters.run_rc_finalize_sweep >>
|
||||
not:
|
||||
or:
|
||||
- << pipeline.parameters.run_rc_finalize_sweep >>
|
||||
- << pipeline.parameters.run_enrollment_reconcile >>
|
||||
jobs:
|
||||
- orb-tools/lint:
|
||||
filters: *filters
|
||||
@@ -56,3 +79,13 @@ workflows:
|
||||
only: main
|
||||
tags:
|
||||
ignore: /.*/
|
||||
reconcile-enrollment:
|
||||
when: << pipeline.parameters.run_enrollment_reconcile >>
|
||||
jobs:
|
||||
- enrollment-reconcile:
|
||||
context: qqq-maven-registry-credentials
|
||||
filters:
|
||||
branches:
|
||||
only: main
|
||||
tags:
|
||||
ignore: /.*/
|
||||
@@ -61,6 +61,7 @@ jobs:
|
||||
python3 tests/test_reconcile_enrollment.py
|
||||
python3 tests/test_discover_enrollment.py
|
||||
python3 tests/test_finish_enrollment.py
|
||||
python3 tests/test_run_enrollment.py
|
||||
python3 tests/test_static_analysis_exit.py
|
||||
python3 tests/test_validate_standard.py
|
||||
python3 tests/test_voyage_profile.py
|
||||
|
||||
@@ -50,22 +50,31 @@ python tools/reconcile_enrollment.py --targets remote-targets.json --orb-version
|
||||
python tools/reconcile_enrollment.py --targets remote-targets.json --orb-version 0.8 --output result.json --apply
|
||||
```
|
||||
|
||||
Use existing `gh` authentication, GitHub SSH access, Git author identity and a
|
||||
working Git signing configuration. The coordinator never installs credentials
|
||||
or changes authentication. Every target is inspected at an immutable head and
|
||||
validated before any remote mutation. Only changed targets are cloned. A moved
|
||||
target stops submission; refresh the plan instead of overwriting it.
|
||||
Use existing `gh` authentication with repository write access. The coordinator
|
||||
never installs credentials or changes authentication. Every target is inspected
|
||||
at an immutable head and validated before any remote mutation. No repository
|
||||
clone, SSH key or local signing key is required. A moved target stops submission;
|
||||
refresh the plan instead of overwriting it.
|
||||
|
||||
An automation branch derives from the source commit and proposed declarations.
|
||||
The coordinator signs its commit, pushes without force, verifies the remote
|
||||
signature, parent, exact changed paths and declaration bytes, then opens a PR.
|
||||
An interrupted push or PR creation can be resumed with the same invocation:
|
||||
The coordinator creates the branch at the observed base and uses GitHub's
|
||||
`createCommitOnBranch` API with `expectedHeadOid` for an atomic append. GitHub
|
||||
signs the commit when supported by the authenticated identity; the coordinator
|
||||
requires remote signature verification, exact parent, changed paths and
|
||||
declaration bytes before opening a PR. It never force-updates a branch.
|
||||
An interrupted branch creation, commit or PR creation can be resumed:
|
||||
an existing branch still at the planned base receives the missing commit;
|
||||
matching signed branches and PRs are reused. A mismatched branch is rejected.
|
||||
Closed existing PRs are reported as existing; they are not silently reopened.
|
||||
Reports include repository, branch, immutable head and submission URL, without
|
||||
embedding declaration contents or credentials. Keep the report if a later target
|
||||
fails; earlier valid submissions remain intact.
|
||||
|
||||
API permission, signature or commit-conflict failures stop the run. A timeout
|
||||
can occur after GitHub accepted a mutation, so inspect remote state or repeat
|
||||
the same invocation; do not create a different automation branch to retry.
|
||||
See [GitHub commit API documentation](https://docs.github.com/en/graphql/reference/commits#createcommitonbranch).
|
||||
|
||||
This handles remote target lists and signed submissions. Organization discovery is described below. Qualification-aware merging and classic branch enforcement are described below; scheduling and ruleset reconciliation remain separate work. A submitted PR is not a completed migration. Unknown profiles and
|
||||
native workflows require their own central conversion, not deletion by this tool.
|
||||
|
||||
@@ -117,3 +126,27 @@ Existing active repository rulesets with app-bound gates and no bypass actors ar
|
||||
A merged source update and an enforced branch are separate reported outcomes.
|
||||
Neither proves artifact publication or deployment. Scheduling and ruleset
|
||||
reconciliation remain outstanding.
|
||||
|
||||
## Central hosted pass
|
||||
|
||||
The orb owner's CircleCI config accepts `run_enrollment_reconcile: true` on
|
||||
`main`. This selects one small Python container instead of the normal orb
|
||||
build/publication workflow. It uses the existing
|
||||
`qqq-maven-registry-credentials` context's GitHub token through `gh`.
|
||||
No consumer-specific runner configuration or local signing key is needed.
|
||||
|
||||
`tools/run_enrollment.py` verifies the owner repository and main branch, runs
|
||||
organization discovery, signed enrollment, qualified merging and enforcement,
|
||||
then exits. The pass has a 20-minute execution limit. Pending checks are reported
|
||||
for the next pass rather than polled while a paid executor waits. Incremental
|
||||
results and execution status are retained under `artifacts/enrollment`, including
|
||||
when execution fails or times out. A completed pass does not mean every repository
|
||||
conforms: unresolved and waiting entries remain explicit follow-up work.
|
||||
|
||||
Create a single daily CircleCI schedule for the owner project only after a manual
|
||||
main-branch pass verifies its hosted credentials and results. Set `branch: main`
|
||||
and `run_enrollment_reconcile: true` in the schedule parameters. Scheduling is
|
||||
an external project setting; merging this config does not itself enable a schedule.
|
||||
Keep the existing RC-finalization parameter false for these runs. A timed-out
|
||||
GitHub request may already have succeeded remotely; the next pass resumes from
|
||||
the deterministic branch and verified source rather than forcing updates.
|
||||
@@ -130,7 +130,7 @@ def load_manifest(path, setup_version):
|
||||
raise ManifestError("Unsupported QBit release tag policy")
|
||||
test_policy = data.get("test_branch_policy", "all")
|
||||
if test_policy not in ("all", "non-release", "non-release-no-integration", "feature", "non-release-no-main",
|
||||
"non-release-no-hotfix", "non-release-no-main-hotfix", "feature-no-hotfix"):
|
||||
"non-release-no-hotfix", "non-release-no-hotfix-integration", "non-release-no-main-hotfix", "feature-no-hotfix"):
|
||||
raise ManifestError("Unsupported QBit test branch policy")
|
||||
return {"profile": profile, "orb_version": version, "default_branch": default_branch,
|
||||
"java_version": java, "node_version": node, "browsers": boolean(data, "browsers", True),
|
||||
@@ -238,6 +238,7 @@ def qbit_template(config, branch, tag):
|
||||
"feature": "/(develop|main|release/.*|integration.*)/",
|
||||
"non-release-no-main": "/(develop|main|release/.*)/",
|
||||
"non-release-no-hotfix": "/(develop|release/.*|hotfix/.*)/",
|
||||
"non-release-no-hotfix-integration": "/(develop|release/.*|hotfix/.*|integration.*)/",
|
||||
"non-release-no-main-hotfix": "/(develop|main|release/.*|hotfix/.*)/",
|
||||
"feature-no-hotfix": "/(develop|main|release/.*|hotfix/.*|integration.*)/"}
|
||||
ignored = ignores[config.get("test_branch_policy", "all")]
|
||||
|
||||
@@ -130,7 +130,7 @@ def load_manifest(path, setup_version):
|
||||
raise ManifestError("Unsupported QBit release tag policy")
|
||||
test_policy = data.get("test_branch_policy", "all")
|
||||
if test_policy not in ("all", "non-release", "non-release-no-integration", "feature", "non-release-no-main",
|
||||
"non-release-no-hotfix", "non-release-no-main-hotfix", "feature-no-hotfix"):
|
||||
"non-release-no-hotfix", "non-release-no-hotfix-integration", "non-release-no-main-hotfix", "feature-no-hotfix"):
|
||||
raise ManifestError("Unsupported QBit test branch policy")
|
||||
return {"profile": profile, "orb_version": version, "default_branch": default_branch,
|
||||
"java_version": java, "node_version": node, "browsers": boolean(data, "browsers", True),
|
||||
@@ -238,6 +238,7 @@ def qbit_template(config, branch, tag):
|
||||
"feature": "/(develop|main|release/.*|integration.*)/",
|
||||
"non-release-no-main": "/(develop|main|release/.*)/",
|
||||
"non-release-no-hotfix": "/(develop|release/.*|hotfix/.*)/",
|
||||
"non-release-no-hotfix-integration": "/(develop|release/.*|hotfix/.*|integration.*)/",
|
||||
"non-release-no-main-hotfix": "/(develop|main|release/.*|hotfix/.*)/",
|
||||
"feature-no-hotfix": "/(develop|main|release/.*|hotfix/.*|integration.*)/"}
|
||||
ignored = ignores[config.get("test_branch_policy", "all")]
|
||||
|
||||
@@ -18,6 +18,42 @@ def runs():
|
||||
|
||||
|
||||
class EnforcementTests(unittest.TestCase):
|
||||
def test_profile_gates_match_shared_branch_workflows(self):
|
||||
spec = importlib.util.spec_from_file_location('pipeline',
|
||||
Path(__file__).resolve().parents[1] / 'src/scripts/generate_pipeline.py')
|
||||
pipeline = importlib.util.module_from_spec(spec)
|
||||
spec.loader.exec_module(pipeline)
|
||||
for profile in ('all', 'cli', 'android', 'app-starter', 'mcp-policy'):
|
||||
desired = enforcement.gates(profile)
|
||||
for branch in ('main', 'develop', 'feature/change'):
|
||||
config = {'orb_version': '0.8', 'publish': {'snapshot': False, 'release': False}}
|
||||
output = pipeline.PROFILE_TEMPLATES[profile](config, branch, '')
|
||||
self.assertEqual([desired[1]['context']], list(output['workflows']))
|
||||
successful = [{'id': i, 'name': gate['context'], 'app': {'id': 18001},
|
||||
'conclusion': 'success'} for i, gate in enumerate(desired)]
|
||||
before = {'required_status_checks': {'checks': [
|
||||
*desired, {'context': 'scanner', 'app_id': 15368}]}}
|
||||
checks = enforcement.required_checks(before, successful, desired)['checks']
|
||||
self.assertTrue(enforcement.same_checks(before['required_status_checks']['checks'], checks))
|
||||
self.assertNotIn({'context': 'verify', 'app_id': 18001}, checks)
|
||||
for bad in (successful[:1], [*successful, dict(successful[1], id=99, conclusion='failure')],
|
||||
[dict(run, app={'id': 999}) for run in successful]):
|
||||
with self.subTest(profile=profile), self.assertRaises(ValueError):
|
||||
enforcement.required_checks(before, bad, desired)
|
||||
record, effective = self.ruleset_fixture()
|
||||
record['rules'][0]['parameters']['required_status_checks'] = [
|
||||
{'context': gate['context'], 'integration_id': gate['app_id']} for gate in desired]
|
||||
enforcement.verified_rulesets('QRun-IO/example', effective, lambda path: record, desired)
|
||||
with self.assertRaises(ValueError):
|
||||
enforcement.verified_rulesets('QRun-IO/example', effective, lambda path: record)
|
||||
|
||||
def test_check_comparison_ignores_only_order(self):
|
||||
checks = [*enforcement.DESIRED, {'context': 'scanner', 'app_id': 15368}]
|
||||
self.assertTrue(enforcement.same_checks(checks, list(reversed(checks))))
|
||||
self.assertFalse(enforcement.same_checks(checks, checks[:-1]))
|
||||
self.assertFalse(enforcement.same_checks(checks, checks + checks[:1]))
|
||||
self.assertFalse(enforcement.same_checks(checks, [*enforcement.DESIRED, {'context': 'scanner', 'app_id': 999}]))
|
||||
|
||||
def test_preserves_security_gate_and_binds_orb_checks(self):
|
||||
before = {'required_status_checks': {'strict': False, 'contexts': ['security', 'setup'],
|
||||
'checks': [{'context': 'security', 'app_id': 15368}, {'context': 'setup', 'app_id': -1}]}}
|
||||
@@ -82,6 +118,22 @@ class EnforcementTests(unittest.TestCase):
|
||||
enforcement.enforce(plan, request)
|
||||
self.assertEqual([], state['writes'])
|
||||
|
||||
def test_github_may_reorder_required_checks_on_readback(self):
|
||||
before = {'required_status_checks': {'strict': True, 'checks': [
|
||||
*enforcement.DESIRED, {'context': 'scanner', 'app_id': 15368}]},
|
||||
'enforce_admins': {'enabled': False}, 'required_signatures': {'enabled': True}}
|
||||
plan, request, state = self.fixture(before)
|
||||
|
||||
def reordered(path, method='GET', payload=None):
|
||||
value = request(path, method, payload)
|
||||
if method == 'PATCH':
|
||||
state['before']['required_status_checks']['checks'].reverse()
|
||||
return value
|
||||
|
||||
enforcement.enforce(plan, reordered)
|
||||
self.assertTrue(state['before']['enforce_admins']['enabled'])
|
||||
self.assertEqual(before['required_signatures'], state['before']['required_signatures'])
|
||||
|
||||
def test_head_or_protection_drift_never_mutates(self):
|
||||
for field, value in [('head', 'b' * 40), ('before', {'unexpected': True})]:
|
||||
plan, request, state = self.fixture(None)
|
||||
|
||||
@@ -29,6 +29,17 @@ class FinishTests(unittest.TestCase):
|
||||
{'statuses': [{'context': 'legacy-test', 'state': 'pending'}]}]):
|
||||
self.assertEqual(['legacy-test', 'scanner', 'verify'], finish.qualification('QRun-IO/example', 'b' * 40))
|
||||
|
||||
def test_profile_qualification_requires_its_actual_workflow(self):
|
||||
for profile in ('all', 'cli', 'android', 'app-starter', 'mcp-policy'):
|
||||
checks = self.checks()
|
||||
checks[1]['name'] = finish.enforcement.PROFILE_GATES[profile]
|
||||
with mock.patch.object(finish.remote, 'api', side_effect=[
|
||||
{'check_runs': checks}, {'statuses': []}]):
|
||||
self.assertEqual([], finish.qualification('QRun-IO/example', 'b' * 40, profile))
|
||||
with mock.patch.object(finish.remote, 'api', side_effect=[
|
||||
{'check_runs': self.checks()}, {'statuses': []}]):
|
||||
self.assertEqual([checks[1]['name']], finish.qualification('QRun-IO/example', 'b' * 40, profile))
|
||||
|
||||
def test_failed_or_missing_checks_never_merge(self):
|
||||
with mock.patch.object(finish.remote, 'verify_submission'), mock.patch.object(finish.remote, 'command', return_value=json.dumps(self.pr)) as command, mock.patch.object(finish.remote, 'api', return_value={'commit': {'sha': self.plan['head']}}), mock.patch.object(finish, 'qualification', return_value=['verify']):
|
||||
self.assertEqual('waiting-checks', finish.merge_ready(self.plan, self.result)['state'])
|
||||
@@ -72,7 +83,7 @@ class FinishTests(unittest.TestCase):
|
||||
enforce.assert_called_once_with(current)
|
||||
|
||||
def test_unknown_gate_profile_never_merges_or_enforces(self):
|
||||
self.plan['profile'] = 'all'
|
||||
self.plan['profile'] = 'frontend-next'
|
||||
with mock.patch.object(finish.remote, 'command') as command, mock.patch.object(finish.enforcement, 'inspect') as inspect:
|
||||
self.assertEqual('unsupported-gates', finish.merge_ready(self.plan, self.result)['state'])
|
||||
self.assertEqual('unsupported-gates', finish.enforce_current(self.plan)['state'])
|
||||
|
||||
@@ -118,41 +118,67 @@ class ReconcileTests(unittest.TestCase):
|
||||
self.assertEqual('submitted', result['state'])
|
||||
self.assertEqual([['gh', 'pr', 'create']], seen)
|
||||
|
||||
def test_new_submission_requires_signed_commit_and_never_force_pushes(self):
|
||||
def test_new_api_submission_is_atomic_and_exact(self):
|
||||
plan = self.plan()
|
||||
committed = False
|
||||
seen = []
|
||||
mutations = []
|
||||
|
||||
def request(path, missing=False):
|
||||
if '/git/ref/' in path:
|
||||
return None
|
||||
if '/pulls?' in path:
|
||||
return []
|
||||
return self.submission_api(plan, path, missing)
|
||||
|
||||
def command(args, cwd=None):
|
||||
nonlocal committed
|
||||
seen.append(args)
|
||||
if args[:2] == ['git', 'clone']:
|
||||
root = Path(args[-1])
|
||||
(root / '.circleci').mkdir(parents=True)
|
||||
for name, data in self.sources.items():
|
||||
(root / name).write_bytes(data)
|
||||
elif args[:2] == ['git', 'rev-parse']:
|
||||
return self.new if committed else self.head
|
||||
elif args[:2] == ['git', 'commit']:
|
||||
self.assertIn('-S', args)
|
||||
for name in remote.PATHS:
|
||||
self.assertEqual(plan['replacements'][name], (cwd / name).read_bytes())
|
||||
committed = True
|
||||
elif args[:3] == ['gh', 'pr', 'create']:
|
||||
return 'https://github.com/QRun-IO/example/pull/3'
|
||||
return ''
|
||||
def mutate(path, payload):
|
||||
mutations.append((path, payload))
|
||||
return {'data': {'createCommitOnBranch': {'commit': {'oid': self.new}}}}
|
||||
|
||||
with mock.patch.object(remote, 'api', side_effect=request), mock.patch.object(remote, 'command', side_effect=command):
|
||||
self.assertEqual('submitted', remote.apply(plan)['state'])
|
||||
pushes = [args for args in seen if args[:2] == ['git', 'push']]
|
||||
self.assertEqual([['git', 'push', 'origin', 'HEAD:refs/heads/' + plan['automation_branch']]], pushes)
|
||||
with mock.patch.object(remote, 'api', side_effect=request), mock.patch.object(remote, 'mutation', side_effect=mutate), mock.patch.object(remote, 'command') as command:
|
||||
self.assertEqual('existing-pr', remote.apply(plan)['state'])
|
||||
command.assert_not_called()
|
||||
self.assertEqual(('repos/' + self.repo + '/git/refs', {'ref': 'refs/heads/' + plan['automation_branch'], 'sha': self.head}), mutations[0])
|
||||
commit = mutations[1][1]['variables']['input']
|
||||
self.assertEqual(self.head, commit['expectedHeadOid'])
|
||||
self.assertEqual({'repositoryNameWithOwner': self.repo, 'branchName': plan['automation_branch']}, commit['branch'])
|
||||
self.assertEqual(plan['replacements'], {item['path']: base64.b64decode(item['contents']) for item in commit['fileChanges']['additions']})
|
||||
|
||||
def test_base_only_branch_resumes_without_creating_another_ref(self):
|
||||
plan = self.plan()
|
||||
result = {'data': {'createCommitOnBranch': {'commit': {'oid': self.new}}}}
|
||||
with mock.patch.object(remote, 'api', return_value={'commit': {'sha': self.head}}), mock.patch.object(remote, 'mutation', return_value=result) as mutation:
|
||||
self.assertEqual(self.new, remote.signed_api_commit(plan, {'object': {'sha': self.head}}))
|
||||
self.assertEqual(1, mutation.call_count)
|
||||
self.assertEqual('graphql', mutation.call_args.args[0])
|
||||
|
||||
def test_existing_completed_branch_is_not_mutated(self):
|
||||
with mock.patch.object(remote, 'mutation') as mutation:
|
||||
self.assertEqual(self.new, remote.signed_api_commit(self.plan(), {'object': {'sha': self.new}}))
|
||||
mutation.assert_not_called()
|
||||
|
||||
def test_target_drift_prevents_commit_on_base_only_branch(self):
|
||||
plan = self.plan()
|
||||
with mock.patch.object(remote, 'api', return_value={'commit': {'sha': 'c' * 40}}), mock.patch.object(remote, 'mutation') as mutation:
|
||||
with self.assertRaises(ValueError):
|
||||
remote.signed_api_commit(plan, {'object': {'sha': self.head}})
|
||||
mutation.assert_not_called()
|
||||
|
||||
def test_graphql_errors_fail_closed(self):
|
||||
response = mock.Mock(returncode=0, stdout='{"errors": [{"message": "conflict"}]}')
|
||||
with mock.patch.object(remote.subprocess, 'run', return_value=response):
|
||||
with self.assertRaises(ValueError):
|
||||
remote.mutation('graphql', {})
|
||||
|
||||
def test_unsigned_api_commit_cannot_create_pr(self):
|
||||
plan = self.plan()
|
||||
def request(path, missing=False):
|
||||
if '/git/ref/' in path:
|
||||
return {'object': {'sha': self.head}}
|
||||
value = self.submission_api(plan, path, missing)
|
||||
if '/commits/' in path:
|
||||
value['commit']['verification']['verified'] = False
|
||||
return value
|
||||
with mock.patch.object(remote, 'api', side_effect=request), mock.patch.object(remote, 'mutation', return_value={'data': {'createCommitOnBranch': {'commit': {'oid': self.new}}}}), mock.patch.object(remote, 'command') as command:
|
||||
with self.assertRaises(ValueError):
|
||||
remote.apply(plan)
|
||||
command.assert_not_called()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
"""Central execution rejects untrusted branches and preserves partial evidence."""
|
||||
import json
|
||||
from pathlib import Path
|
||||
import subprocess
|
||||
import sys
|
||||
import tempfile
|
||||
import unittest
|
||||
from unittest.mock import Mock
|
||||
|
||||
sys.path.insert(0, str(Path(__file__).resolve().parents[1] / 'tools'))
|
||||
import run_enrollment
|
||||
|
||||
|
||||
class RunnerTests(unittest.TestCase):
|
||||
def environment(self):
|
||||
return {'CIRCLE_PROJECT_USERNAME': 'QRun-IO', 'CIRCLE_PROJECT_REPONAME': 'qqq-orb',
|
||||
'CIRCLE_BRANCH': 'main', 'GITHUB_TOKEN': 'test-only-secret'}
|
||||
|
||||
def test_wrong_owner_branch_repo_tag_or_missing_auth_cannot_execute(self):
|
||||
for change in ({'CIRCLE_PROJECT_USERNAME': 'other'}, {'CIRCLE_PROJECT_REPONAME': 'other'},
|
||||
{'CIRCLE_BRANCH': 'develop'}, {'CIRCLE_TAG': 'v1.0.0'}, {'GITHUB_TOKEN': ''}):
|
||||
execute = Mock()
|
||||
with self.subTest(change=change), self.assertRaises(ValueError):
|
||||
run_enrollment.run({**self.environment(), **change}, execute)
|
||||
execute.assert_not_called()
|
||||
|
||||
def test_timeout_retains_partial_report_without_secrets(self):
|
||||
with tempfile.TemporaryDirectory() as directory:
|
||||
def execute(args, **kwargs):
|
||||
output = Path(args[args.index('--output') + 1])
|
||||
output.write_text('[{"state":"unresolved"}]')
|
||||
self.assertEqual(1200, kwargs['timeout'])
|
||||
self.assertEqual('test-only-secret', kwargs['env']['GH_TOKEN'])
|
||||
raise subprocess.TimeoutExpired(args, 1200)
|
||||
self.assertEqual(124, run_enrollment.run(self.environment(), execute, directory))
|
||||
output = Path(directory) / 'artifacts/enrollment'
|
||||
self.assertEqual([{'state': 'unresolved'}], json.loads((output / 'result.json').read_text()))
|
||||
self.assertEqual('timed-out', json.loads((output / 'run.json').read_text())['state'])
|
||||
self.assertNotIn('test-only-secret', (output / 'run.json').read_text())
|
||||
|
||||
def test_failed_pass_propagates_nonzero_exit(self):
|
||||
with tempfile.TemporaryDirectory() as directory:
|
||||
self.assertEqual(2, run_enrollment.run(self.environment(), Mock(return_value=Mock(returncode=2)), directory))
|
||||
self.assertEqual('failed', json.loads((Path(directory) / 'artifacts/enrollment/run.json').read_text())['state'])
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
@@ -3,6 +3,7 @@ import importlib.util
|
||||
import json
|
||||
from pathlib import Path
|
||||
import re
|
||||
import tempfile
|
||||
import unittest
|
||||
from unittest import mock
|
||||
|
||||
@@ -15,6 +16,38 @@ spec.loader.exec_module(migration)
|
||||
|
||||
|
||||
class MigrationTests(unittest.TestCase):
|
||||
def test_hotfix_and_integration_exclusion_preserves_main_tests_and_publications(self):
|
||||
pattern = "/(develop|release/.*|hotfix/.*|integration.*)/"
|
||||
config = self.config(filters={"branches": {"ignore": pattern}, "tags": {"only": []}})
|
||||
for kind, branch in (("snapshot", "develop"), ("release_candidate", r"/release\/.*/"), ("hotfix", r"/hotfix\/.*/")):
|
||||
config["workflows"][kind] = {"jobs": [{"qqq-orb/mvn_publish": {
|
||||
"branch_type": kind, "filters": {"branches": {"only": [branch]}}}}]}
|
||||
config["workflows"]["release"] = {"jobs": [{"qqq-orb/mvn_publish": {
|
||||
"branch_type": "release", "filters": {"branches": {"ignore": "/.*/"},
|
||||
"tags": {"only": [r"/^v\d+\.\d+\.\d+$/"]}}}}]}
|
||||
manifest = migration.infer_manifest(config, "0.8", "develop")
|
||||
self.assertEqual("non-release-no-hotfix-integration", manifest["test_branch_policy"])
|
||||
self.assertFalse(manifest["release_on_main"])
|
||||
self.assertEqual("stable", manifest["release_tag_policy"])
|
||||
self.assertTrue(all(manifest["publish"][kind] for kind in ("snapshot", "release_candidate", "release", "hotfix")))
|
||||
spec = importlib.util.spec_from_file_location("filter_pipeline", Path(__file__).resolve().parents[1] / "src/scripts/generate_pipeline.py")
|
||||
pipeline = importlib.util.module_from_spec(spec)
|
||||
spec.loader.exec_module(pipeline)
|
||||
with tempfile.TemporaryDirectory() as directory:
|
||||
path = Path(directory) / "manifest.yml"
|
||||
path.write_text(yaml.safe_dump(manifest), encoding="utf-8")
|
||||
loaded = pipeline.load_manifest(path, "0.8")
|
||||
with mock.patch.object(pipeline, "proven_ci_maintenance", return_value=False), mock.patch.object(pipeline, "proven_docs_only", return_value=False), mock.patch.object(pipeline, "git", return_value=b"qualified-head\n"):
|
||||
for branch, tag, kind in (("main", "", None), ("feature/test", "", None),
|
||||
("integration-test", "", None), ("develop", "", "snapshot"),
|
||||
("release/1.0", "", "release_candidate"), ("hotfix/1.0.1", "", "hotfix"),
|
||||
("", "v1.0.0", "release")):
|
||||
result = pipeline.qbit_template(loaded, branch, tag)
|
||||
options = next(iter(next(iter(result["workflows"].values()))["jobs"][0].values()))
|
||||
self.assertEqual(kind, options.get("branch_type"))
|
||||
if kind is None:
|
||||
self.assertEqual(["automation/qbit-rc-pending", pattern], options["filters"]["branches"]["ignore"])
|
||||
|
||||
def test_630_original_filter_intersections_equal_generated_publications(self):
|
||||
spec = importlib.util.spec_from_file_location(
|
||||
"publication_pipeline", Path(__file__).resolve().parents[1] / "src/scripts/generate_pipeline.py")
|
||||
|
||||
+38
-19
@@ -14,7 +14,23 @@ spec = importlib.util.spec_from_file_location('standard', ROOT / 'src/scripts/va
|
||||
standard = importlib.util.module_from_spec(spec)
|
||||
spec.loader.exec_module(standard)
|
||||
DESIRED = [{'context': name, 'app_id': 18001} for name in ('setup', 'verify')]
|
||||
PROFILES = {'qbit', 'core', 'frontend-core', 'frontend-material', 'repository-policy'}
|
||||
PROFILE_GATES = {profile: 'verify' for profile in (
|
||||
'qbit', 'core', 'frontend-core', 'frontend-material', 'repository-policy')}
|
||||
PROFILE_GATES.update({'all': 'verify-and-smoke', 'cli': 'test_only',
|
||||
'app-starter': 'test_only', 'android': 'test-and-build',
|
||||
'mcp-policy': 'validate'})
|
||||
PROFILES = set(PROFILE_GATES)
|
||||
|
||||
|
||||
def gates(profile):
|
||||
return [{'context': name, 'app_id': 18001}
|
||||
for name in ('setup', PROFILE_GATES[profile])]
|
||||
|
||||
|
||||
def same_checks(left, right):
|
||||
"""GitHub may reorder checks; retain exact bindings and duplicate counts."""
|
||||
return sorted(json.dumps(check, sort_keys=True) for check in left) == sorted(
|
||||
json.dumps(check, sort_keys=True) for check in right)
|
||||
|
||||
|
||||
def api(path, method='GET', payload=None):
|
||||
@@ -35,9 +51,9 @@ def api(path, method='GET', payload=None):
|
||||
return json.loads(result.stdout) if result.stdout.strip() else None
|
||||
|
||||
|
||||
def required_checks(before, runs):
|
||||
def required_checks(before, runs, desired_gates=DESIRED):
|
||||
"""Append app-bound gates only after both succeeded; preserve all other gates."""
|
||||
for desired in DESIRED:
|
||||
for desired in desired_gates:
|
||||
matches = [run for run in runs if run['name'] == desired['context'] and run['app']['id'] == desired['app_id']]
|
||||
if not matches or max(matches, key=lambda run: run['id'])['conclusion'] != 'success':
|
||||
raise ValueError('Current branch head has no successful CircleCI ' + desired['context'])
|
||||
@@ -45,7 +61,7 @@ def required_checks(before, runs):
|
||||
checks = [dict(check) for check in prior.get('checks', [])]
|
||||
represented = {check['context'] for check in checks}
|
||||
checks += [{'context': name, 'app_id': -1} for name in prior.get('contexts', []) if name not in represented]
|
||||
for desired in DESIRED:
|
||||
for desired in desired_gates:
|
||||
matches = [check for check in checks if check['context'] == desired['context']]
|
||||
if any(check.get('app_id') not in (None, -1, desired['app_id']) for check in matches):
|
||||
raise ValueError('Existing gate uses a different app: ' + desired['context'])
|
||||
@@ -54,7 +70,7 @@ def required_checks(before, runs):
|
||||
return {'strict': True, 'checks': checks}
|
||||
|
||||
|
||||
def verified_rulesets(repo, effective, request=api):
|
||||
def verified_rulesets(repo, effective, request=api, desired_gates=DESIRED):
|
||||
"""Recognize active repository rulesets with bound gates and no bypass actors."""
|
||||
selected = [rule for rule in effective if rule['type'] == 'required_status_checks']
|
||||
if not selected or any(rule.get('ruleset_source_type') != 'Repository'
|
||||
@@ -70,7 +86,7 @@ def verified_rulesets(repo, effective, request=api):
|
||||
records.append(record)
|
||||
requirements = [rule['parameters'] for record in records for rule in record['rules']
|
||||
if rule['type'] == 'required_status_checks']
|
||||
for desired in DESIRED:
|
||||
for desired in desired_gates:
|
||||
if not any(check['context'] == desired['context'] and check.get('integration_id') == desired['app_id']
|
||||
for parameters in requirements for check in parameters['required_status_checks']):
|
||||
raise ValueError('Ruleset is missing app-bound gate: ' + desired['context'])
|
||||
@@ -96,10 +112,12 @@ def inspect(repo, branch, version, request=api):
|
||||
raise ValueError('Canonical declarations must be regular files')
|
||||
source.append(base64.b64decode(item['content'], validate=False).decode('utf-8'))
|
||||
standard.validate(*source, version)
|
||||
if standard.load_yaml(source[1])['profile'] not in PROFILES:
|
||||
raise ValueError('Profile does not use the shared setup/verify gate pair')
|
||||
profile = standard.load_yaml(source[1])['profile']
|
||||
if profile not in PROFILES:
|
||||
raise ValueError('Profile has no supported shared branch gates')
|
||||
desired_gates = gates(profile)
|
||||
rules = request(root + '/rules/branches/' + branch)
|
||||
rulesets, ruleset_strict = verified_rulesets(repo, rules, request) if rules else ([], False)
|
||||
rulesets, ruleset_strict = verified_rulesets(repo, rules, request, desired_gates) if rules else ([], False)
|
||||
before = request(prefix + '/protection')
|
||||
restrictions = (before or {}).get('restrictions')
|
||||
use_ruleset = (not rulesets and restrictions is not None
|
||||
@@ -113,32 +131,33 @@ def inspect(repo, branch, version, request=api):
|
||||
if len(batch) < 100:
|
||||
break
|
||||
page += 1
|
||||
desired = required_checks(before, runs)
|
||||
desired = required_checks(before, runs, desired_gates)
|
||||
if use_ruleset:
|
||||
return {'repository': repo, 'branch': branch, 'head': head, 'before': before,
|
||||
'required_status_checks': {'strict': False, 'checks': DESIRED},
|
||||
return {'repository': repo, 'branch': branch, 'head': head, 'before': before, 'gates': desired_gates,
|
||||
'required_status_checks': {'strict': False, 'checks': desired_gates},
|
||||
'changed': True, 'protection_mode': 'create-ruleset'}
|
||||
if rulesets:
|
||||
desired['strict'] = ruleset_strict or bool(((before or {}).get('required_status_checks') or {}).get('strict'))
|
||||
return {'repository': repo, 'branch': branch, 'head': head, 'before': before,
|
||||
return {'repository': repo, 'branch': branch, 'head': head, 'before': before, 'gates': desired_gates,
|
||||
'required_status_checks': desired, 'changed': False, 'protection_mode': 'rulesets',
|
||||
'effective_rules': rules, 'rulesets': rulesets}
|
||||
current = (before or {}).get('required_status_checks') or {}
|
||||
ready = (current.get('strict') is True and current.get('checks') == desired['checks']
|
||||
ready = (current.get('strict') is True and same_checks(current.get('checks', []), desired['checks'])
|
||||
and (before or {}).get('enforce_admins', {}).get('enabled') is True)
|
||||
return {'repository': repo, 'branch': branch, 'head': head, 'before': before,
|
||||
return {'repository': repo, 'branch': branch, 'head': head, 'before': before, 'gates': desired_gates,
|
||||
'required_status_checks': desired, 'changed': not ready}
|
||||
|
||||
|
||||
def enforce(plan, request=api):
|
||||
"""Recheck drift, use narrow updates, and verify preservation of other settings."""
|
||||
desired_gates = plan.get('gates', DESIRED)
|
||||
root = 'repos/' + plan['repository']
|
||||
prefix = root + '/branches/' + plan['branch']
|
||||
if request(prefix)['commit']['sha'] != plan['head'] or request(prefix + '/protection') != plan['before']:
|
||||
raise ValueError('Branch or protection changed after preflight')
|
||||
rules = request(root + '/rules/branches/' + plan['branch'])
|
||||
if plan.get('protection_mode') == 'rulesets':
|
||||
if rules != plan['effective_rules'] or verified_rulesets(plan['repository'], rules, request)[0] != plan['rulesets']:
|
||||
if rules != plan['effective_rules'] or verified_rulesets(plan['repository'], rules, request, desired_gates)[0] != plan['rulesets']:
|
||||
raise ValueError('Ruleset changed after preflight')
|
||||
return
|
||||
if rules:
|
||||
@@ -159,9 +178,9 @@ def enforce(plan, request=api):
|
||||
'rules': [{'type': 'required_status_checks', 'parameters': {
|
||||
'strict_required_status_checks_policy': False, 'do_not_enforce_on_create': False,
|
||||
'required_status_checks': [{'context': gate['context'], 'integration_id': gate['app_id']}
|
||||
for gate in DESIRED]}}]})
|
||||
for gate in desired_gates]}}]})
|
||||
effective = request(root + '/rules/branches/' + plan['branch'])
|
||||
verified_rulesets(plan['repository'], effective, request)
|
||||
verified_rulesets(plan['repository'], effective, request, desired_gates)
|
||||
if request(prefix + '/protection') != plan['before']:
|
||||
raise ValueError('Classic access policy changed during ruleset creation')
|
||||
return
|
||||
@@ -178,7 +197,7 @@ def enforce(plan, request=api):
|
||||
request(prefix + '/protection/enforce_admins', 'POST')
|
||||
after = request(prefix + '/protection')
|
||||
actual = after['required_status_checks']
|
||||
if not actual['strict'] or actual['checks'] != plan['required_status_checks']['checks'] or not after['enforce_admins']['enabled']:
|
||||
if not actual['strict'] or not same_checks(actual['checks'], plan['required_status_checks']['checks']) or not after['enforce_admins']['enabled']:
|
||||
raise ValueError('Protection readback did not match requested gates')
|
||||
if before:
|
||||
for key, value in before.items():
|
||||
|
||||
@@ -5,7 +5,7 @@ import enforce_orb_checks as enforcement
|
||||
import reconcile_enrollment as remote
|
||||
|
||||
|
||||
def qualification(repo, head):
|
||||
def qualification(repo, head, profile='qbit'):
|
||||
"""Require both app-bound orb gates and every advertised latest check/status."""
|
||||
checks, page = [], 1
|
||||
while True:
|
||||
@@ -15,7 +15,8 @@ def qualification(repo, head):
|
||||
break
|
||||
page += 1
|
||||
reasons = []
|
||||
for name in ('setup', 'verify'):
|
||||
for gate in enforcement.gates(profile):
|
||||
name = gate['context']
|
||||
found = [check for check in checks if check['name'] == name and check['app']['id'] == 18001]
|
||||
if not found or max(found, key=lambda check: check['id'])['conclusion'] != 'success':
|
||||
reasons.append(name)
|
||||
@@ -49,7 +50,7 @@ def merge_ready(plan, result):
|
||||
if pr['state'] != 'MERGED':
|
||||
if pr['baseRefOid'] != plan['head'] or remote.api(f'repos/{repo}/branches/{plan["branch"]}')['commit']['sha'] != plan['head']:
|
||||
return {'state': 'stale-base', 'url': result['url']}
|
||||
pending = qualification(repo, head)
|
||||
pending = qualification(repo, head, plan['profile'])
|
||||
if pending:
|
||||
return {'state': 'waiting-checks', 'checks': pending, 'url': result['url']}
|
||||
remote.command(['gh', 'pr', 'merge', str(pr['number']), '--repo', repo, '--squash', '--match-head-commit', head])
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
# Ubuntu Jammy ships gh 2.4, which lacks API --slurp and modern merge guards.
|
||||
# Pin the official amd64 release and its GitHub release asset SHA-256.
|
||||
version=2.103.0
|
||||
checksum=fdd768eb70f6409f80fcfa9f3a1c0adf0fc98d827ab3ce0bed2ac22762c5d786
|
||||
archive=$(mktemp)
|
||||
binary=$(mktemp)
|
||||
trap 'rm -f "$archive" "$binary"' EXIT
|
||||
curl --fail --silent --show-error --location --retry 3 \
|
||||
"https://github.com/cli/cli/releases/download/v${version}/gh_${version}_linux_amd64.tar.gz" -o "$archive"
|
||||
printf '%s %s\n' "$checksum" "$archive" | sha256sum --check --status
|
||||
tar -xOzf "$archive" "gh_${version}_linux_amd64/bin/gh" > "$binary"
|
||||
sudo install -m 0755 "$binary" /usr/local/bin/gh
|
||||
gh --version
|
||||
gh api --help | grep -q -- --slurp
|
||||
gh pr merge --help | grep -q -- --match-head-commit
|
||||
@@ -50,6 +50,50 @@ def content(repo, path, head):
|
||||
return base64.b64decode(item['content'])
|
||||
|
||||
|
||||
def mutation(path, payload):
|
||||
"""Use the existing gh identity; never print credentials or response bodies."""
|
||||
result = subprocess.run(['gh', 'api', path, '--method', 'POST', '--input', '-'],
|
||||
input=json.dumps(payload), capture_output=True,
|
||||
text=True, encoding='utf-8', timeout=60)
|
||||
if result.returncode:
|
||||
raise ValueError('GitHub mutation failed; inspect remote state before retrying')
|
||||
try:
|
||||
data = json.loads(result.stdout)
|
||||
except ValueError:
|
||||
raise ValueError('Invalid GitHub mutation response') from None
|
||||
if not isinstance(data, dict) or data.get('errors'):
|
||||
raise ValueError('GitHub mutation did not succeed')
|
||||
return data
|
||||
|
||||
|
||||
def signed_api_commit(plan, ref):
|
||||
"""Resume a base-only branch; append atomically without local Git/SSH keys."""
|
||||
repo, branch, base = plan['repository'], plan['automation_branch'], plan['head']
|
||||
if ref is None:
|
||||
mutation(f'repos/{repo}/git/refs', {'ref': 'refs/heads/' + branch, 'sha': base})
|
||||
elif ref['object']['sha'] != base:
|
||||
return ref['object']['sha']
|
||||
if api(f'repos/{repo}/branches/{plan["branch"]}')['commit']['sha'] != base:
|
||||
raise ValueError('Target branch moved before submission')
|
||||
additions = [{'path': path, 'contents': base64.b64encode(plan['replacements'][path]).decode('ascii')}
|
||||
for path in PATHS if plan['originals'][path] != plan['replacements'][path]]
|
||||
result = mutation('graphql', {
|
||||
'query': 'mutation($input: CreateCommitOnBranchInput!) { createCommitOnBranch(input: $input) { commit { oid } } }',
|
||||
'variables': {'input': {
|
||||
'branch': {'repositoryNameWithOwner': repo, 'branchName': branch},
|
||||
'expectedHeadOid': base,
|
||||
'message': {'headline': 'ci: enroll in the shared QQQ orb',
|
||||
'body': 'Co-Authored-By: Codex <noreply@openai.com>'},
|
||||
'fileChanges': {'additions': additions}}}})
|
||||
try:
|
||||
head = result['data']['createCommitOnBranch']['commit']['oid']
|
||||
except (KeyError, TypeError):
|
||||
raise ValueError('GitHub commit response is incomplete') from None
|
||||
if not isinstance(head, str) or not re.fullmatch(r'[0-9a-f]{40}', head):
|
||||
raise ValueError('GitHub commit response has no valid SHA')
|
||||
return head
|
||||
|
||||
|
||||
def inspect(target, version):
|
||||
"""Resolve observed repository identity and reuse the shared enrollment planner."""
|
||||
if not isinstance(target, dict) or set(target) != {'repository', 'branch'}:
|
||||
@@ -103,29 +147,7 @@ def apply(plan):
|
||||
if api(f'repos/{repo}/branches/{plan["branch"]}')['commit']['sha'] != plan['head']:
|
||||
raise ValueError('Target branch changed after preflight')
|
||||
ref = api(f'repos/{repo}/git/ref/heads/{branch}', missing=True)
|
||||
if ref is None:
|
||||
with tempfile.TemporaryDirectory() as directory:
|
||||
root = Path(directory) / 'checkout'
|
||||
command(['git', 'clone', '-c', 'core.autocrlf=false', '--depth', '1', '--single-branch', '--branch', plan['branch'],
|
||||
f'git@github.com:{repo}.git', str(root)])
|
||||
if command(['git', 'rev-parse', 'HEAD'], root) != plan['head']:
|
||||
raise ValueError('Target branch moved before checkout')
|
||||
for path in PATHS:
|
||||
target = enroll_consumers.declaration(root, path)
|
||||
current = target.read_bytes() if target.exists() else None
|
||||
if current != plan['originals'][path]:
|
||||
raise ValueError('Checkout differs from immutable preflight')
|
||||
target.write_bytes(plan['replacements'][path])
|
||||
command(['git', 'add', '--', *PATHS], root)
|
||||
command(['git', 'diff', '--cached', '--check'], root)
|
||||
command(['git', 'commit', '-S', '-m', 'ci: enroll in the shared QQQ orb', '-m',
|
||||
'Co-Authored-By: Codex <noreply@openai.com>'], root)
|
||||
head = command(['git', 'rev-parse', 'HEAD'], root)
|
||||
if api(f'repos/{repo}/branches/{plan["branch"]}')['commit']['sha'] != plan['head']:
|
||||
raise ValueError('Target branch moved before submission')
|
||||
command(['git', 'push', 'origin', f'HEAD:refs/heads/{branch}'], root)
|
||||
else:
|
||||
head = ref['object']['sha']
|
||||
head = signed_api_commit(plan, ref)
|
||||
verify_submission(plan, head)
|
||||
pulls = api(f'repos/{repo}/pulls?state=all&head={repo.split("/")[0]}:{branch}&base={plan["branch"]}')
|
||||
if pulls:
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
#!/usr/bin/env python3
|
||||
"""One bounded central reconciliation pass; no executor polling for PR checks."""
|
||||
import json
|
||||
import os
|
||||
from pathlib import Path
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
|
||||
def run(environment=None, execute=subprocess.run, root=None):
|
||||
env = dict(os.environ if environment is None else environment)
|
||||
if (env.get('CIRCLE_PROJECT_USERNAME') != 'QRun-IO'
|
||||
or env.get('CIRCLE_PROJECT_REPONAME') != 'qqq-orb'
|
||||
or env.get('CIRCLE_BRANCH') != 'main' or env.get('CIRCLE_TAG')):
|
||||
raise ValueError('Reconciliation requires the orb main branch')
|
||||
token = env.get('GH_TOKEN') or env.get('GITHUB_TOKEN')
|
||||
if not token:
|
||||
raise ValueError('Existing GitHub authentication is required')
|
||||
env['GH_TOKEN'] = token
|
||||
root = Path(root) if root else Path(__file__).resolve().parents[1]
|
||||
output = root / 'artifacts/enrollment'
|
||||
output.mkdir(parents=True, exist_ok=True)
|
||||
args = [sys.executable, str(root / 'tools/reconcile_enrollment.py'),
|
||||
'--organization', 'QRun-IO', '--orb-version', '0.8',
|
||||
'--output', str(output / 'result.json'), '--apply', '--merge-ready', '--enforce']
|
||||
try:
|
||||
result = execute(args, cwd=root, env=env, timeout=1200, check=False)
|
||||
code = result.returncode
|
||||
state = 'completed' if code == 0 else 'failed'
|
||||
except subprocess.TimeoutExpired:
|
||||
code, state = 124, 'timed-out'
|
||||
(output / 'run.json').write_text(json.dumps({'state': state, 'exit_code': code,
|
||||
'report_available': (output / 'result.json').exists(),
|
||||
'note': 'Completion of a pass does not prove all repositories conform; inspect unresolved and waiting entries.'}, indent=2), encoding='utf-8')
|
||||
return code
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
sys.exit(run())
|
||||
@@ -91,6 +91,7 @@ def test_filters(filters):
|
||||
"/(develop|main|release/.*|integration.*)/": "feature",
|
||||
"/(develop|main|release/.*)/": "non-release-no-main",
|
||||
"/(develop|release/.*|hotfix/.*)/": "non-release-no-hotfix",
|
||||
"/(develop|release/.*|hotfix/.*|integration.*)/": "non-release-no-hotfix-integration",
|
||||
"/(develop|main|release/.*|hotfix/.*)/": "non-release-no-main-hotfix",
|
||||
"/(develop|main|release/.*|hotfix/.*|integration.*)/": "feature-no-hotfix",
|
||||
}.get(pattern.replace(r"\/", "/"))
|
||||
|
||||
Reference in new issue
Block a user