fix(ci): improve versioning and error handling

Addresses remaining high-priority code review feedback:

VERSIONING SCHEME FIXES:
- Helm chart: Changed from pep440 to semver (correct for Helm)
- Astrolabe: Changed from pep440 to semver (correct for Nextcloud apps)
- MCP server: Remains pep440 (correct for Python packages)

Helm charts must use semantic versioning per Helm specification.
Nextcloud apps use semantic versioning in info.xml and package.json.

ENHANCED ERROR HANDLING IN BUMP SCRIPTS:
All three bump scripts now include:
- Comprehensive validation checks
  * Tool availability (uv)
  * Directory structure (must run from repo root)
  * Required files exist (Chart.yaml, info.xml, package.json)
- Better error messages
  * Stderr output for errors
  * Captured commitizen output on failure
  * Common failure causes listed
- Success confirmation
  * Clear indication of what was updated
  * Next steps guidance (git push --follow-tags)
- Robust shell options (set -euo pipefail)

Scripts now provide helpful guidance when:
- No conventional commits found
- No commits with required scope
- Git working directory not clean
- Required dependencies missing
This commit is contained in:
Chris Coutinho
2025-12-19 19:38:24 +01:00
parent 2f3a3e0be4
commit e2e0ffce44
5 changed files with 122 additions and 23 deletions
+46 -7
View File
@@ -1,17 +1,56 @@
#!/bin/bash
# Bump Astrolabe app version
set -e
set -euo pipefail
# Validate dependencies
command -v uv >/dev/null 2>&1 || { echo "Error: uv not found. Install from https://docs.astral.sh/uv/"; exit 1; }
command -v uv >/dev/null 2>&1 || {
echo "❌ Error: uv not found" >&2
echo " Install from https://docs.astral.sh/uv/" >&2
exit 1
}
# Validate Astrolabe directory exists
if [ ! -d "third_party/astrolabe" ]; then
echo "❌ Error: Must run from repository root (third_party/astrolabe not found)" >&2
exit 1
fi
cd third_party/astrolabe
echo "Bumping Astrolabe version..."
uv run cz --config .cz.toml bump --yes
# Validate required files exist
if [ ! -f "appinfo/info.xml" ]; then
echo "❌ Error: appinfo/info.xml not found" >&2
exit 1
fi
echo "✓ Astrolabe version bumped"
echo " - Updated: appinfo/info.xml, package.json"
echo " - Tag format: astrolabe-v\${version}"
if [ ! -f "package.json" ]; then
echo "❌ Error: package.json not found" >&2
exit 1
fi
echo "Bumping Astrolabe version..."
# Run commitizen bump and capture output
if ! output=$(uv run cz --config .cz.toml bump --yes 2>&1); then
cd ../..
echo "❌ Error: Version bump failed" >&2
echo "$output" >&2
echo "" >&2
echo "Common causes:" >&2
echo " - No commits with scope 'astrolabe' since last version" >&2
echo " - No conventional commits found (use feat(astrolabe):, fix(astrolabe):, etc.)" >&2
echo " - Git working directory not clean" >&2
exit 1
fi
echo "$output"
echo ""
echo "✓ Astrolabe version bumped successfully"
echo " Updated: appinfo/info.xml, package.json"
echo " Tag format: astrolabe-v\${version}"
echo ""
echo "Next steps:"
echo " cd ../.."
echo " git push --follow-tags"
cd ../..
+42 -8
View File
@@ -1,18 +1,52 @@
#!/bin/bash
# Bump Helm chart version
set -e
set -euo pipefail
# Validate dependencies
command -v uv >/dev/null 2>&1 || { echo "Error: uv not found. Install from https://docs.astral.sh/uv/"; exit 1; }
command -v uv >/dev/null 2>&1 || {
echo "❌ Error: uv not found" >&2
echo " Install from https://docs.astral.sh/uv/" >&2
exit 1
}
# Validate Helm chart directory exists
if [ ! -d "charts/nextcloud-mcp-server" ]; then
echo "❌ Error: Must run from repository root (charts/ not found)" >&2
exit 1
fi
cd charts/nextcloud-mcp-server
echo "Bumping Helm chart version..."
uv run cz --config .cz.toml bump --yes
# Validate Chart.yaml exists
if [ ! -f "Chart.yaml" ]; then
echo "❌ Error: Chart.yaml not found" >&2
exit 1
fi
echo " Helm chart version bumped"
echo " - Updated: Chart.yaml:version"
echo " - Tag format: nextcloud-mcp-server-\${version}"
echo " - Note: appVersion stays at MCP server version"
echo "Bumping Helm chart version..."
# Run commitizen bump and capture output
if ! output=$(uv run cz --config .cz.toml bump --yes 2>&1); then
cd ../..
echo "❌ Error: Version bump failed" >&2
echo "$output" >&2
echo "" >&2
echo "Common causes:" >&2
echo " - No commits with scope 'helm' since last version" >&2
echo " - No conventional commits found (use feat(helm):, fix(helm):, etc.)" >&2
echo " - Git working directory not clean" >&2
exit 1
fi
echo "$output"
echo ""
echo "✓ Helm chart version bumped successfully"
echo " Updated: Chart.yaml:version"
echo " Tag format: nextcloud-mcp-server-\${version}"
echo " Note: appVersion stays at MCP server version"
echo ""
echo "Next steps:"
echo " cd ../.."
echo " git push --follow-tags"
cd ../..
+32 -6
View File
@@ -1,13 +1,39 @@
#!/bin/bash
# Bump MCP server version
set -e
set -euo pipefail
# Validate dependencies
command -v uv >/dev/null 2>&1 || { echo "Error: uv not found. Install from https://docs.astral.sh/uv/"; exit 1; }
command -v uv >/dev/null 2>&1 || {
echo "❌ Error: uv not found" >&2
echo " Install from https://docs.astral.sh/uv/" >&2
exit 1
}
# Validate we're in the repository root
if [ ! -f "pyproject.toml" ]; then
echo "❌ Error: Must run from repository root (pyproject.toml not found)" >&2
exit 1
fi
echo "Bumping MCP server version..."
uv run cz bump --yes
echo "✓ MCP server version bumped"
echo " - Updated: pyproject.toml, Chart.yaml:appVersion"
echo " - Tag format: v\${version}"
# Run commitizen bump and capture output
if ! output=$(uv run cz bump --yes 2>&1); then
echo "❌ Error: Version bump failed" >&2
echo "$output" >&2
echo "" >&2
echo "Common causes:" >&2
echo " - No commits since last version" >&2
echo " - No conventional commits found (use feat:, fix:, etc.)" >&2
echo " - Git working directory not clean" >&2
exit 1
fi
echo "$output"
echo ""
echo "✓ MCP server version bumped successfully"
echo " Updated: pyproject.toml, Chart.yaml:appVersion"
echo " Tag format: v\${version}"
echo ""
echo "Next steps:"
echo " git push --follow-tags"