Skip to content

Pin Meilisearch version and add workflow to automate upgrade#2148

Merged
Strift merged 2 commits intomainfrom
feat/automate-release-tracking
Mar 24, 2026
Merged

Pin Meilisearch version and add workflow to automate upgrade#2148
Strift merged 2 commits intomainfrom
feat/automate-release-tracking

Conversation

@Strift
Copy link
Copy Markdown
Collaborator

@Strift Strift commented Mar 18, 2026

Pull Request

Motivation

We want to pin the Meilisearch version to make CI deterministic.

Benefits:

  • Isolate CI failures due to version upgrades in a single PR
  • Do not break tests on unrelated PRs when a new version introduces a breaking change
  • Meilisearch version compatibility documented in the commit history

Note

For practical reasons, we'll accept a slight version drift by only pinning the minor, not the patch version.

What does this PR do?

  • Pin meilisearch version in docker-compose.yml and tests.yml to make local + CI more consistent
  • Adds a workflow that runs daily to update Meilisearch version in docker-compose.yml and tests.yml

AI disclosure

Cursor with gpt-5.1-high and gpt-5.3-codex models

PR checklist

Please check if your PR fulfills the following requirements:

  • Did you use any AI tool while implementing this PR (code, tests, docs, etc.)? If yes, disclose it in the PR description and describe what it was used for. AI usage is allowed when it is disclosed.
  • Does this PR fix an existing issue, or have you listed the changes applied in the PR description (and why they are needed)?
  • Have you read the contributing guidelines?
  • Have you made sure that the title is accurate and descriptive of the changes?

Thank you so much for contributing to Meilisearch!

@Strift Strift added the maintenance Issue about maintenance (CI, tests, refacto...) label Mar 18, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Mar 18, 2026

📝 Walkthrough

Walkthrough

Introduces automation infrastructure for bumping Meilisearch versions in the repository. A new Bash script detects the latest stable release, determines if an update is needed, and conditionally updates configuration files. A corresponding GitHub Actions workflow runs daily and on demand, executing the script and creating pull requests when version bumps are detected.

Changes

Cohort / File(s) Summary
Version Bumping Automation
.github/scripts/bump-meilisearch-version.sh, .github/workflows/bump-meilisearch-version.yml
New bash script that fetches latest Meilisearch release, validates format, compares against current version, detects existing PRs, and performs in-place file updates. Accompanying workflow triggered daily/on-demand that runs the script and creates PRs with commit/PR details when updates are needed.
Configuration Updates
docker-compose.yml, .github/workflows/tests.yml
Updated Meilisearch image tags from latest/v1.37.0 to consistent minor version v1.37 across docker configuration and CI workflow.

Sequence Diagram

sequenceDiagram
    actor GitHub Actions
    participant Bash Script
    participant File System
    participant GitHub API
    
    GitHub Actions->>Bash Script: Execute bump-meilisearch-version.sh
    Bash Script->>GitHub API: Fetch latest Meilisearch release tag
    Bash Script->>Bash Script: Validate tag format, compute TARGET_TAG
    Bash Script->>File System: Read docker-compose.yml
    Bash Script->>Bash Script: Compare CURRENT_MM vs TARGET_TAG
    
    alt Update needed and no existing PR
        Bash Script->>File System: Update docker-compose.yml with TARGET_TAG
        Bash Script->>File System: Update .github/workflows/tests.yml with TARGET_TAG
        Bash Script->>File System: Commit changes via git
        Bash Script->>GitHub API: Create pull request with release details
        Bash Script->>GitHub Actions: Output success status
    else No update needed or PR exists
        Bash Script->>GitHub Actions: Output skip status
    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

Poem

🐰 A script so clever, it hops through the night,
Fetching new versions and setting them right,
GitHub workflows dance to automation's beat,
Meilisearch bumps—now effortless and neat! ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title directly reflects the main changes: pinning Meilisearch version to v1.37 in docker-compose.yml and adding an automated workflow to handle future version upgrades.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/automate-release-tracking
📝 Coding Plan
  • Generate coding plan for human review comments

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@Strift Strift force-pushed the feat/automate-release-tracking branch from 67e1213 to 8cdf05a Compare March 18, 2026 07:08
@Strift Strift changed the title Add workflow Add workflow to automate Meilisearch version upgrade Mar 18, 2026
@Strift Strift requested review from brunoocasali and flevi29 March 18, 2026 07:13
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (3)
.github/scripts/bump-meilisearch-version.sh (2)

78-85: Verification grep commands could be more robust.

