-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/main' into 782-add-rbac-to-workf…
…lows
- Loading branch information
Showing
90 changed files
with
1,314 additions
and
296 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
name: CodSpeed | ||
|
||
on: | ||
push: | ||
branches: [ "main" ] | ||
pull_request: | ||
branches: [ "main" ] | ||
|
||
jobs: | ||
codspeed: | ||
name: Run benchmarks | ||
runs-on: ubuntu-latest | ||
container: | ||
image: python:3.11 | ||
options: --privileged | ||
services: | ||
postgres: | ||
image: postgres:15-alpine | ||
# Provide the password for postgres | ||
env: | ||
POSTGRES_PASSWORD: nwa | ||
POSTGRES_USER: nwa | ||
# Set health checks to wait until postgres has started | ||
options: >- | ||
--health-cmd pg_isready | ||
--health-interval 10s | ||
--health-timeout 5s | ||
--health-retries 5 | ||
redis: | ||
# Docker Hub image | ||
image: redis | ||
# Set health checks to wait until redis has started | ||
options: >- | ||
--health-cmd "redis-cli ping" | ||
--health-interval 10s | ||
--health-timeout 5s | ||
--health-retries 5 | ||
steps: | ||
# Downloads a copy of the code in your repository before running CI tests | ||
- name: Check out repository code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Install dependencies | ||
run: | | ||
apt update | ||
apt install curl git build-essential libpq-dev libffi-dev -y | ||
python -m pip install --upgrade pip | ||
pip install flit | ||
flit install --deps develop --symlink | ||
echo "GIT_COMMIT_HASH=\"test\"" > orchestrator/version.py | ||
env: | ||
FLIT_ROOT_INSTALL: 1 | ||
|
||
# Prevent error "repository path is not owned by the current user" | ||
- name: Fix git owner | ||
run: git config --global --add safe.directory "*" | ||
|
||
# Speculatively add the cargo binary directory to the PATH because codspeed's installer script somehow doesn't | ||
- name: Add $HOME/.cargo/bin to PATH | ||
run: echo "$HOME/.cargo/bin" >> "$GITHUB_PATH" | ||
|
||
- uses: CodSpeedHQ/action@v3 | ||
with: | ||
run: CACHE_URI=redis://redis DATABASE_URI=postgresql://$POSTGRES_USER:$POSTGRES_PASSWORD@$POSTGRES_HOST/$POSTGRES_DB pytest test/unit_tests --codspeed | ||
token: ${{ secrets.CODSPEED_TOKEN }} | ||
env: | ||
POSTGRES_DB: orchestrator-core-test | ||
POSTGRES_USER: nwa | ||
POSTGRES_PASSWORD: nwa | ||
POSTGRES_HOST: postgres | ||
ENVIRONMENT: TESTING |
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 |
---|---|---|
@@ -0,0 +1,18 @@ | ||
--- | ||
hide: | ||
- navigation | ||
--- | ||
# 3.0 Migration Guide | ||
|
||
In this document we describe the steps that should be taken to migrate from `orchestrator-core` v2 to v3. | ||
|
||
## About 3.0 | ||
|
||
In this release, deprecated import statements from the `orchestrator.types` module are removed, that now come from | ||
`pydantic-forms.types` instead. These will have to be updated in your implementation of the orchestrator as well. | ||
|
||
## Steps | ||
|
||
To update the import statements you may have in your implementation of Workflow Orchestrator, we offer a migration | ||
script that can be run as follows: `python -m orchestrator.devtools.scripts.migrate_30 <dir>` where `<dir>` points to | ||
your orchestrator implementation. |
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 was deleted.
Oops, something went wrong.
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,56 @@ | ||
# Copyright 2019-2020 SURF. | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
from http import HTTPStatus | ||
from uuid import UUID | ||
|
||
from fastapi.param_functions import Body | ||
from fastapi.routing import APIRouter | ||
|
||
from orchestrator.api.error_handling import raise_status | ||
from orchestrator.db import db | ||
from orchestrator.db.models import ProductBlockTable | ||
from orchestrator.schemas.product_block import ProductBlockPatchSchema, ProductBlockSchema | ||
|
||
router = APIRouter() | ||
|
||
|
||
@router.get("/{product_block_id}", response_model=ProductBlockSchema) | ||
def get_product_block_description(product_block_id: UUID) -> str: | ||
product_block = db.session.get(ProductBlockTable, product_block_id) | ||
if product_block is None: | ||
raise_status(HTTPStatus.NOT_FOUND) | ||
return product_block | ||
|
||
|
||
@router.patch("/{product_block_id}", status_code=HTTPStatus.CREATED, response_model=ProductBlockSchema) | ||
async def patch_product_block_by_id( | ||
product_block_id: UUID, data: ProductBlockPatchSchema = Body(...) | ||
) -> ProductBlockTable: | ||
product_block = db.session.get(ProductBlockTable, product_block_id) | ||
if not product_block: | ||
raise_status(HTTPStatus.NOT_FOUND, f"Product_block id {product_block_id} not found") | ||
|
||
return await _patch_product_block_description(data, product_block) | ||
|
||
|
||
async def _patch_product_block_description( | ||
data: ProductBlockPatchSchema, | ||
product_block: ProductBlockTable, | ||
) -> ProductBlockTable: | ||
|
||
updated_properties = data.model_dump(exclude_unset=True) | ||
description = updated_properties.get("description", product_block.description) | ||
product_block.description = description | ||
db.session.commit() | ||
return product_block |
Oops, something went wrong.