snapshot of https://github.com/mattermost/mattermost.git (master, 2026-09-16; blobs > 131072B omitted)
Some checks failed
Server CI / Postgres (shard 0) (push) Has been skipped
Server CI / Postgres (shard 3) (push) Has been skipped
BuildEnv Docker Image / build-image (push) Failing after 4s
BuildEnv Docker Image / build-image-fips (push) Failing after 4s
Migration Review & Release Notes / Generate migration review & release notes (push) Failing after 3s
Server CI / Build Environment (push) Failing after 3s
Server CI / Postgres (shard 1) (push) Has been skipped
Tools CI / check-style (mattermost-govet) (push) Failing after 4s
Server CI / Postgres (shard 2) (push) Has been skipped
Tools CI / check-style (mmgotool) (push) Failing after 3s
Server CI / Elasticsearch v8 Compatibility (push) Has been skipped
Server CI / OpenSearch v2 Compatibility (push) Has been skipped
Server CI / Postgres FIPS (shard 0) (push) Has been skipped
Tools CI / Test (mattermost-govet) (push) Failing after 3s
Server CI / Postgres FIPS (shard 1) (push) Has been skipped
Server CI / Postgres FIPS (shard 2) (push) Has been skipped
Tools CI / Test (mmgotool) (push) Failing after 3s
Server CI / Postgres FIPS (shard 3) (push) Has been skipped
Server CI / Run mmctl tests (push) Has been skipped
Server CI / Run mmctl tests (FIPS) (push) Has been skipped
Server CI / Merge Postgres Test Results (push) Has been skipped
Server CI / Merge Postgres FIPS Test Results (push) Has been skipped
Server CI / Check backport migrations (push) Has been skipped
Server CI / Check generated files (push) Has been skipped
Server CI / check-style (push) Has been skipped
Server CI / Vet API (push) Has been skipped
Server CI / Build mattermost server app (push) Has been skipped
Server CI / Server CI Complete (push) Failing after 2s
Server CI / Server CI Artifacts (push) Has been skipped
Server CI / Sentry Upload (push) Has been skipped
Server CI / Server CI Report (push) Failing after 5m1s
Server CI Nightly Race / Race Detector (push) Has been skipped
CodeQL / Analyze (go) (push) Has been cancelled
CodeQL / Analyze (javascript) (push) Has been cancelled
Webapp CI Cache Warm / Warm Webapp node_modules Cache (push) Has been cancelled
E2E CI Cache Warm / Warm E2E npm Registry Cache (push) Has been cancelled
API / build (push) Has been cancelled
Web App CI / check-types (push) Has been cancelled
Web App CI / check-lint (push) Has been cancelled
Web App CI / check-i18n (push) Has been cancelled
Web App CI / check-external-links (push) Has been cancelled
Web App CI / test (platform) (push) Has been cancelled
Web App CI / test (mattermost-redux) (push) Has been cancelled
Web App CI / test (channels shard 1/4) (push) Has been cancelled
Web App CI / test (channels shard 2/4) (push) Has been cancelled
Web App CI / test (channels shard 3/4) (push) Has been cancelled
Web App CI / test (channels shard 4/4) (push) Has been cancelled
Web App CI / upload-coverage (push) Has been cancelled
Web App CI / build (push) Has been cancelled
YAML Lint / yamllint (push) Has been cancelled
Push mirrored docker images / cd/Push mirrored docker images (push) Has been cancelled
docs-cd / Build and deploy docs (push) Has been cancelled
Docs CI / build (push) Has been cancelled
E2E Cache Warm: Cypress deps / Warm Cypress deps cache (push) Has been cancelled
Scorecards supply-chain security / Scorecard analysis (push) Has been cancelled
Server CI Weekly / Postgres FIPS (push) Has been skipped
Server CI Weekly / Run mmctl tests (FIPS) (push) Has been skipped
Server CI Weekly / Postgres with binary parameters (push) Has been skipped
Server CI Weekly / Build Environment (push) Failing after 1s
Server CI Cache Warm / Warm Go Module and Build Cache (push) Failing after 2s
Server CI Nightly Race / Build Environment (push) Failing after 1s

