Skip to content

Commit e7617bf

Browse files
authored
Merge branch 'master' into pr-osparc-dynamic-scheduler-monitoring-dashboard-mount-point
2 parents ead097f + 3960405 commit e7617bf

File tree

101 files changed

+5206
-3194
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

101 files changed

+5206
-3194
lines changed

.github/workflows/ci-testing-deploy.yml

Lines changed: 0 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -2661,84 +2661,3 @@ jobs:
26612661
env:
26622662
TAG_PREFIX: hotfix-staging-github
26632663
run: ./ci/deploy/dockerhub-deploy.bash -n
2664-
2665-
system-api-specs:
2666-
needs: [changes]
2667-
if: ${{ needs.changes.outputs.anything-py == 'true' || github.event_name == 'push' }}
2668-
timeout-minutes: 10
2669-
name: "[sys] check api-specs are up to date"
2670-
runs-on: ubuntu-latest
2671-
steps:
2672-
- name: Ensure job passes if not PR # ensure pass so upstream jobs which depend on this will run (dockerhub deployment)
2673-
if: ${{ github.event.pull_request == null }}
2674-
run: echo "::notice Passing job because not in PR"; exit 0
2675-
- name: setup python environment
2676-
uses: actions/setup-python@v5
2677-
with:
2678-
python-version: "3.11"
2679-
- name: install uv
2680-
uses: astral-sh/setup-uv@v4
2681-
with:
2682-
version: "0.4.x"
2683-
enable-cache: false
2684-
- name: checkout source branch
2685-
uses: actions/checkout@v4
2686-
- name: Regenerate specs and check
2687-
run: |
2688-
uv venv .venv && source .venv/bin/activate
2689-
make openapi-specs
2690-
./ci/github/helpers/openapi-specs-diff.bash diff \
2691-
https://raw.githubusercontent.com/${{ github.event.pull_request.head.repo.full_name }}/refs/heads/${{ github.event.pull_request.head.ref }} \
2692-
.
2693-
2694-
system-backwards-compatibility:
2695-
needs: [changes, system-api-specs]
2696-
if: ${{ needs.changes.outputs.anything-py == 'true' || github.event_name == 'push' }}
2697-
timeout-minutes: 10
2698-
name: "[sys] api-server backwards compatibility"
2699-
runs-on: ubuntu-latest
2700-
steps:
2701-
- name: Ensure job passes if not PR # ensure pass so upstream jobs which depend on this will run (dockerhub deployment)
2702-
if: ${{ github.event.pull_request == null }}
2703-
run: echo "::notice Passing job because not in PR"; exit 0
2704-
- name: setup python environment
2705-
uses: actions/setup-python@v5
2706-
with:
2707-
python-version: "3.11"
2708-
- name: install uv
2709-
uses: astral-sh/setup-uv@v4
2710-
with:
2711-
version: "0.4.x"
2712-
enable-cache: false
2713-
- name: checkout
2714-
uses: actions/checkout@v4
2715-
- name: check api-server backwards compatibility
2716-
run: |
2717-
./scripts/openapi-diff.bash breaking --fail-on ERR\
2718-
https://raw.githubusercontent.com/${{ github.event.pull_request.base.repo.full_name }}/refs/heads/${{ github.event.pull_request.base.ref }}/services/api-server/openapi.json \
2719-
/specs/services/api-server/openapi.json
2720-
2721-
api-spec-backwards-compatibility:
2722-
needs: [changes, system-api-specs]
2723-
if: ${{ needs.changes.outputs.anything-py == 'true' && github.event_name == 'push' && github.event.pull_request != null }}
2724-
continue-on-error: true
2725-
timeout-minutes: 10
2726-
name: "api-specs-backwards-compatibility"
2727-
runs-on: ubuntu-latest
2728-
steps:
2729-
- name: setup python environment
2730-
uses: actions/setup-python@v5
2731-
with:
2732-
python-version: "3.11"
2733-
- name: install uv
2734-
uses: astral-sh/setup-uv@v4
2735-
with:
2736-
version: "0.4.x"
2737-
enable-cache: false
2738-
- name: checkout
2739-
uses: actions/checkout@v4
2740-
- name: Check openapi-specs backwards compatibility
2741-
run: |
2742-
./ci/github/helpers/openapi-specs-diff.bash breaking \
2743-
https://raw.githubusercontent.com/${{ github.event.pull_request.base.repo.full_name }}/refs/heads/${{ github.event.pull_request.base.ref }} \
2744-
.
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
# This workflow holds jobs which are required to pass before merging into master
2+
3+
name: PR CI
4+
on:
5+
pull_request:
6+
branches:
7+
- "*"
8+
# https://github.blog/changelog/2023-02-08-pull-request-merge-queue-public-beta/
9+
merge_group:
10+
branches:
11+
- "master"
12+
13+
concurrency:
14+
group: ${{ github.workflow }}-${{ github.ref }}
15+
cancel-in-progress: true
16+
17+
jobs:
18+
api-specs:
19+
timeout-minutes: 10
20+
name: "check OAS' are up to date"
21+
runs-on: ubuntu-latest
22+
steps:
23+
- name: setup python environment
24+
uses: actions/setup-python@v5
25+
with:
26+
python-version: "3.11"
27+
- name: install uv
28+
uses: astral-sh/setup-uv@v4
29+
with:
30+
version: "0.4.x"
31+
enable-cache: false
32+
- name: checkout source branch
33+
uses: actions/checkout@v4
34+
- name: Regenerate specs and check
35+
run: |
36+
uv venv .venv && source .venv/bin/activate
37+
make openapi-specs
38+
if ! ./ci/github/helpers/openapi-specs-diff.bash diff \
39+
https://raw.githubusercontent.com/${{ github.event.pull_request.head.repo.full_name }}/refs/heads/${{ github.event.pull_request.head.ref }} \
40+
.; then \
41+
echo "::error:: OAS are not up to date. Run 'make openapi-specs' to update them"; exit 1; \
42+
fi
43+
44+
api-server-oas-breaking:
45+
needs: api-specs
46+
timeout-minutes: 10
47+
name: "api-server backwards compatibility"
48+
runs-on: ubuntu-latest
49+
steps:
50+
- name: setup python environment
51+
uses: actions/setup-python@v5
52+
with:
53+
python-version: "3.11"
54+
- name: install uv
55+
uses: astral-sh/setup-uv@v4
56+
with:
57+
version: "0.4.x"
58+
enable-cache: false
59+
- name: checkout
60+
uses: actions/checkout@v4
61+
- name: check api-server backwards compatibility
62+
run: |
63+
./scripts/openapi-diff.bash breaking --fail-on ERR\
64+
https://raw.githubusercontent.com/${{ github.event.pull_request.base.repo.full_name }}/refs/heads/${{ github.event.pull_request.base.ref }}/services/api-server/openapi.json \
65+
/specs/services/api-server/openapi.json
66+
67+
all-oas-breaking:
68+
needs: api-specs
69+
continue-on-error: true
70+
timeout-minutes: 10
71+
name: "OAS backwards compatibility"
72+
runs-on: ubuntu-latest
73+
steps:
74+
- name: setup python environment
75+
uses: actions/setup-python@v5
76+
with:
77+
python-version: "3.11"
78+
- name: install uv
79+
uses: astral-sh/setup-uv@v4
80+
with:
81+
version: "0.4.x"
82+
enable-cache: false
83+
- name: checkout
84+
uses: actions/checkout@v4
85+
- name: Check openapi-specs backwards compatibility
86+
run: |
87+
./ci/github/helpers/openapi-specs-diff.bash breaking \
88+
https://raw.githubusercontent.com/${{ github.event.pull_request.base.repo.full_name }}/refs/heads/${{ github.event.pull_request.base.ref }} \
89+
.

