Bundle GitLab Query Language (GLQL) with GitLab's Frontend via WebAssembly (WASI) Module
Summary
GitLab Query Language (GLQL) is an experimental attempt to create a single query language for all of GitLab which allows for filtering and embedding content from anywhere in the product.
A video demo and slides describing the language and technical approach are available in https://gitlab.com/gitlab-org/gitlab/-/issues/437935+.
glql
is also the name of the command-line utility which translates GLQL queries into other formats; such as GraphQL, URL Params, and GitLab triage syntax. Builds are available for Linux, Mac OSX and, now, WebAssembly (for use with WASI).
If successful, when this work is complete, any Vue component will be able to translate a GLQL query into another target format. This will allow for the fast, secure implementation of GLQL-based features across the GitLab application; such as issue filtering, embedding in Markdown, saved queries, etc.
Proposal
Bundle the new WebAssembly build with GitLab's frontend.
This is very experimental work. The module may be too large and require refactoring. There may be instability or performance issues when actually using the module.
However, in principle, this is quite straightforward.
- Package the latest (nightly) build for inclusion in the frontend build system.
- Implement the inclusion and ship the module in GitLab.
- Include a suitable browser shim for running WASI modules in the browser (e.g. https://github.com/bjorn3/browser_wasi_shim).
- Write a simple interface that wraps the shim and provides an interface for Vue components to translate GLQL queries into another format.
How to get started
glql
is still in rapid development but stable builds are available.
-
Recent build are always available from the main branch in the project's Artifacts page.
-
A relatively early build is available here, some language features are unavailable/broken:
glql
takes target and script via command line arguments like so:
glql -t graphql -s "weight = 1 and project = \"gitlab-org/gitlab\""
and returns JSON with a key output
containing the requested format:
query {
project(fullPath:"gitlab-org/gitlab") {
issues(weight:1) {
nodes {
type
id
iid
title
createdAt
webUrl
labels {
nodes {
title
}
}
}
pageInfo {
endCursor
hasNextPage
}
}
}
}
The WASI standard allows these same command line arguments to be passed to the WebAssembly module. So GLQL queries can simply be quote-escaped and sent as arguments to the GLQL WASM module.