Add /submitartifacts multipart upload endpoint#66
Add /submitartifacts multipart upload endpoint#66nuclearcat wants to merge 1 commit intokernelci:mainfrom
Conversation
a85bce6 to
817f77b
Compare
Add new endpoint to accept artifacts uploads via multipart and store them under <spool>/artifacts. Signed-off-by: Denys Fedoryshchenko <denys.f@collabora.com>
817f77b to
6fb5cf7
Compare
There was a problem hiding this comment.
Pull request overview
Adds a new multipart upload endpoint to the Rust REST receiver to accept and spool “artifact” uploads and return a derived storage URL.
Changes:
- Add
POST /submitartifactsroute and handler that parses multipart form data, validates fields, and writes an artifact file to<spool>/artifacts/. - Add filename/origin/submission_id validation helpers plus a JSON response type for artifact uploads.
- Document the new endpoint in
README.mdand enable Axum’smultipartfeature inCargo.toml.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
kcidb-restd-rs/src/main.rs |
Adds /submitartifacts route + multipart handler and validation/util helpers. |
kcidb-restd-rs/README.md |
Documents /submit and new /submitartifacts usage and responses. |
kcidb-restd-rs/Cargo.toml |
Enables Axum multipart support for the new endpoint. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| return (StatusCode::BAD_REQUEST, err_json); | ||
| } | ||
| }; | ||
| let file_bytes = match file_bytes { |
There was a problem hiding this comment.
normalize_log_filename is called here but is not defined anywhere in this crate (search only finds this call), which will fail compilation. Either implement normalize_log_filename or remove the call and use sanitized directly (and drop normalized_name if not needed).
| let app = Router::new() | ||
| .route("/", get(handle_root)) | ||
| .route("/submit", post(receive_submission)) | ||
| .route("/submitartifacts", post(receive_artifacts)) |
There was a problem hiding this comment.
There is existing test coverage for the REST API in kcidb-restd-rs/tests/test_rest.sh, but it doesn’t exercise the new /submitartifacts endpoint (success + key error cases like missing fields/unauthorized/conflict). Please add coverage so regressions in multipart parsing and file handling are caught.
Add /submitartifacts endpoint for easier storage operation