-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: run notebooks in data service (#375)
Co-authored-by: Samuel Gaist <[email protected]> squashme: resolve package version conflicts
- Loading branch information
Showing
65 changed files
with
6,602 additions
and
1,324 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
name: Create cache from commits on main | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
- chore-add-kind | ||
workflow_dispatch: | ||
|
||
|
||
jobs: | ||
save-poetry-cache: | ||
runs-on: ubuntu-latest | ||
env: | ||
CACHE_KEY: main-branch-poetry-cache-ubuntu | ||
CACHE_PATH: .devcontainer/.poetry_cache | ||
DEVCONTAINER_IMAGE_CACHE: ghcr.io/swissdatasciencecenter/renku-data-services/devcontainer | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
- name: Login to Docker Hub | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Install python deps | ||
uses: devcontainers/[email protected] | ||
with: | ||
runCmd: poetry install --with dev | ||
push: always | ||
skipContainerUserIdUpdate: false | ||
imageName: ${{ env.DEVCONTAINER_IMAGE_CACHE }} | ||
cacheFrom: ${{ env.DEVCONTAINER_IMAGE_CACHE }} | ||
- uses: actions/cache/save@v3 | ||
name: Create cache | ||
with: | ||
path: ${{ env.CACHE_PATH }} | ||
key: ${{ env.CACHE_KEY }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,7 @@ | |
from typing import Optional | ||
|
||
from sanic import Request | ||
from ulid import ULID | ||
|
||
import renku_data_services.base_models as base_models | ||
|
||
|
@@ -39,10 +40,22 @@ class DummyAuthenticator: | |
""" | ||
|
||
token_field = "Authorization" # nosec: B105 | ||
anon_id_header_key: str = "Renku-Auth-Anon-Id" | ||
anon_id_cookie_name: str = "Renku-Auth-Anon-Id" | ||
|
||
@staticmethod | ||
async def authenticate(access_token: str, request: Request) -> base_models.APIUser: | ||
async def authenticate(self, access_token: str, request: Request) -> base_models.APIUser: | ||
"""Indicates whether the user has successfully logged in.""" | ||
access_token = request.headers.get(self.token_field) or "" | ||
if not access_token or len(access_token) == 0: | ||
# Try to get an anonymous user ID if the validation of keycloak credentials failed | ||
anon_id = request.headers.get(self.anon_id_header_key) | ||
if anon_id is None: | ||
anon_id = request.cookies.get(self.anon_id_cookie_name) | ||
if anon_id is None: | ||
anon_id = f"anon-{str(ULID())}" | ||
return base_models.AnonymousAPIUser(id=str(anon_id)) | ||
|
||
access_token = access_token.removeprefix("Bearer ").removeprefix("bearer ") | ||
user_props = {} | ||
with contextlib.suppress(Exception): | ||
user_props = json.loads(access_token) | ||
|
@@ -64,4 +77,5 @@ async def authenticate(access_token: str, request: Request) -> base_models.APIUs | |
last_name=user_props.get("last_name", "Doe") if is_set else None, | ||
email=user_props.get("email", "[email protected]") if is_set else None, | ||
full_name=user_props.get("full_name", "John Doe") if is_set else None, | ||
refresh_token=request.headers.get("Renku-Auth-Refresh-Token"), | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.