Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b9dc6d197a
|
||
|
|
a53af9ca33 |
No files matched your search
@@ -25,8 +25,7 @@ jobs:
|
||||
- run:
|
||||
name: Install reconciliation tools
|
||||
command: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y --no-install-recommends gh
|
||||
bash tools/install_reconcile_gh.sh
|
||||
python3 -m pip install --disable-pip-version-check PyYAML==6.0.3
|
||||
- run:
|
||||
name: Reconcile current QQQ branches
|
||||
|
||||
@@ -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")]
|
||||
|
||||
@@ -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")
|
||||
|
||||
@@ -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
|
||||
@@ -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