The verification on lines 84-85 will cause the script to exit with error (due to set -e) if the pattern isn't found, which is the desired behavior. However, if sed silently fails to make replacements (e.g., due to pattern mismatch), the error message won't be descriptive.

Consider adding explicit error messages for easier debugging.

♻️ Add descriptive error messages
-grep "${MEILISEARCH_DOCKER_IMAGE}:${TARGET_TAG}" "${DOCKER_COMPOSE_FILE}" >/dev/null
-grep "${MEILISEARCH_DOCKER_IMAGE}:${TARGET_TAG}" "${TESTS_WORKFLOW_FILE}" >/dev/null
+if ! grep -q "${MEILISEARCH_DOCKER_IMAGE}:${TARGET_TAG}" "${DOCKER_COMPOSE_FILE}"; then
+  echo "ERROR: Failed to update ${DOCKER_COMPOSE_FILE}" >&2
+  exit 1
+fi
+if ! grep -q "${MEILISEARCH_DOCKER_IMAGE}:${TARGET_TAG}" "${TESTS_WORKFLOW_FILE}"; then
+  echo "ERROR: Failed to update ${TESTS_WORKFLOW_FILE}" >&2
+  exit 1
+fi
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/scripts/bump-meilisearch-version.sh around lines 78 - 85, The
verification greps for ${MEILISEARCH_DOCKER_IMAGE}:${TARGET_TAG} are not
descriptive when they fail; update the checks around the grep invocations (the
two lines that call grep against "${DOCKER_COMPOSE_FILE}" and
"${TESTS_WORKFLOW_FILE}") to perform an explicit conditional test (e.g., if !
grep ... >/dev/null; then echo a clear error mentioning which file failed and
the expected pattern ${MEILISEARCH_DOCKER_IMAGE}:${TARGET_TAG}; exit 1; fi) so
that when sed made no replacement you get a helpful error message referencing
DOCKER_COMPOSE_FILE and TESTS_WORKFLOW_FILE and the TARGET_TAG.

47-52: Sed regex may not extract the tag correctly.

The sed pattern s|.*${MEILISEARCH_DOCKER_IMAGE}:(v[0-9]+\.[0-9]+(\.[0-9]+)?)|\1|p captures the version tag in group 1, but .* at the start consumes everything up to the image name, and then the replacement \1 only outputs the captured version group. However, if there's any trailing content on the line (e.g., quotes or other characters), it won't be removed since the pattern doesn't match the rest of the line.

For the current docker-compose.yml format (image: getmeili/meilisearch-enterprise:v1.37), this works because the tag is at the end of the line, but it's fragile.

♻️ More robust extraction
-CURRENT_TAG="$(sed -nE "s|.*${MEILISEARCH_DOCKER_IMAGE}:(v[0-9]+\.[0-9]+(\.[0-9]+)?)|\1|p" "${DOCKER_COMPOSE_FILE}" | head -n 1 || true)"
+CURRENT_TAG="$(sed -nE "s|.*${MEILISEARCH_DOCKER_IMAGE}:(v[0-9]+\.[0-9]+(\.[0-9]+)?).*|\1|p" "${DOCKER_COMPOSE_FILE}" | head -n 1 || true)"

Adding .* after the capture group ensures any trailing characters are consumed.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/scripts/bump-meilisearch-version.sh around lines 47 - 52, The sed
extraction in the CURRENT_TAG assignment is fragile because it doesn't consume
trailing characters after the captured version; update the sed regex used with
CURRENT_TAG (the one referencing MEILISEARCH_DOCKER_IMAGE and
DOCKER_COMPOSE_FILE) to append a pattern that consumes any remaining characters
after the version capture so only the version (vX.Y or vX.Y.Z) is output into
CURRENT_TAG, then keep the existing logic that derives CURRENT_VERSION and
CURRENT_MM from that value.
.github/workflows/bump-meilisearch-version.yml (1)

52-56: Redundant PR existence check.

This check duplicates the logic already present in the bump script (lines 71-76 in bump-meilisearch-version.sh). If an open PR exists, the script sets should_update=false and exits, so this step won't execute.

The redundancy is harmless but adds unnecessary code. Consider removing it or documenting why the double-check is intentional (e.g., race condition protection).

♻️ Suggested simplification
      - name: Create PR
        if: steps.bump.outputs.should_update == 'true'
        env:
          TARGET_TAG: ${{ steps.bump.outputs.target_tag }}
          NEW_BRANCH: ${{ steps.bump.outputs.new_branch }}
          LATEST_TAG: ${{ steps.bump.outputs.latest_tag }}
        run: |
