Spike: PoC Move GLQL to backend
What does this MR do and why?
PoC to demonstrate how the GLQL Rust compiler could be moved to the backend and invoked from Rails through FFI ( requires gitlab-org/gitlab-query-language/glql-rust!147)
Related to Move Rust version of GLQL to the backend (&15834)
References
Needs gitlab-org/gitlab-query-language/glql-rust!147
- In the
glql-rustproject repo, pull changes from gitlab-org/gitlab-query-language/glql-rust!147 - Built the library
cargo build --release - Link it locally
ln -s PATH_TO_GLQL_RUST/target PATH_TO_GDK/gitlab/lib/glql-rust/
To test, pull these changes and hit the https://gdk.test:3443/api/glql as below:
curl 'https://gdk.test:3443/api/glql' \
--get \
--data-urlencode "username=root" \
--data-urlencode "project=flightjs/Flight" \
--data-urlencode "glqlQuery=assignee = currentUser() and type = issue" | jq
{
"result": {
"version": "0.7.0",
"output": "query GLQL {\n project(fullPath: \"flightjs/Flight\") {\n workItems(assigneeUsernames: \"root\", types: ISSUE, first: 100) {\n nodes {\n id\n iid\n }\n pageInfo {\n startCursor\n endCursor\n hasNextPage\n hasPreviousPage\n }\n }\n }\n}\n",
"success": true
},
"log": "Hello from Rust! Processed query: assignee = currentUser() and type = issue",
"output": "query GLQL {\n project ..... }",
"data": {
"project": {
"workItems": {
"nodes": [
{
"id": "gid://gitlab/WorkItem/1095",
"iid": "60"
},
{
"id": "gid://gitlab/WorkItem/834",
"iid": "50"
}
],
"pageInfo": {
.....
}
}
}
}
}
curl 'https://gdk.test:3443/api/glql' \
--get \
--data-urlencode "project=flightjs/Flight" \
--data-urlencode "username=root" \
--data-urlencode "glqlQuery=assignee = currentUser() and type = testcase" | jq
{
"result": {
"version": "0.7.0",
"output": "{\"finder_params\":{\"where\":{\"assignee\":\"foo-bar\",\"type\":\"TESTCASE\"}}}",
"success": true
},
"log": "Hello from Rust! Processed query: assignee = currentUser() and type = testcase",
"output": {
"finder_params": {
"where": {
"assignee": "root",
"type": "TESTCASE"
}
}
}
}
curl 'https://gdk.test:3443/api/glql' \
--get \
--data-urlencode "project=flightjs/Flight" \
--data-urlencode "username=root" \
--data-urlencode "glqlQuery=assignee = currentUser() and type = incident" | jq
{
"result": {
"version": "0.7.0",
"output": "{\"body\":{\"foo\":\"bar\"},\"method\":\"POST\",\"path\":\"/api/v4/testendpoint\"}",
"success": true
},
"log": "Hello from Rust! Processed query: assignee = currentUser() and type = incident",
"output": {
"body": {
"foo": "bar"
},
"method": "POST",
"path": "/api/v4/testendpoint"
}
}
Screenshots or screen recordings
| Before | After |
|---|---|
How to set up and validate locally
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Edited by Daniele Rossetti