feat: add mysql-crud sample for Enterprise self-hosted CI#145
Open
pathakharshit wants to merge 2 commits into
Open
feat: add mysql-crud sample for Enterprise self-hosted CI#145pathakharshit wants to merge 2 commits into
pathakharshit wants to merge 2 commits into
Conversation
A minimal Spring Boot + JDBC CRUD app (users/orders, health, stats) backed by MySQL 8, used by keploy/enterprise's self-hosted cloud-replay E2E pipeline to exercise JDBC-manifest secret obfuscation and object-storage mock upload/download against a real database — not a mock or in-memory backend. See keploy/enterprise#2200.
There was a problem hiding this comment.
Pull request overview
Adds a new mysql-crud sample application to this repository so Keploy Enterprise self-hosted CI can clone it as a pinned dependency and exercise JDBC-URL secret obfuscation plus MySQL 8 traffic recording/replay paths.
Changes:
- Added a new Spring Boot 3 +
JdbcTemplateCRUD sample with/health,/users,/users/{id},/users/{id}/orders, and/statsendpoints. - Added MySQL initialization scripts (
schema.sql,data.sql) and env-driven datasource configuration. - Added build/deploy assets for the sample (Maven
pom.xml, Dockerfile, module README,.gitignore) and linked it from the repo root README.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| README.md | Adds mysql-crud to the catalog of Java samples. |
| mysql-crud/src/main/resources/schema.sql | Creates users, orders, and audit_log tables. |
| mysql-crud/src/main/resources/data.sql | Seeds initial users and orders rows. |
| mysql-crud/src/main/resources/application.properties | Env-driven MySQL JDBC config + SQL init + Hikari timeouts. |
| mysql-crud/src/main/java/com/keploy/sample/Application.java | Spring Boot entrypoint for the new sample. |
| mysql-crud/src/main/java/com/keploy/sample/ApiController.java | Implements the HTTP endpoints backed by JdbcTemplate. |
| mysql-crud/README.md | Documents endpoints, configuration, MySQL auth-plugin note, and run instructions. |
| mysql-crud/pom.xml | Declares Spring Boot Web/JDBC + MySQL connector dependencies and build output name. |
| mysql-crud/Dockerfile | Multi-stage build to produce/run app.jar in a JRE base image. |
| mysql-crud/.gitignore | Ignores Maven target/ and log files for the module. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…ct orders for missing users LAST_INSERT_ID() is connection-scoped; a pooled JdbcTemplate follow-up call can land on a different physical connection than the INSERT and return the wrong id (or null). Use KeyHolder to read the generated key from the same statement/connection as the insert. createOrder also inserted into orders even when the target user did not exist, creating orphaned rows (no FK constraint) and a misleading 200 response. Now returns 404 before inserting. Verified locally end-to-end against a real mysql:8.0 container: createUser returns the correct row for its generated id, createOrder returns the correct order for its generated id, and a 999 (nonexistent user) orders request 404s with zero rows written. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds
mysql-crud— a minimal Spring Boot + JDBC CRUD sample (users/orders, health, stats) backed by MySQL 8.Why
keploy/enterprise's self-hosted cloud-replay E2E pipeline (keploy/enterprise#2200) needs a Java app that:jdbc:mysql://...datasource URL, to exercise the JDBC-specific secret-obfuscation code path (only triggered by thejdbc:prefix — distinct from generic MySQL wire-protocol handling)This app previously lived inline in the
enterpriserepo's.ci/directory, which doesn't match this org's convention (samples belong here, referenced by pinned-commitgit clone— seeaerospike-e2e.yml's use ofsamples-goandjava-linux.yml's use ofspring-petclinic). Moving it here soenterprise's pipeline can clone it like every other sample-app dependency.Endpoints
GET /health,GET /users,GET /users/{id},POST /users,POST /users/{id}/orders,GET /statsNotes
caching_sha2_passwordvsmysql_native_passwordMySQL 8 auth-plugin gotcha (Keploy's MySQL recorder can't parse thecaching_sha2_passwordhandshake) for anyone running this against their own MySQL container.mvn clean package -DskipTestsbuilds cleanly; verified locally.Test plan
keploy/enterprise#2200clones this sample (pinned to this branch/commit until merge) and its E2E lane runs green