Delete all shell script files, keeping only Python versions
Co-authored-by: jmiller-moko <230051081+jmiller-moko@users.noreply.github.com>
This commit is contained in:
@@ -1,191 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# ============================================================================
|
||||
# Copyright (C) 2025 Moko Consulting <hello@mokoconsulting.tech>
|
||||
#
|
||||
# This file is part of a Moko Consulting project.
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program (./LICENSE.md).
|
||||
# ============================================================================
|
||||
|
||||
# ============================================================================
|
||||
# FILE INFORMATION
|
||||
# ============================================================================
|
||||
# DEFGROUP: Script.Run
|
||||
# INGROUP: Version.Management
|
||||
# REPO: https://github.com/mokoconsulting-tech/moko-cassiopeia
|
||||
# PATH: /scripts/run/check_version.sh
|
||||
# VERSION: 01.00.00
|
||||
# BRIEF: Check if a version can be created in a specific branch prefix
|
||||
# NOTE: Validates against version hierarchy rules before creation
|
||||
# ============================================================================
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "$0")/.." && pwd)"
|
||||
. "${SCRIPT_DIR}/lib/common.sh"
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# Usage and validation
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
usage() {
|
||||
cat <<-USAGE
|
||||
Usage: $0 <BRANCH_PREFIX> <VERSION>
|
||||
|
||||
Check if a version can be created in the specified branch prefix.
|
||||
|
||||
Arguments:
|
||||
BRANCH_PREFIX One of: dev/, rc/, version/
|
||||
VERSION Version in format NN.NN.NN (e.g., 03.01.00)
|
||||
|
||||
Examples:
|
||||
$0 dev/ 03.05.00
|
||||
$0 rc/ 03.01.00
|
||||
$0 version/ 02.00.00
|
||||
|
||||
Exit codes:
|
||||
0 - Version can be created (no conflicts)
|
||||
1 - Version cannot be created (conflicts found)
|
||||
2 - Invalid arguments or usage
|
||||
|
||||
Version Hierarchy Rules:
|
||||
- version/X.Y.Z (stable) - always allowed, highest priority
|
||||
- rc/X.Y.Z (RC) - blocked if version/X.Y.Z exists
|
||||
- dev/X.Y.Z (dev) - blocked if version/X.Y.Z or rc/X.Y.Z exists
|
||||
|
||||
USAGE
|
||||
exit 2
|
||||
}
|
||||
|
||||
validate_prefix() {
|
||||
local prefix="$1"
|
||||
case "$prefix" in
|
||||
"dev/"|"rc/"|"version/")
|
||||
return 0
|
||||
;;
|
||||
*)
|
||||
die "Invalid branch prefix: $prefix (must be dev/, rc/, or version/)"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
validate_version() {
|
||||
local v="$1"
|
||||
if [[ ! "$v" =~ ^[0-9]{2}\.[0-9]{2}\.[0-9]{2}$ ]]; then
|
||||
die "Invalid version format: $v (expected NN.NN.NN)"
|
||||
fi
|
||||
}
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# Main logic
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
check_version_can_be_created() {
|
||||
local prefix="$1"
|
||||
local version="$2"
|
||||
|
||||
log_info "Checking if ${prefix}${version} can be created..."
|
||||
log_info ""
|
||||
|
||||
# Check if the exact branch already exists
|
||||
if git ls-remote --exit-code --heads origin "${prefix}${version}" >/dev/null 2>&1; then
|
||||
log_error "✗ Branch already exists: ${prefix}${version}"
|
||||
return 1
|
||||
fi
|
||||
|
||||
local conflicts=0
|
||||
|
||||
case "$prefix" in
|
||||
"version/")
|
||||
log_info "Creating stable version - no hierarchy checks needed"
|
||||
log_info "✓ version/${version} can be created"
|
||||
;;
|
||||
"rc/")
|
||||
log_info "Checking if version exists in stable..."
|
||||
if git ls-remote --exit-code --heads origin "version/${version}" >/dev/null 2>&1; then
|
||||
log_error "✗ CONFLICT: Version ${version} already exists in stable (version/${version})"
|
||||
log_error " Cannot create RC for a version that exists in stable"
|
||||
conflicts=$((conflicts + 1))
|
||||
else
|
||||
log_info "✓ No conflict with stable versions"
|
||||
log_info "✓ rc/${version} can be created"
|
||||
fi
|
||||
;;
|
||||
"dev/")
|
||||
log_info "Checking if version exists in stable..."
|
||||
if git ls-remote --exit-code --heads origin "version/${version}" >/dev/null 2>&1; then
|
||||
log_error "✗ CONFLICT: Version ${version} already exists in stable (version/${version})"
|
||||
log_error " Cannot create dev for a version that exists in stable"
|
||||
conflicts=$((conflicts + 1))
|
||||
else
|
||||
log_info "✓ No conflict with stable versions"
|
||||
fi
|
||||
|
||||
log_info "Checking if version exists in RC..."
|
||||
if git ls-remote --exit-code --heads origin "rc/${version}" >/dev/null 2>&1; then
|
||||
log_error "✗ CONFLICT: Version ${version} already exists in RC (rc/${version})"
|
||||
log_error " Cannot create dev for a version that exists in RC"
|
||||
conflicts=$((conflicts + 1))
|
||||
else
|
||||
log_info "✓ No conflict with RC versions"
|
||||
fi
|
||||
|
||||
if [ $conflicts -eq 0 ]; then
|
||||
log_info "✓ dev/${version} can be created"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
log_info ""
|
||||
|
||||
if [ $conflicts -gt 0 ]; then
|
||||
log_error "Version ${prefix}${version} cannot be created ($conflicts conflict(s) found)"
|
||||
return 1
|
||||
fi
|
||||
|
||||
log_info "Version ${prefix}${version} can be created safely"
|
||||
return 0
|
||||
}
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# Main
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
# Parse arguments
|
||||
if [ "${1:-}" = "-h" ] || [ "${1:-}" = "--help" ]; then
|
||||
usage
|
||||
fi
|
||||
|
||||
[ $# -eq 2 ] || usage
|
||||
|
||||
BRANCH_PREFIX="$1"
|
||||
VERSION="$2"
|
||||
|
||||
validate_prefix "$BRANCH_PREFIX"
|
||||
validate_version "$VERSION"
|
||||
|
||||
log_info "Version Creation Check"
|
||||
log_info "======================"
|
||||
log_info ""
|
||||
|
||||
check_version_can_be_created "$BRANCH_PREFIX" "$VERSION"
|
||||
exit_code=$?
|
||||
|
||||
log_info ""
|
||||
log_info "======================"
|
||||
|
||||
exit $exit_code
|
||||
@@ -1,127 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# ============================================================================
|
||||
# Copyright (C) 2025 Moko Consulting <hello@mokoconsulting.tech>
|
||||
#
|
||||
# This file is part of a Moko Consulting project.
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program (./LICENSE.md).
|
||||
# ============================================================================
|
||||
|
||||
# ============================================================================
|
||||
# FILE INFORMATION
|
||||
# ============================================================================
|
||||
# DEFGROUP: Script.Run
|
||||
# INGROUP: Version.Management
|
||||
# REPO: https://github.com/mokoconsulting-tech/moko-cassiopeia
|
||||
# PATH: /scripts/run/list_versions.sh
|
||||
# VERSION: 01.00.00
|
||||
# BRIEF: List all version branches organized by prefix
|
||||
# NOTE: Displays dev/, rc/, and version/ branches in a structured format
|
||||
# ============================================================================
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "$0")/.." && pwd)"
|
||||
. "${SCRIPT_DIR}/lib/common.sh"
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# Functions
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
list_version_branches() {
|
||||
log_info "Fetching version branches from remote..."
|
||||
|
||||
# Get all branches with version-like names
|
||||
local branches
|
||||
branches=$(git ls-remote --heads origin 2>/dev/null | awk '{print $2}' | sed 's|refs/heads/||' || echo "")
|
||||
|
||||
if [ -z "$branches" ]; then
|
||||
log_warn "No remote branches found or unable to fetch branches"
|
||||
return 0
|
||||
fi
|
||||
|
||||
# Categorize versions
|
||||
local dev_versions=()
|
||||
local rc_versions=()
|
||||
local stable_versions=()
|
||||
|
||||
while IFS= read -r branch; do
|
||||
if [[ "$branch" =~ ^dev/([0-9]{2}\.[0-9]{2}\.[0-9]{2})$ ]]; then
|
||||
dev_versions+=("${BASH_REMATCH[1]}")
|
||||
elif [[ "$branch" =~ ^rc/([0-9]{2}\.[0-9]{2}\.[0-9]{2})$ ]]; then
|
||||
rc_versions+=("${BASH_REMATCH[1]}")
|
||||
elif [[ "$branch" =~ ^version/([0-9]{2}\.[0-9]{2}\.[0-9]{2})$ ]]; then
|
||||
stable_versions+=("${BASH_REMATCH[1]}")
|
||||
fi
|
||||
done <<< "$branches"
|
||||
|
||||
# Sort versions
|
||||
IFS=$'\n' dev_versions=($(sort -V <<< "${dev_versions[*]}" 2>/dev/null || echo "${dev_versions[@]}"))
|
||||
IFS=$'\n' rc_versions=($(sort -V <<< "${rc_versions[*]}" 2>/dev/null || echo "${rc_versions[@]}"))
|
||||
IFS=$'\n' stable_versions=($(sort -V <<< "${stable_versions[*]}" 2>/dev/null || echo "${stable_versions[@]}"))
|
||||
unset IFS
|
||||
|
||||
# Display results
|
||||
echo ""
|
||||
echo "========================================"
|
||||
echo "Version Branches Summary"
|
||||
echo "========================================"
|
||||
echo ""
|
||||
|
||||
echo "📦 Stable Versions (version/)"
|
||||
echo "----------------------------------------"
|
||||
if [ ${#stable_versions[@]} -eq 0 ]; then
|
||||
echo " (none)"
|
||||
else
|
||||
for version in "${stable_versions[@]}"; do
|
||||
echo " ✓ version/$version"
|
||||
done
|
||||
fi
|
||||
echo ""
|
||||
|
||||
echo "🔧 Release Candidates (rc/)"
|
||||
echo "----------------------------------------"
|
||||
if [ ${#rc_versions[@]} -eq 0 ]; then
|
||||
echo " (none)"
|
||||
else
|
||||
for version in "${rc_versions[@]}"; do
|
||||
echo " ➜ rc/$version"
|
||||
done
|
||||
fi
|
||||
echo ""
|
||||
|
||||
echo "🚧 Development Versions (dev/)"
|
||||
echo "----------------------------------------"
|
||||
if [ ${#dev_versions[@]} -eq 0 ]; then
|
||||
echo " (none)"
|
||||
else
|
||||
for version in "${dev_versions[@]}"; do
|
||||
echo " ⚡ dev/$version"
|
||||
done
|
||||
fi
|
||||
echo ""
|
||||
|
||||
echo "========================================"
|
||||
echo "Total: ${#stable_versions[@]} stable, ${#rc_versions[@]} RC, ${#dev_versions[@]} dev"
|
||||
echo "========================================"
|
||||
}
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# Main
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
list_version_branches
|
||||
@@ -1,292 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# ============================================================================
|
||||
# Copyright (C) 2025 Moko Consulting <hello@mokoconsulting.tech>
|
||||
#
|
||||
# This file is part of a Moko Consulting project.
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program (./LICENSE.md).
|
||||
# ============================================================================
|
||||
|
||||
# ============================================================================
|
||||
# FILE INFORMATION
|
||||
# ============================================================================
|
||||
# DEFGROUP: Script.Run
|
||||
# INGROUP: Repository.Release
|
||||
# REPO: https://github.com/mokoconsulting-tech/moko-cassiopeia
|
||||
# PATH: /scripts/run/migrate_unreleased.sh
|
||||
# VERSION: 01.00.00
|
||||
# BRIEF: Migrate unreleased changelog entries to a versioned section
|
||||
# NOTE: Moves content from [Unreleased] section to a specified version heading
|
||||
# ============================================================================
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# Usage
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
usage() {
|
||||
cat <<-USAGE
|
||||
Usage: $0 <VERSION> [OPTIONS]
|
||||
|
||||
Migrate unreleased changelog entries to a versioned section.
|
||||
|
||||
Arguments:
|
||||
VERSION Version number in format NN.NN.NN (e.g., 03.05.00)
|
||||
|
||||
Options:
|
||||
-h, --help Show this help message
|
||||
-d, --date Date to use for version entry (default: today, format: YYYY-MM-DD)
|
||||
-n, --dry-run Show what would be done without making changes
|
||||
-k, --keep Keep the [Unreleased] section after migration (default: empty it)
|
||||
|
||||
Examples:
|
||||
$0 03.05.00 # Migrate unreleased to version 03.05.00
|
||||
$0 03.05.00 --date 2026-01-04 # Use specific date
|
||||
$0 03.05.00 --dry-run # Preview changes without applying
|
||||
$0 03.05.00 --keep # Keep unreleased section after migration
|
||||
|
||||
USAGE
|
||||
exit 0
|
||||
}
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# Argument parsing
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
VERSION=""
|
||||
DATE=""
|
||||
DRY_RUN=false
|
||||
KEEP_UNRELEASED=false
|
||||
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case "$1" in
|
||||
-h|--help)
|
||||
usage
|
||||
;;
|
||||
-d|--date)
|
||||
DATE="$2"
|
||||
shift 2
|
||||
;;
|
||||
-n|--dry-run)
|
||||
DRY_RUN=true
|
||||
shift
|
||||
;;
|
||||
-k|--keep)
|
||||
KEEP_UNRELEASED=true
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
if [[ -z "$VERSION" ]]; then
|
||||
VERSION="$1"
|
||||
shift
|
||||
else
|
||||
echo "ERROR: Unknown argument: $1" >&2
|
||||
usage
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# Validation
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
if [[ -z "$VERSION" ]]; then
|
||||
echo "ERROR: VERSION is required" >&2
|
||||
usage
|
||||
fi
|
||||
|
||||
if ! [[ "$VERSION" =~ ^[0-9]{2}\.[0-9]{2}\.[0-9]{2}$ ]]; then
|
||||
echo "ERROR: Invalid version format: $VERSION" >&2
|
||||
echo "Expected format: NN.NN.NN (e.g., 03.05.00)" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ -z "$DATE" ]]; then
|
||||
DATE=$(date '+%Y-%m-%d')
|
||||
fi
|
||||
|
||||
if ! [[ "$DATE" =~ ^[0-9]{4}-[0-9]{2}-[0-9]{2}$ ]]; then
|
||||
echo "ERROR: Invalid date format: $DATE" >&2
|
||||
echo "Expected format: YYYY-MM-DD" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# Source common utilities
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "$0")/.." && pwd)"
|
||||
. "${SCRIPT_DIR}/lib/common.sh"
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# Main logic
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
CHANGELOG_FILE="CHANGELOG.md"
|
||||
|
||||
if [[ ! -f "$CHANGELOG_FILE" ]]; then
|
||||
log_error "CHANGELOG.md not found in repository root"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
log_info "Migrating unreleased changelog entries to version $VERSION"
|
||||
log_info "Date: $DATE"
|
||||
log_info "Dry run: $DRY_RUN"
|
||||
log_info "Keep unreleased section: $KEEP_UNRELEASED"
|
||||
|
||||
# Use Python to process the changelog
|
||||
python3 - <<PY
|
||||
import os
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
version = "${VERSION}"
|
||||
stamp = "${DATE}"
|
||||
dry_run = "${DRY_RUN}" == "true"
|
||||
keep_unreleased = "${KEEP_UNRELEASED}" == "true"
|
||||
|
||||
changelog_path = Path("${CHANGELOG_FILE}")
|
||||
lines = changelog_path.read_text(encoding="utf-8", errors="replace").splitlines(True)
|
||||
|
||||
def is_h2(line: str) -> bool:
|
||||
return line.lstrip().startswith("## ")
|
||||
|
||||
def norm(line: str) -> str:
|
||||
return line.strip().lower()
|
||||
|
||||
def find_idx(predicate):
|
||||
for i, ln in enumerate(lines):
|
||||
if predicate(ln):
|
||||
return i
|
||||
return None
|
||||
|
||||
unreleased_idx = find_idx(lambda ln: norm(ln) == "## [unreleased]")
|
||||
version_idx = find_idx(lambda ln: ln.lstrip().startswith(f"## [{version}]"))
|
||||
|
||||
def version_header() -> list:
|
||||
return ["\n", f"## [{version}] {stamp}\n", "\n"]
|
||||
|
||||
if unreleased_idx is None:
|
||||
print(f"INFO: No [Unreleased] section found in {changelog_path}")
|
||||
if version_idx is None:
|
||||
print(f"INFO: Version section [{version}] does not exist")
|
||||
print(f"INFO: Creating new version section with placeholder content")
|
||||
if not dry_run:
|
||||
# Find insertion point after main heading
|
||||
insert_at = 0
|
||||
for i, ln in enumerate(lines):
|
||||
if ln.lstrip().startswith("# "):
|
||||
insert_at = i + 1
|
||||
while insert_at < len(lines) and lines[insert_at].strip() == "":
|
||||
insert_at += 1
|
||||
break
|
||||
entry = version_header() + ["- No changes recorded.\n", "\n"]
|
||||
lines[insert_at:insert_at] = entry
|
||||
changelog_path.write_text("".join(lines), encoding="utf-8")
|
||||
print(f"SUCCESS: Created version section [{version}]")
|
||||
else:
|
||||
print(f"DRY-RUN: Would create version section [{version}]")
|
||||
else:
|
||||
print(f"INFO: Version section [{version}] already exists")
|
||||
sys.exit(0)
|
||||
|
||||
# Extract unreleased content
|
||||
u_start = unreleased_idx + 1
|
||||
u_end = len(lines)
|
||||
for j in range(u_start, len(lines)):
|
||||
if is_h2(lines[j]):
|
||||
u_end = j
|
||||
break
|
||||
|
||||
unreleased_body = "".join(lines[u_start:u_end]).strip()
|
||||
|
||||
if not unreleased_body:
|
||||
print(f"INFO: [Unreleased] section is empty, nothing to migrate")
|
||||
sys.exit(0)
|
||||
|
||||
print(f"INFO: Found unreleased content ({len(unreleased_body)} chars)")
|
||||
|
||||
# Create or find version section
|
||||
if version_idx is None:
|
||||
print(f"INFO: Creating version section [{version}]")
|
||||
if not dry_run:
|
||||
lines[u_end:u_end] = version_header()
|
||||
else:
|
||||
print(f"DRY-RUN: Would create version section [{version}]")
|
||||
|
||||
version_idx = find_idx(lambda ln: ln.lstrip().startswith(f"## [{version}]"))
|
||||
if version_idx is None and not dry_run:
|
||||
print("ERROR: Failed to locate version header after insertion", file=sys.stderr)
|
||||
sys.exit(1)
|
||||
|
||||
# Move unreleased content to version section
|
||||
if unreleased_body:
|
||||
if not dry_run:
|
||||
insert_at = version_idx + 1
|
||||
while insert_at < len(lines) and lines[insert_at].strip() == "":
|
||||
insert_at += 1
|
||||
|
||||
moved = ["\n"] + [ln + "\n" for ln in unreleased_body.split("\n") if ln != ""] + ["\n"]
|
||||
lines[insert_at:insert_at] = moved
|
||||
print(f"INFO: Moved {len([ln for ln in unreleased_body.split('\n') if ln])} lines to [{version}]")
|
||||
else:
|
||||
line_count = len([ln for ln in unreleased_body.split('\n') if ln])
|
||||
print(f"DRY-RUN: Would move {line_count} lines to [{version}]")
|
||||
print(f"DRY-RUN: Content preview:")
|
||||
for line in unreleased_body.split('\n')[:5]:
|
||||
if line:
|
||||
print(f" {line}")
|
||||
|
||||
# Handle unreleased section
|
||||
if not keep_unreleased:
|
||||
unreleased_idx = find_idx(lambda ln: norm(ln) == "## [unreleased]")
|
||||
if unreleased_idx is not None:
|
||||
if not dry_run:
|
||||
u_start = unreleased_idx + 1
|
||||
u_end = len(lines)
|
||||
for j in range(u_start, len(lines)):
|
||||
if is_h2(lines[j]):
|
||||
u_end = j
|
||||
break
|
||||
lines[u_start:u_end] = ["\n"]
|
||||
print(f"INFO: Emptied [Unreleased] section")
|
||||
else:
|
||||
print(f"DRY-RUN: Would empty [Unreleased] section")
|
||||
else:
|
||||
print(f"INFO: Keeping [Unreleased] section as requested")
|
||||
|
||||
if not dry_run:
|
||||
changelog_path.write_text("".join(lines), encoding="utf-8")
|
||||
print(f"SUCCESS: Migrated unreleased content to [{version}]")
|
||||
else:
|
||||
print(f"DRY-RUN: Changes not applied (use without --dry-run to apply)")
|
||||
|
||||
PY
|
||||
|
||||
if [[ $? -eq 0 ]]; then
|
||||
if [[ "$DRY_RUN" == "false" ]]; then
|
||||
log_info "✓ Migration completed successfully"
|
||||
log_info "✓ Changelog updated: $CHANGELOG_FILE"
|
||||
else
|
||||
log_info "✓ Dry run completed"
|
||||
fi
|
||||
else
|
||||
log_error "Migration failed"
|
||||
exit 1
|
||||
fi
|
||||
@@ -1,198 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# ============================================================================
|
||||
# Copyright (C) 2025 Moko Consulting <hello@mokoconsulting.tech>
|
||||
#
|
||||
# This file is part of a Moko Consulting project.
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program (./LICENSE.md).
|
||||
# ============================================================================
|
||||
|
||||
# ============================================================================
|
||||
# FILE INFORMATION
|
||||
# ============================================================================
|
||||
# DEFGROUP: Script.Validate
|
||||
# INGROUP: Script.Health
|
||||
# REPO: https://github.com/mokoconsulting-tech/moko-cassiopeia
|
||||
# PATH: /scripts/run/script_health.sh
|
||||
# VERSION: 01.00.00
|
||||
# BRIEF: Validate scripts follow enterprise standards
|
||||
# NOTE: Checks for copyright headers, error handling, and documentation
|
||||
# ============================================================================
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "$0")/.." && pwd)"
|
||||
. "${SCRIPT_DIR}/lib/common.sh"
|
||||
. "${SCRIPT_DIR}/lib/logging.sh"
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# Usage
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
usage() {
|
||||
cat <<-USAGE
|
||||
Usage: $0 [OPTIONS]
|
||||
|
||||
Validate that all scripts follow enterprise standards.
|
||||
|
||||
Options:
|
||||
-v, --verbose Show detailed output
|
||||
-h, --help Show this help message
|
||||
|
||||
Checks performed:
|
||||
- Copyright headers present
|
||||
- SPDX license identifier present
|
||||
- FILE INFORMATION section present
|
||||
- set -euo pipefail present
|
||||
- Executable permissions set
|
||||
|
||||
Examples:
|
||||
$0 # Run all health checks
|
||||
$0 -v # Verbose output
|
||||
$0 --help # Show usage
|
||||
|
||||
Exit codes:
|
||||
0 - All checks passed
|
||||
1 - One or more checks failed
|
||||
2 - Invalid arguments
|
||||
|
||||
USAGE
|
||||
exit 0
|
||||
}
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# Configuration
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
VERBOSE="${1:-}"
|
||||
|
||||
case "${VERBOSE}" in
|
||||
-h|--help)
|
||||
usage
|
||||
;;
|
||||
-v|--verbose)
|
||||
VERBOSE="true"
|
||||
;;
|
||||
"")
|
||||
VERBOSE="false"
|
||||
;;
|
||||
*)
|
||||
log_error "Invalid argument: ${VERBOSE}"
|
||||
echo ""
|
||||
usage
|
||||
exit 2
|
||||
;;
|
||||
esac
|
||||
|
||||
log_info "Running script health checks"
|
||||
log_info "Start time: $(log_timestamp)"
|
||||
|
||||
START_TIME=$(date +%s)
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# Health checks
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
total_scripts=0
|
||||
missing_copyright=0
|
||||
missing_spdx=0
|
||||
missing_fileinfo=0
|
||||
missing_error_handling=0
|
||||
not_executable=0
|
||||
|
||||
check_script() {
|
||||
local script="$1"
|
||||
local errors=0
|
||||
|
||||
total_scripts=$((total_scripts + 1))
|
||||
|
||||
# Check for copyright
|
||||
if ! grep -q "Copyright (C)" "$script"; then
|
||||
missing_copyright=$((missing_copyright + 1))
|
||||
errors=$((errors + 1))
|
||||
[ "${VERBOSE}" = "true" ] && log_warn "Missing copyright: $script"
|
||||
fi
|
||||
|
||||
# Check for SPDX
|
||||
if ! grep -q "SPDX-License-Identifier" "$script"; then
|
||||
missing_spdx=$((missing_spdx + 1))
|
||||
errors=$((errors + 1))
|
||||
[ "${VERBOSE}" = "true" ] && log_warn "Missing SPDX: $script"
|
||||
fi
|
||||
|
||||
# Check for FILE INFORMATION
|
||||
if ! grep -q "FILE INFORMATION" "$script"; then
|
||||
missing_fileinfo=$((missing_fileinfo + 1))
|
||||
errors=$((errors + 1))
|
||||
[ "${VERBOSE}" = "true" ] && log_warn "Missing FILE INFORMATION: $script"
|
||||
fi
|
||||
|
||||
# Check for error handling (bash scripts only)
|
||||
if [[ "$script" == *.sh ]]; then
|
||||
if ! grep -q "set -e" "$script"; then
|
||||
missing_error_handling=$((missing_error_handling + 1))
|
||||
errors=$((errors + 1))
|
||||
[ "${VERBOSE}" = "true" ] && log_warn "Missing error handling: $script"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Check executable permission
|
||||
if [ ! -x "$script" ]; then
|
||||
not_executable=$((not_executable + 1))
|
||||
errors=$((errors + 1))
|
||||
[ "${VERBOSE}" = "true" ] && log_warn "Not executable: $script"
|
||||
fi
|
||||
|
||||
return $errors
|
||||
}
|
||||
|
||||
# Find all shell scripts
|
||||
log_info "Scanning scripts directory..."
|
||||
|
||||
while IFS= read -r -d '' script; do
|
||||
check_script "$script" || true
|
||||
done < <(find "${SCRIPT_DIR}" -type f -name "*.sh" -print0)
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# Summary
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
END_TIME=$(date +%s)
|
||||
|
||||
log_separator
|
||||
log_info "Script Health Summary"
|
||||
log_separator
|
||||
log_kv "Total scripts checked" "${total_scripts}"
|
||||
log_kv "Missing copyright" "${missing_copyright}"
|
||||
log_kv "Missing SPDX identifier" "${missing_spdx}"
|
||||
log_kv "Missing FILE INFORMATION" "${missing_fileinfo}"
|
||||
log_kv "Missing error handling" "${missing_error_handling}"
|
||||
log_kv "Not executable" "${not_executable}"
|
||||
log_separator
|
||||
log_info "End time: $(log_timestamp)"
|
||||
log_info "Duration: $(log_duration "$START_TIME" "$END_TIME")"
|
||||
|
||||
total_issues=$((missing_copyright + missing_spdx + missing_fileinfo + missing_error_handling + not_executable))
|
||||
|
||||
if [ "$total_issues" -eq 0 ]; then
|
||||
log_success "SUCCESS: All scripts follow enterprise standards"
|
||||
exit 0
|
||||
else
|
||||
log_error "FAILED: Found ${total_issues} standard violation(s)"
|
||||
log_info "Run with -v flag for details on which scripts need updates"
|
||||
exit 1
|
||||
fi
|
||||
@@ -1,194 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# ============================================================================
|
||||
# Copyright (C) 2025 Moko Consulting <hello@mokoconsulting.tech>
|
||||
#
|
||||
# This file is part of a Moko Consulting project.
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program (./LICENSE.md).
|
||||
# ============================================================================
|
||||
|
||||
# ============================================================================
|
||||
# FILE INFORMATION
|
||||
# ============================================================================
|
||||
# DEFGROUP: Script.Test
|
||||
# INGROUP: Repository.Validation
|
||||
# REPO: https://github.com/mokoconsulting-tech/moko-cassiopeia
|
||||
# PATH: /scripts/run/smoke_test.sh
|
||||
# VERSION: 01.00.00
|
||||
# BRIEF: Basic smoke tests to verify repository structure and manifest validity
|
||||
# NOTE: Quick validation checks for essential repository components
|
||||
# ============================================================================
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# Usage
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
usage() {
|
||||
cat <<-USAGE
|
||||
Usage: $0 [OPTIONS]
|
||||
|
||||
Run basic smoke tests to verify repository structure and manifest validity.
|
||||
|
||||
Options:
|
||||
-h, --help Show this help message
|
||||
|
||||
Examples:
|
||||
$0 # Run all smoke tests
|
||||
$0 --help # Show usage information
|
||||
|
||||
USAGE
|
||||
exit 0
|
||||
}
|
||||
|
||||
# Parse arguments
|
||||
if [ "${1:-}" = "-h" ] || [ "${1:-}" = "--help" ]; then
|
||||
usage
|
||||
fi
|
||||
|
||||
# Source common utilities
|
||||
SCRIPT_DIR="$(cd "$(dirname "$0")/.." && pwd)"
|
||||
. "${SCRIPT_DIR}/lib/common.sh"
|
||||
|
||||
# Check dependencies
|
||||
check_dependencies python3
|
||||
|
||||
START_TIME=$(date +%s)
|
||||
|
||||
log_info "Running smoke tests for Moko-Cassiopeia repository"
|
||||
log_info "Start time: $(log_timestamp)"
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# Test: Repository structure
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
log_info "Checking repository structure..."
|
||||
|
||||
assert_dir_exists "src"
|
||||
assert_file_exists "README.md"
|
||||
assert_file_exists "CHANGELOG.md"
|
||||
assert_file_exists "LICENSE"
|
||||
assert_file_exists "CONTRIBUTING.md"
|
||||
|
||||
log_info "✓ Repository structure valid"
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# Test: Manifest validation
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
log_info "Checking Joomla manifest..."
|
||||
|
||||
. "${SCRIPT_DIR}/lib/joomla_manifest.sh"
|
||||
|
||||
MANIFEST="$(find_manifest src)"
|
||||
log_info "Found manifest: ${MANIFEST}"
|
||||
|
||||
VERSION="$(get_manifest_version "${MANIFEST}")"
|
||||
NAME="$(get_manifest_name "${MANIFEST}")"
|
||||
TYPE="$(get_manifest_type "${MANIFEST}")"
|
||||
|
||||
log_info "Extension: ${NAME} (${TYPE}) v${VERSION}"
|
||||
|
||||
# Verify manifest is well-formed XML
|
||||
require_cmd python3
|
||||
python3 - "${MANIFEST}" <<'PY'
|
||||
import sys
|
||||
import xml.etree.ElementTree as ET
|
||||
|
||||
manifest_path = sys.argv[1]
|
||||
|
||||
try:
|
||||
tree = ET.parse(manifest_path)
|
||||
root = tree.getroot()
|
||||
if root.tag != "extension":
|
||||
print(f"ERROR: Root element must be <extension>, got <{root.tag}>")
|
||||
sys.exit(1)
|
||||
print("✓ Manifest XML is well-formed")
|
||||
except Exception as e:
|
||||
print(f"ERROR: Failed to parse manifest: {e}")
|
||||
sys.exit(1)
|
||||
PY
|
||||
|
||||
log_info "✓ Manifest validation passed"
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# Test: Version alignment
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
log_info "Checking version alignment..."
|
||||
|
||||
if [ ! -f "CHANGELOG.md" ]; then
|
||||
log_warn "CHANGELOG.md not found, skipping version alignment check"
|
||||
else
|
||||
if grep -q "## \[${VERSION}\]" CHANGELOG.md; then
|
||||
log_info "✓ Version ${VERSION} found in CHANGELOG.md"
|
||||
else
|
||||
log_warn "Version ${VERSION} not found in CHANGELOG.md"
|
||||
fi
|
||||
fi
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# Test: Critical files syntax
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
log_info "Checking PHP syntax..."
|
||||
|
||||
if command -v php >/dev/null 2>&1; then
|
||||
php_errors=0
|
||||
failed_files=()
|
||||
while IFS= read -r -d '' f; do
|
||||
if ! php_output=$(php -l "$f" 2>&1); then
|
||||
log_error "PHP syntax error in: $f"
|
||||
echo " Error details:" >&2
|
||||
echo "$php_output" | sed 's/^/ /' >&2
|
||||
echo "" >&2
|
||||
php_errors=$((php_errors + 1))
|
||||
failed_files+=("$f")
|
||||
fi
|
||||
done < <(find src -type f -name '*.php' -print0 2>/dev/null)
|
||||
|
||||
if [ "${php_errors}" -eq 0 ]; then
|
||||
log_info "✓ PHP syntax validation passed"
|
||||
else
|
||||
echo "Summary of PHP syntax errors:" >&2
|
||||
echo " Total errors: ${php_errors}" >&2
|
||||
echo " Failed files:" >&2
|
||||
for f in "${failed_files[@]}"; do
|
||||
echo " - $f" >&2
|
||||
done
|
||||
echo "" >&2
|
||||
echo "To fix: Run 'php -l <filename>' on each failed file for detailed error messages." >&2
|
||||
die "Found ${php_errors} PHP syntax errors"
|
||||
fi
|
||||
else
|
||||
log_warn "PHP not available, skipping PHP syntax check"
|
||||
fi
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# Summary
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
log_info "========================================="
|
||||
log_info "Smoke tests completed successfully"
|
||||
log_info "Extension: ${NAME}"
|
||||
log_info "Version: ${VERSION}"
|
||||
log_info "Type: ${TYPE}"
|
||||
log_info "End time: $(log_timestamp)"
|
||||
END_TIME=$(date +%s)
|
||||
log_info "Duration: $(log_duration "$START_TIME" "$END_TIME")"
|
||||
log_info "========================================="
|
||||
@@ -1,225 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# ============================================================================
|
||||
# Copyright (C) 2025 Moko Consulting <hello@mokoconsulting.tech>
|
||||
#
|
||||
# This file is part of a Moko Consulting project.
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program (./LICENSE.md).
|
||||
# ============================================================================
|
||||
|
||||
# ============================================================================
|
||||
# FILE INFORMATION
|
||||
# ============================================================================
|
||||
# DEFGROUP: Script.Run
|
||||
# INGROUP: Repository.Validation
|
||||
# REPO: https://github.com/mokoconsulting-tech/moko-cassiopeia
|
||||
# PATH: /scripts/run/validate_all.sh
|
||||
# VERSION: 01.00.00
|
||||
# BRIEF: Run all validation scripts and report results
|
||||
# NOTE: Helpful for developers to run all checks before committing
|
||||
# ============================================================================
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "$0")/.." && pwd)"
|
||||
. "${SCRIPT_DIR}/lib/common.sh"
|
||||
. "${SCRIPT_DIR}/lib/logging.sh"
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# Usage
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
usage() {
|
||||
cat <<-USAGE
|
||||
Usage: $0 [OPTIONS]
|
||||
|
||||
Run all validation scripts and report results.
|
||||
|
||||
Options:
|
||||
-v, --verbose Show detailed output from validation scripts
|
||||
-h, --help Show this help message
|
||||
|
||||
Examples:
|
||||
$0 # Run all validations in quiet mode
|
||||
$0 -v # Run with verbose output
|
||||
$0 --help # Show usage information
|
||||
|
||||
Exit codes:
|
||||
0 - All required checks passed
|
||||
1 - One or more required checks failed
|
||||
2 - Invalid arguments
|
||||
|
||||
USAGE
|
||||
exit 0
|
||||
}
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# Configuration
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
VERBOSE="${1:-}"
|
||||
|
||||
# Parse arguments
|
||||
case "${VERBOSE}" in
|
||||
-h|--help)
|
||||
usage
|
||||
;;
|
||||
-v|--verbose)
|
||||
VERBOSE="true"
|
||||
;;
|
||||
"")
|
||||
VERBOSE="false"
|
||||
;;
|
||||
*)
|
||||
log_error "Invalid argument: ${VERBOSE}"
|
||||
echo ""
|
||||
usage
|
||||
exit 2
|
||||
;;
|
||||
esac
|
||||
|
||||
# Check dependencies
|
||||
check_dependencies python3
|
||||
|
||||
START_TIME=$(date +%s)
|
||||
|
||||
log_info "Start time: $(log_timestamp)"
|
||||
|
||||
REQUIRED_CHECKS=(
|
||||
"manifest"
|
||||
"xml_wellformed"
|
||||
)
|
||||
|
||||
OPTIONAL_CHECKS=(
|
||||
"changelog"
|
||||
"language_structure"
|
||||
"license_headers"
|
||||
"no_secrets"
|
||||
"paths"
|
||||
"php_syntax"
|
||||
"tabs"
|
||||
"version_alignment"
|
||||
)
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# Run validations
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
log_section "Repository Validation Suite"
|
||||
log_info "Running all validation checks..."
|
||||
log_separator
|
||||
|
||||
required_passed=0
|
||||
required_failed=0
|
||||
optional_passed=0
|
||||
optional_failed=0
|
||||
|
||||
# Required checks
|
||||
log_section "Required Checks"
|
||||
for check in "${REQUIRED_CHECKS[@]}"; do
|
||||
script="${SCRIPT_DIR}/validate/${check}.sh"
|
||||
if [ ! -f "${script}" ]; then
|
||||
log_error "Script not found: ${script}"
|
||||
required_failed=$((required_failed + 1))
|
||||
continue
|
||||
fi
|
||||
|
||||
log_step "Running: ${check}"
|
||||
# Always capture output for better error reporting
|
||||
output=""
|
||||
if output=$("${script}" 2>&1); then
|
||||
log_success "✓ ${check}"
|
||||
required_passed=$((required_passed + 1))
|
||||
[ "${VERBOSE}" = "true" ] && echo "$output"
|
||||
else
|
||||
log_error "✗ ${check} (FAILED)"
|
||||
required_failed=$((required_failed + 1))
|
||||
# Show error output for required checks regardless of verbose flag
|
||||
echo "" >&2
|
||||
echo "Error output:" >&2
|
||||
echo "$output" >&2
|
||||
echo "" >&2
|
||||
fi
|
||||
done
|
||||
|
||||
echo ""
|
||||
|
||||
# Optional checks
|
||||
log_section "Optional Checks"
|
||||
for check in "${OPTIONAL_CHECKS[@]}"; do
|
||||
script="${SCRIPT_DIR}/validate/${check}.sh"
|
||||
if [ ! -f "${script}" ]; then
|
||||
log_warn "Script not found: ${script}"
|
||||
continue
|
||||
fi
|
||||
|
||||
log_step "Running: ${check}"
|
||||
# Capture output for better error reporting
|
||||
output=""
|
||||
if output=$("${script}" 2>&1); then
|
||||
log_success "✓ ${check}"
|
||||
optional_passed=$((optional_passed + 1))
|
||||
[ "${VERBOSE}" = "true" ] && echo "$output"
|
||||
else
|
||||
log_warn "✗ ${check} (warnings/issues found)"
|
||||
optional_failed=$((optional_failed + 1))
|
||||
# Show brief error summary for optional checks, full output in verbose
|
||||
if [ "${VERBOSE}" = "true" ]; then
|
||||
echo "" >&2
|
||||
echo "Error output:" >&2
|
||||
echo "$output" >&2
|
||||
echo "" >&2
|
||||
else
|
||||
# Show first few lines of error
|
||||
echo "" >&2
|
||||
echo "Error summary (run with -v for full details):" >&2
|
||||
echo "$output" | head -5 >&2
|
||||
echo "" >&2
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# Summary
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
echo ""
|
||||
log_separator
|
||||
log_section "Validation Summary"
|
||||
log_separator
|
||||
|
||||
log_kv "Required checks passed" "${required_passed}/${#REQUIRED_CHECKS[@]}"
|
||||
log_kv "Required checks failed" "${required_failed}"
|
||||
log_kv "Optional checks passed" "${optional_passed}/${#OPTIONAL_CHECKS[@]}"
|
||||
log_kv "Optional checks with issues" "${optional_failed}"
|
||||
|
||||
log_separator
|
||||
|
||||
log_info "End time: $(log_timestamp)"
|
||||
END_TIME=$(date +%s)
|
||||
log_info "Duration: $(log_duration "$START_TIME" "$END_TIME")"
|
||||
|
||||
if [ "${required_failed}" -gt 0 ]; then
|
||||
log_error "FAILED: ${required_failed} required check(s) failed"
|
||||
exit 1
|
||||
else
|
||||
log_success "SUCCESS: All required checks passed"
|
||||
if [ "${optional_failed}" -gt 0 ]; then
|
||||
log_warn "Note: ${optional_failed} optional check(s) found issues"
|
||||
fi
|
||||
exit 0
|
||||
fi
|
||||
Reference in New Issue
Block a user