mirror of
https://github.com/mattermost/mattermost.git
synced 2026-09-21 14:20:41 +08:00
Generate default_roles_permissions.js from a live server snapshot (#36698)
* Generate default_roles_permissions.js from a live server snapshot Replace the hand-maintained default_roles_permissions.js with a generated file. The generator (scripts/default_permissions_generator/) boots a real app.NewServer() against a temporary database created by storetest.MakeSqlSettings, lets all schema and app-level migrations run naturally, then snapshots the resulting Roles table into the JS file. This eliminates the drift risk of the previous hand-maintained map: new migrations are picked up automatically because the same server initialization path is used here as in production. The CI job gets a postgres service and sets IS_CI=true so the generator uses the same host-switching logic as the rest of the test suite. Locally, make start-docker provides the postgres instance. * Address CodeRabbit feedback: pin checkout SHA, add permissions, add .PHONY entries
This commit is contained in:
@@ -195,6 +195,38 @@ jobs:
|
||||
run: make store-layers
|
||||
- name: Check generated code
|
||||
run: if [[ -n $(git status --porcelain) ]]; then echo "Please update the store layers using make store-layers"; exit 1; fi
|
||||
check-default-roles-permissions:
|
||||
name: Check default roles permissions
|
||||
needs: go
|
||||
runs-on: ubuntu-22.04
|
||||
container: mattermost/mattermost-build-server:${{ needs.go.outputs.version }}
|
||||
permissions:
|
||||
contents: read
|
||||
services:
|
||||
postgres:
|
||||
image: postgres:14
|
||||
env:
|
||||
POSTGRES_USER: mmuser
|
||||
POSTGRES_PASSWORD: mostest
|
||||
options: >-
|
||||
--health-cmd pg_isready
|
||||
--health-interval 5s
|
||||
--health-timeout 5s
|
||||
--health-retries 5
|
||||
defaults:
|
||||
run:
|
||||
working-directory: server
|
||||
steps:
|
||||
- name: Checkout mattermost project
|
||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||
- name: Run setup-go-work
|
||||
run: make setup-go-work
|
||||
- name: Generate default roles permissions
|
||||
env:
|
||||
IS_CI: "true"
|
||||
run: make default-roles-permissions
|
||||
- name: Check generated code
|
||||
run: if [[ -n $(git status --porcelain) ]]; then echo "Please update the default roles permissions using make default-roles-permissions"; exit 1; fi
|
||||
check-mmctl-docs:
|
||||
name: Check mmctl docs
|
||||
needs: go
|
||||
|
||||
Reference in New Issue
Block a user