https://lakefs.io/ logo
#dev
Title
# dev
g

Giuseppe Barbieri

01/23/2024, 10:19 AM
would you consider adding Kotlin scripts for Hooks?
l

Lynn Rozen

01/23/2024, 11:14 AM
Hi @Giuseppe Barbieri, it's not on the roadmap for now. Could you please open a issue?
g

Giuseppe Barbieri

01/23/2024, 12:08 PM
sure, no problem
e

einat.orr

01/23/2024, 12:20 PM
You are welcome to contribute the code @Giuseppe Barbieri
👍 1
g

Giuseppe Barbieri

01/23/2024, 12:36 PM
I'd love, but I don't even know where to start from, I'd need some inputs for that
b

Barak Amar

01/23/2024, 12:57 PM
Not something that I tested, but it looks like a valid alternative you can start using now - https://ktor.io/ and use lakefs hooks to trigger your code
👍 3
g

Giuseppe Barbieri

01/26/2024, 9:50 AM
this shall be triggered via a webhook, right?
b

Barak Amar

01/26/2024, 9:52 AM
yes, you can use https://docs.lakefs.io/howto/hooks/webhooks.html or Lua if you need more control
g

Giuseppe Barbieri

01/26/2024, 10:53 AM
sorry, but I'm having issues trying to understand where the logic is executed let's look for example at this example, that ensures only parquet files are allowed on a merge on
master
, it will generate a POST to
http://<host:port>/webhooks/format
like
Copy code
{
  "event_type": "pre-merge",
  "event_time": "..",
  "action_name": "ParquetOnlyInProduction",
  "hook_id": "production_format_validator",
  "repository_id": "repo1",
  "branch_id": "branch1",
  "source_ref": "branch1",
  "commit_message": "commit message",
  "committer": "committer",
  "commit_metadata": {
    "key": "value"
  }
}
the server receive that POST and then? How can it check if there are only parquet files?
b

Barak Amar

01/26/2024, 11:25 AM
Good example. The hook implementation uses lakefs API to list the changes and block the change as needed.
g

Giuseppe Barbieri

01/26/2024, 11:27 AM
could you elaborate?
b

Barak Amar

01/26/2024, 11:56 AM
https://github.com/treeverse/lakeFS-hooks/blob/01a70e297bb291068f23c0b2367711b5973b2eb8/server.py#L27 the link to the example, check the web hook "format" handler. it uses lakefs API to query the data it validates.
I assume you will want to implement the same using kotlin in your case.