This commit is contained in:
upstream-mirror
2026-09-16 00:29:55 +05:00
commit 240db4e2a7
15309 changed files with 2173406 additions and 0 deletions

View File

@@ -0,0 +1,78 @@
#!/usr/bin/env bash
#
# Backport safety check (Postgres only).
#
# A release branch is an older subset of master. When a PR backports a migration
# it must keep the exact version number and name that migration already has on
# master; renumbering or renaming a shipped migration breaks the upgrade path
# (the MM-68848 class of bug).
#
# We therefore only look at the migrations this PR ADDS on top of its base branch
# and require each of them to already exist on master. Files that are already on
# the base branch are left untouched, so historical states such as the Postgres
# migrations renamed before the pre-migration infra landed do not produce false
# positives.
#
# MySQL is intentionally skipped: support was dropped after v11.0, so older
# release branches still carry MySQL migrations that no longer exist on master.
#
# Portable across the bash 3.2 that ships with macOS and Linux CI: uses only
# POSIX-ish tools plus process substitution, no bash 4 features.
#
set -euo pipefail
export LC_ALL=C
# Branch the PR targets. The migrations the PR adds are everything HEAD has that
# this ref does not.
base_ref="${MM_MIGRATION_CHECK_BASE_REF:-origin/master}"
# Canonical source of shipped migrations the additions must match.
canonical_ref="${MM_MIGRATION_CHECK_CANONICAL_REF:-origin/master}"
repo_root="$(git rev-parse --show-toplevel)"
# Postgres only; MySQL migrations linger on old release branches and are skipped.
migrations_dir="server/channels/db/migrations/postgres"
for ref in "$base_ref" "$canonical_ref"; do
if ! git -C "$repo_root" rev-parse --verify --quiet "${ref}^{commit}" >/dev/null; then
echo "Ref '$ref' not found. Fetch it first (e.g. 'git fetch origin master')" >&2
echo "or set MM_MIGRATION_CHECK_BASE_REF / MM_MIGRATION_CHECK_CANONICAL_REF." >&2
exit 2
fi
done
# path -> "version_name.kind"; the up/down kind is part of the identity so a
# one-sided rename can't be masked by its surviving partner file.
norm='s#^'"$migrations_dir"'/([0-9]+_.+)\.(up|down)\.sql$#\1.\2#p'
ref_files() {
git -C "$repo_root" ls-tree -r --name-only "$1" -- "$migrations_dir" \
| sed -nE "$norm" | sort -u
}
head_files() {
# Tracked + untracked files actually present on disk, so a plain `mv`
# without `git add` is still caught.
git -C "$repo_root" ls-files --cached --others --exclude-standard -- "$migrations_dir" \
| while IFS= read -r path; do
[ -f "$repo_root/$path" ] && printf '%s\n' "$path"
done \
| sed -nE "$norm" | sort -u
}
# Migrations this PR adds on top of its base branch.
added="$(comm -23 <(head_files) <(ref_files "$base_ref"))"
# Of those, the ones that don't exist on the canonical branch are renames,
# renumbers, or otherwise stray.
stray="$(comm -23 <(printf '%s\n' "$added" | sed '/^$/d') <(ref_files "$canonical_ref"))"
if [ -n "$stray" ]; then
count="$(printf '%s\n' "$stray" | wc -l | tr -d '[:space:]')"
echo "Found $count migration file(s) added by this branch that do not exist on $canonical_ref:" >&2
printf '%s\n' "$stray" | while IFS= read -r m; do
echo " - ${m}.sql is added on this branch but not present on $canonical_ref; renaming or renumbering a shipped migration breaks upgrades. Add a new migration instead." >&2
done
exit 1
fi
echo "All migrations added by this branch exist on $canonical_ref."