fix(ci): make MCP server default bump target for all non-scoped commits
BREAKING CHANGE: MCP server now bumps for ANY conventional commit except those explicitly scoped to helm or astrolabe. Previous behavior: - MCP bumped only for unscoped or scope=mcp commits - fix(ci): commits were ignored → no version bump New behavior: - MCP bumps for ALL commits except scope=helm or scope=astrolabe - fix(ci): commits now trigger MCP version bump ✓ - feat(api): commits now trigger MCP version bump ✓ - Any custom scope triggers MCP version bump ✓ This treats the MCP server as the default/primary component in the monorepo, with Helm chart and Astrolabe as opt-in specialized components. Changes: 1. Updated bump-version.yml workflow logic to exclude helm/astrolabe instead of only including mcp/unscoped 2. Updated pyproject.toml commitizen patterns to use negative lookahead: (?!\((?:helm|astrolabe)\)) 3. Fixed docker-build-publish.yml to only trigger on v* tags (MCP only) 4. Fixed appstore-build-publish.yml action version (v1.0.4) 5. Updated test script to use grep -P for PCRE support 6. Added test cases for ci, api, and custom scopes All 19 scope filtering tests now pass.
This commit is contained in:
@@ -71,12 +71,29 @@ jobs:
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Bump MCP server (scope: mcp or unscoped)
|
# Bump MCP server (default - all commits except helm/astrolabe scopes)
|
||||||
echo "Checking MCP server for version bump..."
|
echo "Checking MCP server for version bump..."
|
||||||
if has_commits_since_tag "v[0-9]" "(feat|fix|docs|refactor|perf|test|build|ci|chore)(\(mcp\))?(!)?:"; then
|
|
||||||
|
# Get the most recent MCP tag
|
||||||
|
last_mcp_tag=$(git tag --sort=-creatordate | grep -E "^v[0-9]" | head -n 1 || echo "")
|
||||||
|
|
||||||
|
if [ -z "$last_mcp_tag" ]; then
|
||||||
|
commit_range="master"
|
||||||
|
else
|
||||||
|
commit_range="${last_mcp_tag}..HEAD"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Count conventional commits that are NOT scoped to helm or astrolabe
|
||||||
|
mcp_commit_count=$(git log "$commit_range" --oneline --grep="^(feat|fix|docs|refactor|perf|test|build|ci|chore)" -E | \
|
||||||
|
grep -v "(helm)" | grep -v "(astrolabe)" | wc -l)
|
||||||
|
|
||||||
|
if [ "$mcp_commit_count" -gt 0 ]; then
|
||||||
|
echo "Found $mcp_commit_count commits for MCP server since $last_mcp_tag"
|
||||||
echo "Bumping MCP server version..."
|
echo "Bumping MCP server version..."
|
||||||
./scripts/bump-mcp.sh
|
./scripts/bump-mcp.sh
|
||||||
BUMPED_COMPONENTS="$BUMPED_COMPONENTS mcp"
|
BUMPED_COMPONENTS="$BUMPED_COMPONENTS mcp"
|
||||||
|
else
|
||||||
|
echo "No commits found for MCP server since $last_mcp_tag"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Bump Helm chart (scope: helm)
|
# Bump Helm chart (scope: helm)
|
||||||
|
|||||||
+3
-3
@@ -101,10 +101,10 @@ ignored_tag_formats = [
|
|||||||
"astrolabe-v*", # Astrolabe tags
|
"astrolabe-v*", # Astrolabe tags
|
||||||
]
|
]
|
||||||
|
|
||||||
# Filter commits by scope (mcp or unscoped)
|
# Filter commits by scope (all scopes except helm and astrolabe)
|
||||||
[tool.commitizen.customize]
|
[tool.commitizen.customize]
|
||||||
changelog_pattern = "^(feat|fix|docs|refactor|perf|test|build|ci|chore)(\\(mcp\\))?(!)?:"
|
changelog_pattern = "^(feat|fix|docs|refactor|perf|test|build|ci|chore)(?!\\((?:helm|astrolabe)\\))(\\([^)]+\\))?(!)?:"
|
||||||
schema_pattern = "^(feat|fix|docs|refactor|perf|test|build|ci|chore)(\\(mcp\\))?(!)?:\\s.+"
|
schema_pattern = "^(feat|fix|docs|refactor|perf|test|build|ci|chore)(?!\\((?:helm|astrolabe)\\))(\\([^)]+\\))?(!)?:\\s.+"
|
||||||
|
|
||||||
[tool.ruff.lint]
|
[tool.ruff.lint]
|
||||||
extend-select = ["I"]
|
extend-select = ["I"]
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ echo "Testing commitizen scope filtering patterns..."
|
|||||||
echo
|
echo
|
||||||
|
|
||||||
# Regex patterns from configs
|
# Regex patterns from configs
|
||||||
MCP_PATTERN='^(feat|fix|docs|refactor|perf|test|build|ci|chore)(\(mcp\))?(!)?:'
|
MCP_PATTERN='^(feat|fix|docs|refactor|perf|test|build|ci|chore)(?!\((?:helm|astrolabe)\))(\([^)]+\))?(!)?:'
|
||||||
HELM_PATTERN='^(feat|fix|docs|refactor|perf|test|build|ci|chore)\(helm\)(!)?:'
|
HELM_PATTERN='^(feat|fix|docs|refactor|perf|test|build|ci|chore)\(helm\)(!)?:'
|
||||||
ASTROLABE_PATTERN='^(feat|fix|docs|refactor|perf|test|build|ci|chore)\(astrolabe\)(!)?:'
|
ASTROLABE_PATTERN='^(feat|fix|docs|refactor|perf|test|build|ci|chore)\(astrolabe\)(!)?:'
|
||||||
|
|
||||||
@@ -14,7 +14,8 @@ test_pattern() {
|
|||||||
local message="$1"
|
local message="$1"
|
||||||
local pattern="$2"
|
local pattern="$2"
|
||||||
|
|
||||||
if echo "$message" | grep -qE "$pattern"; then
|
# Use grep -P for Perl-compatible regex (supports negative lookahead)
|
||||||
|
if echo "$message" | grep -qP "$pattern"; then
|
||||||
return 0
|
return 0
|
||||||
else
|
else
|
||||||
return 1
|
return 1
|
||||||
@@ -61,11 +62,14 @@ run_test() {
|
|||||||
failed=0
|
failed=0
|
||||||
passed=0
|
passed=0
|
||||||
|
|
||||||
# MCP server commits (scope=mcp or unscoped)
|
# MCP server commits (any scope except helm/astrolabe)
|
||||||
run_test "feat: add new feature" "mcp" && passed=$((passed+1)) || failed=$((failed+1))
|
run_test "feat: add new feature" "mcp" && passed=$((passed+1)) || failed=$((failed+1))
|
||||||
run_test "feat(mcp): add API endpoint" "mcp" && passed=$((passed+1)) || failed=$((failed+1))
|
run_test "feat(mcp): add API endpoint" "mcp" && passed=$((passed+1)) || failed=$((failed+1))
|
||||||
run_test "fix(mcp): resolve authentication bug" "mcp" && passed=$((passed+1)) || failed=$((failed+1))
|
run_test "fix(mcp): resolve authentication bug" "mcp" && passed=$((passed+1)) || failed=$((failed+1))
|
||||||
run_test "docs: update README" "mcp" && passed=$((passed+1)) || failed=$((failed+1))
|
run_test "docs: update README" "mcp" && passed=$((passed+1)) || failed=$((failed+1))
|
||||||
|
run_test "fix(ci): update workflow" "mcp" && passed=$((passed+1)) || failed=$((failed+1))
|
||||||
|
run_test "feat(api): add endpoint" "mcp" && passed=$((passed+1)) || failed=$((failed+1))
|
||||||
|
run_test "ci: configure GitHub Actions" "mcp" && passed=$((passed+1)) || failed=$((failed+1))
|
||||||
|
|
||||||
# Helm chart commits
|
# Helm chart commits
|
||||||
run_test "feat(helm): add resource limits" "helm" && passed=$((passed+1)) || failed=$((failed+1))
|
run_test "feat(helm): add resource limits" "helm" && passed=$((passed+1)) || failed=$((failed+1))
|
||||||
@@ -82,10 +86,10 @@ run_test "feat(mcp)!: breaking API change" "mcp" && passed=$((passed+1)) || fail
|
|||||||
run_test "feat(helm)!: rename values" "helm" && passed=$((passed+1)) || failed=$((failed+1))
|
run_test "feat(helm)!: rename values" "helm" && passed=$((passed+1)) || failed=$((failed+1))
|
||||||
run_test "feat(astrolabe)!: remove deprecated feature" "astrolabe" && passed=$((passed+1)) || failed=$((failed+1))
|
run_test "feat(astrolabe)!: remove deprecated feature" "astrolabe" && passed=$((passed+1)) || failed=$((failed+1))
|
||||||
|
|
||||||
# Invalid commits (should not match any)
|
# Edge cases
|
||||||
run_test "feat(invalid): test" "none" && passed=$((passed+1)) || failed=$((failed+1))
|
run_test "feat(invalid): test" "mcp" && passed=$((passed+1)) || failed=$((failed+1)) # Any scope except helm/astrolabe → MCP
|
||||||
run_test "random commit message" "none" && passed=$((passed+1)) || failed=$((failed+1))
|
run_test "random commit message" "none" && passed=$((passed+1)) || failed=$((failed+1)) # Not conventional commit
|
||||||
run_test "feat (mcp): space before scope" "none" && passed=$((passed+1)) || failed=$((failed+1))
|
run_test "feat (mcp): space before scope" "none" && passed=$((passed+1)) || failed=$((failed+1)) # Invalid format
|
||||||
|
|
||||||
# Summary
|
# Summary
|
||||||
echo
|
echo
|
||||||
|
|||||||
Reference in New Issue
Block a user