-          OPEN_COUNT=$(gh pr list --state open --head "$NEW_BRANCH" --base "$BASE_BRANCH" --json number --jq 'length')
-          if [ "$OPEN_COUNT" -gt 0 ]; then
-            echo "PR already exists for branch $NEW_BRANCH"
-            exit 0
-          fi
-
          gh pr create \
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/bump-meilisearch-version.yml around lines 52 - 56, The
block that computes OPEN_COUNT using gh pr list and exits if a PR exists is
redundant with the existing check in the bump script (which already sets
should_update=false when an open PR exists); either remove the entire
OPEN_COUNT/if block (the three lines referencing OPEN_COUNT, NEW_BRANCH and
BASE_BRANCH) or replace it with a short comment explaining it's an intentional
double-check for race-condition protection so reviewers understand why the
duplicate exists.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In @.github/scripts/bump-meilisearch-version.sh:
- Around line 78-85: The verification greps for
${MEILISEARCH_DOCKER_IMAGE}:${TARGET_TAG} are not descriptive when they fail;
update the checks around the grep invocations (the two lines that call grep
against "${DOCKER_COMPOSE_FILE}" and "${TESTS_WORKFLOW_FILE}") to perform an
explicit conditional test (e.g., if ! grep ... >/dev/null; then echo a clear
error mentioning which file failed and the expected pattern
${MEILISEARCH_DOCKER_IMAGE}:${TARGET_TAG}; exit 1; fi) so that when sed made no
replacement you get a helpful error message referencing DOCKER_COMPOSE_FILE and
TESTS_WORKFLOW_FILE and the TARGET_TAG.
- Around line 47-52: The sed extraction in the CURRENT_TAG assignment is fragile
because it doesn't consume trailing characters after the captured version;
update the sed regex used with CURRENT_TAG (the one referencing
MEILISEARCH_DOCKER_IMAGE and DOCKER_COMPOSE_FILE) to append a pattern that
consumes any remaining characters after the version capture so only the version
(vX.Y or vX.Y.Z) is output into CURRENT_TAG, then keep the existing logic that
derives CURRENT_VERSION and CURRENT_MM from that value.

In @.github/workflows/bump-meilisearch-version.yml:
- Around line 52-56: The block that computes OPEN_COUNT using gh pr list and
exits if a PR exists is redundant with the existing check in the bump script
(which already sets should_update=false when an open PR exists); either remove
the entire OPEN_COUNT/if block (the three lines referencing OPEN_COUNT,
NEW_BRANCH and BASE_BRANCH) or replace it with a short comment explaining it's
an intentional double-check for race-condition protection so reviewers
understand why the duplicate exists.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 663bdddd-3488-4daf-9438-cd7ae698937e

📥 Commits

Reviewing files that changed from the base of the PR and between e67674e and 1bc02ac.

📒 Files selected for processing (4)
  • .github/scripts/bump-meilisearch-version.sh
  • .github/workflows/bump-meilisearch-version.yml
  • .github/workflows/tests.yml
  • docker-compose.yml

@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 18, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.95%. Comparing base (e67674e) to head (1bc02ac).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2148   +/-   ##
=======================================
  Coverage   97.95%   97.95%           
=======================================
  Files          15       15           
  Lines         635      635           
  Branches      104      104           
=======================================
  Hits          622      622           
  Misses         12       12           
  Partials        1        1           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@Strift
Copy link
Copy Markdown
Collaborator Author

Strift commented Mar 18, 2026

@flevi29, this may overlap with #2035

I chose to use a GitHub action to make it easier to implement the same behavior across Meilisearch repositories

@Strift Strift changed the title Add workflow to automate Meilisearch version upgrade Pin Meilisearch version and add workflow to automate upgrade Mar 18, 2026
@flevi29
Copy link
Copy Markdown
Collaborator

flevi29 commented Mar 18, 2026

Alright, although I do feel it might be overkill to spin up a CI every day just to check if our target meilisearch is the latest.

I would prefer a simple file or a config file that contains the target version, which we can update when we're implementing new features manually. I'll look into a more universal way to do this.

But until then this looks fine at first sight.

@Strift Strift added this pull request to the merge queue Mar 24, 2026
Merged via the queue into main with commit d2d31c4 Mar 24, 2026
7 checks passed
@Strift Strift deleted the feat/automate-release-tracking branch March 24, 2026 09:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintenance Issue about maintenance (CI, tests, refacto...)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants