Skip to content

Add Flyway migration conflict detection in CI - #1888

Merged
acx10 merged 3 commits into
developfrom
ci/flyway-v2
Dec 14, 2025
Merged

acx10 merged 3 commits into
developfrom
ci/flyway-v2

Conversation

@acx10

@acx10 acx10 commented Dec 14, 2025

Copy link
Copy Markdown
Collaborator

🚀 Pull Request

📝 Description

🛠️ Changes Implemented

🧪 Testing Strategy

📸 Visual Changes (if applicable)

⚠️ Required Pre-Submission Checklist

  • Code adheres to project style guidelines and conventions
  • Branch synchronized with latest develop branch
  • Automated unit/integration tests added/updated to cover changes
  • All tests pass locally (./gradlew test for backend)
  • Manual testing completed in local development environment
  • Flyway migration versioning follows correct sequence (if database schema modified)
  • Documentation pull request submitted to booklore-docs (required for features or enhancements that introduce user-facing or visual changes)

💬 Additional Context (optional)

@github-actions

github-actions Bot commented Dec 14, 2025 •

Copy link
Copy Markdown

Backend Test Results

118 files  118 suites   15s ⏱️
893 tests 891 ✅ 2 💤 0 ❌
903 runs  901 ✅ 2 💤 0 ❌

Results for commit 66fca65.

♻️ This comment has been updated with latest results.

Comment on lines +14 to +37
name: Check for DB Migrations
if: github.event_name == 'pull_request' && ((github.base_ref == 'master' && github.head_ref == 'develop') || github.base_ref == 'develop')
runs-on: ubuntu-latest
outputs:
has_migrations: ${{ steps.check_migrations.outputs.has_migrations }}
steps:
- name: Checkout PR branch
- name: Checkout Repository for Diff
uses: actions/checkout@v6
with:
fetch-depth: 0

- name: Determine comparison reference
id: compare_ref
run: |
bash .github/scripts/determine-compare-ref.sh "${{ github.base_ref }}"

- name: Check for migration changes
- name: Detect Flyway Migration Changes
id: check_migrations
if: steps.compare_ref.outputs.has_ref == 'true'
run: |
# Check for changes in the migration directory
if git diff --name-only --diff-filter=AMRCD ${{ env.COMPARE_REF }}...HEAD | grep -q "booklore-api/src/main/resources/db/migration/"; then
echo "Migration file changes detected."
# Compare PR head with the target base branch
if git diff --name-only origin/${{ github.base_ref }}...HEAD | grep -q "booklore-api/src/main/resources/db/migration/V.*.sql"; then
echo "Migration file changes detected. Proceeding with migration preview."
echo "has_migrations=true" >> $GITHUB_OUTPUT
else
echo "No migration file changes detected. Skipping conflict check."
echo "No migration file changes detected. Skipping migration preview."
echo "has_migrations=false" >> $GITHUB_OUTPUT
fi

- name: Analyze migration changes
if: steps.check_migrations.outputs.has_migrations == 'true'
id: analyze_changes
flyway-migration-preview:

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}

Copilot Autofix

AI 10 months ago

To fix this issue, we need to add a permissions block to the workflow (in .github/workflows/docker-build-publish.yml). The most effective way is to add this block at the workflow root, just below the name key and before the on key. This will ensure all jobs default to restrictive permissions unless another job needs elevated rights and overrides them. The block to add should be:

permissions:
  contents: read

This change does not restrict functionality for the jobs shown, since all steps in check-for-migrations, flyway-migration-preview, and (by implication) other jobs only require source code checkout and local operations. If any job requires additional permissions, it can introduce its own permissions block. No new methods, imports, or environment changes are required—just this small YAML addition.


Suggested changeset 1
.github/workflows/docker-build-publish.yml

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/.github/workflows/docker-build-publish.yml b/.github/workflows/docker-build-publish.yml
--- a/.github/workflows/docker-build-publish.yml
+++ b/.github/workflows/docker-build-publish.yml
@@ -1,4 +1,6 @@
 name: Build, Tag, Push, and Release to GitHub Container Registry
+permissions:
+  contents: read
 
 on:
   push:
EOF
@@ -1,4 +1,6 @@
name: Build, Tag, Push, and Release to GitHub Container Registry
permissions:
contents: read