api/specs/web-server/_auth.py

Lines changed: 0 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@
99
from fastapi import APIRouter, status
1010
from models_library.api_schemas_webserver.auth import (
1111
AccountRequestInfo,
12-
ApiKeyCreate,
13-
ApiKeyGet,
1412
UnregisterCheck,
1513
)
1614
from models_library.generics import Envelope
@@ -264,72 +262,6 @@ async def email_confirmation(code: str):
264262
"""email link sent to user to confirm an action"""
265263

266264

267-
@router.get(
268-
"/auth/api-keys",
269-
operation_id="list_api_keys",
270-
responses={
271-
status.HTTP_200_OK: {
272-
"description": "returns the display names of API keys",
273-
"model": list[str],
274-
},
275-
status.HTTP_400_BAD_REQUEST: {
276-
"description": "key name requested is invalid",
277-
},
278-
status.HTTP_401_UNAUTHORIZED: {
279-
"description": "requires login to list keys",
280-
},
281-
status.HTTP_403_FORBIDDEN: {
282-
"description": "not enough permissions to list keys",
283-
},
284-
},
285-
)
286-
async def list_api_keys():
287-
"""lists display names of API keys by this user"""
288-
289-
290-
@router.post(
291-
"/auth/api-keys",
292-
operation_id="create_api_key",
293-
responses={
294-
status.HTTP_200_OK: {
295-
"description": "Authorization granted returning API key",
296-
"model": ApiKeyGet,
297-
},
298-
status.HTTP_400_BAD_REQUEST: {
299-
"description": "key name requested is invalid",
300-
},
301-
status.HTTP_401_UNAUTHORIZED: {
302-
"description": "requires login to list keys",
303-
},
304-
status.HTTP_403_FORBIDDEN: {
305-
"description": "not enough permissions to list keys",
306-
},
307-
},
308-
)
309-
async def create_api_key(_body: ApiKeyCreate):
310-
"""creates API keys to access public API"""
311-
312-
313-
@router.delete(
314-
"/auth/api-keys",
315-
operation_id="delete_api_key",
316-
status_code=status.HTTP_204_NO_CONTENT,
317-
responses={
318-
status.HTTP_204_NO_CONTENT: {
319-
"description": "api key successfully deleted",
320-
},
321-
status.HTTP_401_UNAUTHORIZED: {
322-
"description": "requires login to delete a key",
323-
},
324-
status.HTTP_403_FORBIDDEN: {
325-
"description": "not enough permissions to delete a key",
326-
},
327-
},
328-
)
329-
async def delete_api_key(_body: ApiKeyCreate):
330-
"""deletes API key by name"""
331-
332-
333265
@router.get(
334266
"/auth/captcha",
335267
operation_id="request_captcha",
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
from typing import Annotated
2+
3+
from fastapi import APIRouter, Depends, status
4+
from models_library.api_schemas_webserver.auth import (
5+
ApiKeyCreateRequest,
6+
ApiKeyCreateResponse,
7+
ApiKeyGet,
8+
)
9+
from models_library.generics import Envelope
10+
from models_library.rest_error import EnvelopedError
11+
from simcore_service_webserver._meta import API_VTAG
12+
from simcore_service_webserver.api_keys._exceptions_handlers import _TO_HTTP_ERROR_MAP
13+
from simcore_service_webserver.api_keys._rest import ApiKeysPathParams
14+
15+
router = APIRouter(
16+
prefix=f"/{API_VTAG}",
17+
tags=["auth"],
18+
responses={
19+
i.status_code: {"model": EnvelopedError} for i in _TO_HTTP_ERROR_MAP.values()
20+
},
21+
)
22+
23+
24+
@router.post(
25+
"/auth/api-keys",
26+
operation_id="create_api_key",
27+
status_code=status.HTTP_201_CREATED,
28+
response_model=Envelope[ApiKeyCreateResponse],
29+
)
30+
async def create_api_key(_body: ApiKeyCreateRequest):
31+
"""creates API keys to access public API"""
32+
33+
34+
@router.get(
35+
"/auth/api-keys",
36+
operation_id="list_api_keys",
37+
response_model=Envelope[list[ApiKeyGet]],
38+
status_code=status.HTTP_200_OK,
39+
)
40+
async def list_api_keys():
41+
"""lists API keys by this user"""
42+
43+
44+
@router.get(
45+
"/auth/api-keys/{api_key_id}",
46+
operation_id="get_api_key",
47+
response_model=Envelope[ApiKeyGet],
48+
status_code=status.HTTP_200_OK,
49+
)
50+
async def get_api_key(_path: Annotated[ApiKeysPathParams, Depends()]):
51+
"""returns the API Key with the given ID"""
52+
53+
54+
@router.delete(
55+
"/auth/api-keys/{api_key_id}",
56+
operation_id="delete_api_key",
57+
status_code=status.HTTP_204_NO_CONTENT,
58+
)
59+
async def delete_api_key(_path: Annotated[ApiKeysPathParams, Depends()]):
60+
"""deletes the API key with the given ID"""

0 commit comments

Comments
 (0)