Skip to content

Commit e9573f8

Browse files
committed
Add markdownlint-cli2 pre-commit hook
Use the same tool as VSCode for ease of configuring the same rules for both the editor and CI tooling
1 parent 95c0ea2 commit e9573f8

7 files changed

Lines changed: 171 additions & 16 deletions

File tree

.markdownlint.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"MD013": false,
3+
"MD007": {
4+
"indent": 3
5+
}
6+
}

.pre-commit-config.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,8 @@ repos:
2020
rev: v0.11.0
2121
hooks:
2222
- id: shellcheck
23+
- repo: https://github.com/DavidAnson/markdownlint-cli2
24+
rev: v0.15.0
25+
hooks:
26+
- id: markdownlint-cli2-docker
27+
exclude: '^(?:\.github|docs)(?:/|$)'

AGENTS.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,12 @@ common developer tasks.
4141

4242
- When creating pull requests:
4343

44-
1. **Read the current PR template**: Always check `.github/PULL_REQUEST_TEMPLATE.md` for the latest format
45-
2. **Follow PR title conventions**: Use [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/)
46-
- Format: `type(scope): description`
47-
- Example: `fix(warehouse/accelerator): fix join in model`
48-
- Types: `fix`, `feat`, `docs`, `style`, `refactor`, `perf`, `test`, `chore`
44+
1. **Read the current PR template**: Always check `.github/PULL_REQUEST_TEMPLATE.md` for the latest format
45+
46+
2. **Follow PR title conventions**: Use [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/)
47+
- Format: `type(scope): description`
48+
- Example: `fix(warehouse/accelerator): fix join in model`
49+
- Types: `fix`, `feat`, `docs`, `style`, `refactor`, `perf`, `test`, `chore`
4950

5051
**Important**: Always reference the actual template file at `.github/PULL_REQUEST_TEMPLATE.md` instead of using cached content, as the template may be updated over time.
5152

docs-devel/data-architecture/catalogs.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@ This page describes the catalogs that exist within the ISIS Lakehouse.
55
## Index
66

77
- `accelerator`: Provides data for analysis of accelerator operations.
8-
- **bronze layer**: All schemas beginning with the prefix `src_`.
9-
- **silver layer**: All schemas beginning with the prefix `analytics_`.
8+
- **bronze layer**: All schemas beginning with the prefix `src_`.
9+
- **silver layer**: All schemas beginning with the prefix `analytics_`.

elt-common/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ rest catalog to test complete functionality.
3636
The local, docker-compose-based configuration provided by
3737
[infra/local/docker-compose.yml](../infra/local/docker-compose.yml) is the easiest way to
3838
spin up a set of services compatible with running the tests.
39-
_Note the requirement to edit `/etc/hosts` described in [here](../infra/local/README.md)._
39+
_Note the requirement to edit `/etc/hosts` described in [infra/local/README](../infra/local/README.md)._
4040

4141
Once the compose services are running, execute the e2e tests using `pytest`:
4242

infra/local/README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,11 @@ docker compose up -d
4848

4949
Services:
5050

51-
- Keycloak identity provider: http://localhost:50080/auth
52-
- `master` realm credentials: _admin/admin_
53-
- `analytics-data-platform` realm credentials: _adpsuperuser/adppassword_
54-
- Lakekeeper iceberg catalog UI: http://localhost:50080/iceberg/ui.
55-
- Use the same credentials as the `analytics-data-platform` realm
56-
- Superset BI tool: http://localhost:50080/workspace/playground.
57-
- Use the same credentials as the `analytics-data-platform` realm
58-
- Trino endpoint: https://localhost:58443 (note the https as this is required by Trino. You may need to use an "--insecure" flag)
51+
- Keycloak identity provider: <http://localhost:50080/auth>
52+
- `master` realm credentials: *admin/admin*
53+
- `analytics-data-platform` realm credentials: *adpsuperuser/adppassword*
54+
- Lakekeeper iceberg catalog UI: <http://localhost:50080/iceberg/ui>.
55+
- Use the same credentials as the `analytics-data-platform` realm
56+
- Superset BI tool: <http://localhost:50080/workspace/playground>.
57+
- Use the same credentials as the `analytics-data-platform` realm
58+
- Trino endpoint: <https://localhost:58443> (note the https as this is required by Trino. You may need to use an "--insecure" flag)

infra/scripts/lakekeeper.py