on:
push:
Copilot is powered by AI and may make mistakes. Always verify output.
@balazs-szucs

Copy link
Copy Markdown
Contributor

I have a lot of Flyway/DB tests in #1850. Since I’ve decoupled most of the main testing suites, I can now submit that as a standalone PR, just as I did with what I consider the core CI stuff at #1891.

# Conflicts:
#	.github/workflows/docker-build-publish.yml
@acx10 acx10 changed the title Flyway test 1 Add Flyway migration conflict detection in CI Dec 14, 2025
@acx10 acx10 added the ci CI/CD related changes label Dec 14, 2025
@acx10
acx10 marked this pull request as ready for review December 14, 2025 19:15
@acx10
acx10 merged commit 3f14376 into develop Dec 14, 2025
8 checks passed
@acx10
acx10 deleted the ci/flyway-v2 branch December 14, 2025 19:16
alexlebens pushed a commit to alexlebens/infrastructure that referenced this pull request Dec 20, 2025
This PR contains the following updates:

| Package | Update | Change |
|---|---|---|
| [ghcr.io/booklore-app/booklore](https://github.com/booklore-app/booklore) | minor | `v1.14.1` -> `v1.15.0` |

---

### Release Notes

<details>
<summary>booklore-app/booklore (ghcr.io/booklore-app/booklore)</summary>

### [`v1.15.0`](https://github.com/booklore-app/booklore/releases/tag/v1.15.0)

[Compare Source](booklore-app/booklore@v1.14.1...v1.15.0)

#### 🌟 What's New in v1.15.0

#### 🚀 New Features

- feat: add additional cover art actions and settings ([#&#8203;1938](booklore-app/booklore#1938)) by [@&#8203;CounterClops](https://github.com/CounterClops)
- feat(hardcover): sync Kobo reading progress to Hardcover ([#&#8203;1926](booklore-app/booklore#1926)) by [@&#8203;boludo00](https://github.com/boludo00)
- Add sequential next/previous book navigation from library, filtered, and search views ([#&#8203;1931](booklore-app/booklore#1931)) by [@&#8203;acx10](https://github.com/acx10)
- feat(api, ui): add bookdrop bulk edit and metadata pattern extraction ([#&#8203;1846](booklore-app/booklore#1846)) by [@&#8203;CounterClops](https://github.com/CounterClops)
- Add support for fb2 books ([#&#8203;1757](booklore-app/booklore#1757)) by [@&#8203;slonoed](https://github.com/slonoed)

#### ✨ Enhancements

- feat: add library sync URL generation in KoboUrlBuilder ([#&#8203;1937](booklore-app/booklore#1937)) by [@&#8203;ripdog](https://github.com/ripdog)
- feat(opds): allow user to set sorting for opds feed in settings ([#&#8203;1824](booklore-app/booklore#1824)) by [@&#8203;WorldTeacher](https://github.com/WorldTeacher)
- Feat/conversion CBX to EPUB compression configuration ([#&#8203;1844](booklore-app/booklore#1844)) by [@&#8203;thvardhan](https://github.com/thvardhan)
- feat(opds): add series hierarchy ([#&#8203;1837](booklore-app/booklore#1837)) by [@&#8203;WorldTeacher](https://github.com/WorldTeacher)

#### 🎨 UI Tweaks

- fix: Bookdrop UI mobile support ([#&#8203;1911](booklore-app/booklore#1911)) by [@&#8203;Muppetteer](https://github.com/Muppetteer)
- fix: Consistent dialogs ([#&#8203;1842](booklore-app/booklore#1842)) by [@&#8203;Muppetteer](https://github.com/Muppetteer)

#### 🐛 Bug Fixes

- fix: Library icon name bug ([#&#8203;1934](booklore-app/booklore#1934)) by [@&#8203;Muppetteer](https://github.com/Muppetteer)
- fix: bookdrop bulk actions not applying to uncached pages ([#&#8203;1928](booklore-app/booklore#1928)) by [@&#8203;CounterClops](https://github.com/CounterClops)
- fix: file renaming with wrong extension ([#&#8203;1929](booklore-app/booklore#1929)) by [@&#8203;CounterClops](https://github.com/CounterClops)
- fix(FileService): update User-Agent header for ComicVine to let the Parser through ([#&#8203;1880](booklore-app/booklore#1880)) by [@&#8203;balazs-szucs](https://github.com/balazs-szucs)
- fix(ui): Force page reload on logout ([#&#8203;1870](booklore-app/booklore#1870)) by [@&#8203;Muppetteer](https://github.com/Muppetteer)

#### 🛠️ Refactoring & Maintenance

- refactor(fb2, misc): Improve code quality, update to modern Java patterns, add reasonable initial values for StringBuilders ([#&#8203;1932](booklore-app/booklore#1932)) by [@&#8203;balazs-szucs](https://github.com/balazs-szucs)

#### 📦 Dependencies

- Upgrade Angular from v20 to v21 and update other dependencies ([#&#8203;1916](booklore-app/booklore#1916)) by [@&#8203;acx10](https://github.com/acx10)
- chore(deps): bump docker/login-action from 2 to 3 ([#&#8203;1908](booklore-app/booklore#1908)) by @&#8203;[dependabot\[bot\]](https://github.com/apps/dependabot)
- chore(deps): update actions/setup-java action to v5 ([#&#8203;1871](booklore-app/booklore#1871)) by @&#8203;[renovate\[bot\]](https://github.com/apps/renovate)
- chore(deps): update actions/upload-artifact action to v6 ([#&#8203;1872](booklore-app/booklore#1872)) by @&#8203;[renovate\[bot\]](https://github.com/apps/renovate)
- chore(deps): update actions/checkout action to v6 ([#&#8203;1869](booklore-app/booklore#1869)) by @&#8203;[renovate\[bot\]](https://github.com/apps/renovate)
- chore(deps): update dependency org.flywaydb:flyway-mysql to v11.19.0 ([#&#8203;1868](booklore-app/booklore#1868)) by @&#8203;[renovate\[bot\]](https://github.com/apps/renovate)
- chore(deps): update dependency org.apache.commons:commons-text to v1.15.0 ([#&#8203;1865](booklore-app/booklore#1865)) by @&#8203;[renovate\[bot\]](https://github.com/apps/renovate)
- chore(deps): update lscr.io/linuxserver/mariadb docker tag to v11.4.8 ([#&#8203;1862](booklore-app/booklore#1862)) by @&#8203;[renovate\[bot\]](https://github.com/apps/renovate)
- chore(deps): update dependency org.freemarker:freemarker to v2.3.34 ([#&#8203;1861](booklore-app/booklore#1861)) by @&#8203;[renovate\[bot\]](https://github.com/apps/renovate)
- chore(deps): update dependency org.assertj:assertj-core to v3.27.6 ([#&#8203;1859](booklore-app/booklore#1859)) by @&#8203;[renovate\[bot\]](https://github.com/apps/renovate)
- chore(deps): update dependency gradle to v8.14.3 ([#&#8203;1858](booklore-app/booklore#1858)) by @&#8203;[renovate\[bot\]](https://github.com/apps/renovate)

#### ⚙️ CI/CD

- Add Flyway migration conflict detection in CI ([#&#8203;1888](booklore-app/booklore#1888)) by [@&#8203;acx10](https://github.com/acx10)
- Speed up CI builds by introducing dependency caching ([#&#8203;1874](booklore-app/booklore#1874)) by [@&#8203;acx10](https://github.com/acx10)
- Add Flyway migration version conflict check in GitHub Actions ([#&#8203;1863](booklore-app/booklore#1863)) by [@&#8203;acx10](https://github.com/acx10)

##### 🐳 Docker Images

- **Docker Hub:** `booklore/booklore:v1.15.0`
- **GitHub Container Registry:** `ghcr.io/booklore-app/booklore:v1.15.0`

**Full Changelog**: <booklore-app/booklore@v1.14.1...v1.15.0>

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0Mi4zOS4xIiwidXBkYXRlZEluVmVyIjoiNDIuMzkuMSIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOlsiaW1hZ2UiXX0=-->

Reviewed-on: https://gitea.alexlebens.dev/alexlebens/infrastructure/pulls/2735
Co-authored-by: Renovate Bot <renovate-bot@alexlebens.net>
Co-committed-by: Renovate Bot <renovate-bot@alexlebens.net>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci CI/CD related changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants