From ba7970b5489dfddb1cd7478185c030e93d248b87 Mon Sep 17 00:00:00 2001 From: Tamo Date: Thu, 6 Mar 2025 15:50:29 +0100 Subject: [PATCH 1/6] update the issue template for the sprint issue --- .github/ISSUE_TEMPLATE/sprint_issue.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/.github/ISSUE_TEMPLATE/sprint_issue.md b/.github/ISSUE_TEMPLATE/sprint_issue.md index 84b8f1066..fa558487e 100644 --- a/.github/ISSUE_TEMPLATE/sprint_issue.md +++ b/.github/ISSUE_TEMPLATE/sprint_issue.md @@ -22,6 +22,18 @@ Related product discussion: +### Are you modifying a database? +- [ ] If not, add the `no db change` label to your PR, and you're good to go. +- [ ] If yes, add the `db change` label to your PR and you're good to go. + - [ ] /!\ Ensure all the read operations still work! + - If the change happened in milli, you may need to check the version of the database before doing any read operation + - If the change happened in the index-scheduler, make sure the new code can immediately read the old database + - If the change happened in the meilisearch-auth database, reach out to the team; we don't know yet how to handle these changes + - [ ] Write the code to go from the old database to the new one + - If the change happened in milli, the upgrade function should be written and called [here](https://github.com/meilisearch/meilisearch/blob/3fd86e8d76d7d468b0095d679adb09211ca3b6c0/crates/milli/src/update/upgrade/mod.rs#L24-L47) + - If the change happened in the index-scheduler, we've never done it yet, but the right place to do it should be [here](https://github.com/meilisearch/meilisearch/blob/3fd86e8d76d7d468b0095d679adb09211ca3b6c0/crates/index-scheduler/src/scheduler/process_upgrade/mod.rs#L13) + - [ ] Write an integration test [here](https://github.com/meilisearch/meilisearch/blob/main/crates/meilisearch/tests/upgrade/mod.rs) ensuring you can read the old database, upgrade to the new database, and read the new database as expected + ### Reminders when modifying the API - [ ] Update the openAPI file with utoipa: From c67ba9e237c29c089c3476820d8f12a95e6e7380 Mon Sep 17 00:00:00 2001 From: Tamo Date: Thu, 6 Mar 2025 16:30:48 +0100 Subject: [PATCH 2/6] update the CI to enforce the db change label on PR --- .github/workflows/db-change.yml | 25 +++++++++++++++++++++++++ bors.toml | 1 + 2 files changed, 26 insertions(+) create mode 100644 .github/workflows/db-change.yml diff --git a/.github/workflows/db-change.yml b/.github/workflows/db-change.yml new file mode 100644 index 000000000..34d2cb5ad --- /dev/null +++ b/.github/workflows/db-change.yml @@ -0,0 +1,25 @@ +name: Check db change labels + +on: + pull_request: + types: [opened, synchronize, reopened, labeled, unlabeled] + +env: + GH_TOKEN: ${{ secrets.MEILI_BOT_GH_PAT }} + +jobs: + check-labels: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v2 + - name: Check db change labels + id: check_labels + run: | + LABELS=$(gh api -H "Accept: application/vnd.github.v3+json" /repos/meilisearch/meilisearch/pulls/${{ github.event.pull_request.number }}/labels -q .[].name) + if [[ ! "$LABELS" =~ "db change" && ! "$LABELS" =~ "no db change" ]]; then + echo "::error::Pull request must contain either the 'db change' or 'no db change' label." + exit 1 + else + echo "The label is set" + fi diff --git a/bors.toml b/bors.toml index 71a8748b8..e2318938f 100644 --- a/bors.toml +++ b/bors.toml @@ -5,6 +5,7 @@ status = [ 'Run Clippy', 'Run Rustfmt', 'Run tests in debug', + 'Check db change labels', ] pr_status = ['Milestone Check'] # 3 hours timeout From 8b655bb998b1dcc955edb5ea0c4192d8fa7adbf3 Mon Sep 17 00:00:00 2001 From: Tamo Date: Thu, 6 Mar 2025 17:53:48 +0100 Subject: [PATCH 3/6] fix the CI --- .github/workflows/db-change.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/db-change.yml b/.github/workflows/db-change.yml index 34d2cb5ad..f8e4c78ec 100644 --- a/.github/workflows/db-change.yml +++ b/.github/workflows/db-change.yml @@ -4,15 +4,16 @@ on: pull_request: types: [opened, synchronize, reopened, labeled, unlabeled] -env: - GH_TOKEN: ${{ secrets.MEILI_BOT_GH_PAT }} - jobs: check-labels: runs-on: ubuntu-latest steps: - name: Checkout code uses: actions/checkout@v2 + - name: Set up GitHub CLI + uses: cli/gh-action@v2 + with: + token: ${{ secrets.MEILI_BOT_GH_PAT }} - name: Check db change labels id: check_labels run: | From fa6459335ce9e7f44f4da081e1508b5fd613d7b8 Mon Sep 17 00:00:00 2001 From: Tamo Date: Thu, 6 Mar 2025 18:14:14 +0100 Subject: [PATCH 4/6] gh is supposed to be pre-installed --- .github/workflows/db-change.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/db-change.yml b/.github/workflows/db-change.yml index f8e4c78ec..34d2cb5ad 100644 --- a/.github/workflows/db-change.yml +++ b/.github/workflows/db-change.yml @@ -4,16 +4,15 @@ on: pull_request: types: [opened, synchronize, reopened, labeled, unlabeled] +env: + GH_TOKEN: ${{ secrets.MEILI_BOT_GH_PAT }} + jobs: check-labels: runs-on: ubuntu-latest steps: - name: Checkout code uses: actions/checkout@v2 - - name: Set up GitHub CLI - uses: cli/gh-action@v2 - with: - token: ${{ secrets.MEILI_BOT_GH_PAT }} - name: Check db change labels id: check_labels run: | From 56b01e28a159f94a8248985d66d3fb1d1bef175c Mon Sep 17 00:00:00 2001 From: Tamo Date: Thu, 6 Mar 2025 18:22:30 +0100 Subject: [PATCH 5/6] wip debug the url --- .github/workflows/db-change.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/db-change.yml b/.github/workflows/db-change.yml index 34d2cb5ad..84f3f645e 100644 --- a/.github/workflows/db-change.yml +++ b/.github/workflows/db-change.yml @@ -16,6 +16,9 @@ jobs: - name: Check db change labels id: check_labels run: | + URL=/repos/meilisearch/meilisearch/pulls/${{ github.event.pull_request.number }}/labels + echo ${{ github.event.pull_request.number }} + echo $URL LABELS=$(gh api -H "Accept: application/vnd.github.v3+json" /repos/meilisearch/meilisearch/pulls/${{ github.event.pull_request.number }}/labels -q .[].name) if [[ ! "$LABELS" =~ "db change" && ! "$LABELS" =~ "no db change" ]]; then echo "::error::Pull request must contain either the 'db change' or 'no db change' label." From cea95d4dc0ae5e27a0d1b9303a118d4bf879ddff Mon Sep 17 00:00:00 2001 From: Tamo Date: Thu, 6 Mar 2025 18:29:45 +0100 Subject: [PATCH 6/6] wip debug the url --- .github/workflows/db-change.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/db-change.yml b/.github/workflows/db-change.yml index 84f3f645e..dbd6bb82c 100644 --- a/.github/workflows/db-change.yml +++ b/.github/workflows/db-change.yml @@ -19,7 +19,7 @@ jobs: URL=/repos/meilisearch/meilisearch/pulls/${{ github.event.pull_request.number }}/labels echo ${{ github.event.pull_request.number }} echo $URL - LABELS=$(gh api -H "Accept: application/vnd.github.v3+json" /repos/meilisearch/meilisearch/pulls/${{ github.event.pull_request.number }}/labels -q .[].name) + LABELS=$(gh api -H "Accept: application/vnd.github+json" -H "X-GitHub-Api-Version: 2022-11-28" /repos/meilisearch/meilisearch/issues/${{ github.event.pull_request.number }}/labels -q .[].name) if [[ ! "$LABELS" =~ "db change" && ! "$LABELS" =~ "no db change" ]]; then echo "::error::Pull request must contain either the 'db change' or 'no db change' label." exit 1