initialising for ci-cd pipeline
CI/CD - ERP Core / scripts (pull_request) Failing after 12m21s
CI/CD - ERP Core / e2e-typecheck (pull_request) Failing after 13m13s
CI/CD - ERP Core / frontend (pull_request) Failing after 14m5s
CI/CD - ERP Core / backend (pull_request) Failing after 14m57s
CI/CD - ERP Core / detect (pull_request) Failing after 13m42s
CI/CD - ERP Core / Build & Deploy (pull_request) Failing after 12m47s
CI/CD - ERP Core / ci-ok (pull_request) Failing after 14m58s

This commit is contained in:
2026-09-16 11:53:55 +05:30
parent 666979cf22
commit 8e472ac996
48 changed files with 2224 additions and 62 deletions
+53
View File
@@ -0,0 +1,53 @@
#!/usr/bin/env bash
# ci-cd.yml › backend — flag destructive EF migrations introduced by this pull request.
#
# A failed deploy rolls the backend binaries back but never the database, so every release must
# leave the PREVIOUS backend working on the NEW schema: add tables/columns now, drop or rename
# them in a later release (expand → contract, docs/40-DEPLOYMENT.md §8).
# into Dev → warning
# into production → failure, unless the PR title contains [allow-destructive-migration]
# shellcheck source=common.sh
source "$(dirname "${BASH_SOURCE[0]}")/common.sh"
: "${BASE_REF:?BASE_REF (the PR target branch) is required}"
base="refs/remotes/origin/$BASE_REF"
git_remote fetch -q --depth 1 "$REPO_GIT_URL" "+refs/heads/$BASE_REF:$base"
# Two-dot tree diff: needs only the two commits, not their history (depth-1 friendly).
mapfile -t files < <(
git diff --name-only --diff-filter=AM "$base" HEAD -- "$MIGRATIONS_PATH" |
grep -E '\.cs$' | grep -vE '\.Designer\.cs$|ModelSnapshot\.cs$' || true
)
if ((${#files[@]} == 0)); then
log "no new or changed migrations"
exit 0
fi
hits=""
for f in "${files[@]}"; do
# Only Up() matters — every Down() legitimately drops what its Up() created.
found="$(awk '
/override void Up\(/ { up = 1 }
/override void Down\(/ { up = 0 }
up && /migrationBuilder\.(DropTable|DropColumn|RenameColumn|RenameTable|DropSchema|DropSequence)\(/ {
printf " %s:%d: %s\n", FILENAME, FNR, $0
}' "$f")"
hits+="$found"
done
if [[ -z "$hits" ]]; then
log "checked ${#files[@]} migration file(s): additive only"
exit 0
fi
printf '%s\n' "$hits"
msg="destructive operation in a migration's Up() — keep the previous release working on the new schema: expand now, contract in a later release (docs/40-DEPLOYMENT.md §8)"
if [[ "$BASE_REF" == production ]]; then
if [[ "${PR_TITLE:-}" == *"[allow-destructive-migration]"* ]]; then
warn "$msg — allowed by the [allow-destructive-migration] PR title override"
exit 0
fi
fail "$msg"
fi
warn "$msg"