Lines changed: 143 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,143 @@
1+
# /// script
2+
# requires-python = "==3.13.*"
3+
# dependencies = [
4+
# "authlib~=1.6.6",
5+
# "click~=8.3.0",
6+
# "requests~=2.32.5",
7+
# ]
8+
# ///
9+
"""Provides a set of commands for interacting with a Lakekeeper instance
10+
11+
Note: This script is used by both local, dev deployments and the ansible scripts.
12+
"""
13+
14+
from collections import namedtuple
15+
import dataclasses
16+
import json
17+
from pathlib import Path
18+
import logging
19+
from typing import Any, Dict, Callable, Iterable, Sequence
20+
21+
from authlib.integrations.requests_client import OAuth2Session
22+
import click
23+
import requests
24+
25+
LOGGER = logging.getLogger(__name__)
26+
LOGGER_FILENAME = f"{Path(__file__).name}.log"
27+
LOGGER_FORMAT = "%(asctime)s|%(message)s"
28+
29+
OPENID_SCOPE_DEFAULT = "openid profile"
30+
REQUESTS_TIMEOUT_DEFAULT = 60.0
31+
REQUESTS_DEFAULT_KWARGS: Dict[str, Any] = {
32+
"timeout": REQUESTS_TIMEOUT_DEFAULT,
33+
}
34+
35+
36+
def create_oauth2_session(
37+
token_endpoint: str,
38+
client_id: str,
39+
client_secret: str,
40+
scope: str = OPENID_SCOPE_DEFAULT,
41+
) -> OAuth2Session:
42+
"""Create an requests.Session that is able to request and inject
43+
a token for authentication
44+
45+
Args:
46+
token_endpoint: URL of auth serve token endpoint
47+
client_id: The client ID for authentication
48+
client_secret: The client secret for authentication
49+
scope: The requested scope (default: "openid profile")
50+
51+
Returns:
52+
The new OAuth2Session
53+
"""
54+
55+
return OAuth2Session(
56+
token_endpoint=token_endpoint,
57+
client_id=client_id,
58+
client_secret=client_secret,
59+
scope=scope,
60+
)
61+
62+
63+
class LakekeeperRestV1:
64+
def __init__(
65+
self,
66+
server_url: str,
67+
openid_provider_url: str,
68+
client_id: str,
69+
client_secret: str,
70+
scope: str,
71+
) -> None:
72+
"""
73+
Args:
74+
75+
server_url: URL for Lakekeeper instance
76+
"""
77+
self._server_url = server_url
78+
openid_config_resp = requests.get(
79+
openid_provider_url + "/.well-known/openid-configuration"
80+
)
81+
openid_config_resp.raise_for_status()
82+
self._session = create_oauth2_session(
83+
openid_config_resp.json()["token_endpoint"],
84+
client_id,
85+
client_secret,
86+
scope=f"{OPENID_SCOPE_DEFAULT} {scope}",
87+
)
88+
89+
@property
90+
def catalog_url(self) -> str:
91+
return self.server_url + "/catalog/v1"
92+
93+
@property
94+
def management_url(self) -> str:
95+
return self.server_url + "/management/v1"
96+
97+
@property
98+
def server_url(self) -> str:
99+
return self._server_url
100+
101+
def bootstrap(self):
102+
"""Bootstrap the lakekeeper instance using the given access_token.
103+
104+
Raises an excception if bootstrapping is unsuccessful."""
105+
if self.is_bootstrapped():
106+
LOGGER.info("Server already bootstrapped. Skipping bootstrap step.")
107+
return
108+
109+
LOGGER.info("Bootstrapping server.")
110+
response = self._session.request(
111+
"POST",
112+
self.management_url + "/bootstrap",
113+
json={
114+
"accept-terms-of-use": True,
115+
"is-operator": True,
116+
},
117+
)
118+
response.raise_for_status()
119+
LOGGER.info("Server bootstrapped successfully.")
120+
121+
def is_bootstrapped(self) -> bool:
122+
response = self._session.request("GET", self.management_url + "/info")
123+
response.raise_for_status()
124+
return response.json()["bootstrapped"]
125+
126+
127+
def main():
128+
pass
129+
130+
131+
# session = create_oauth2_session(
132+
# "http://localhost:50080/auth/realms/analytics-data-platform/protocol/openid-connect/token",
133+
# "machine-infra",
134+
# "s3cr3t",
135+
# scope=f"{OPENID_SCOPE_DEFAULT} lakekeeper",
136+
# )
137+
# session.fetch_token()
138+
# resp = session.request("GET", "http://localhost:50080/iceberg/management/v1/info")
139+
# resp.raise_for_status()
140+
# print(resp.json())
141+
142+
if __name__ == "__main__":
143+
main()

0 commit comments

Comments
 (0)