Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 13 additions & 9 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ on:

jobs:
check:
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04

strategy:
matrix:
Expand Down Expand Up @@ -51,29 +51,33 @@ jobs:
run: |
export DEBIAN_FRONTEND=noninteractive
sudo apt-get update
sudo apt-get install -y docker-compose docker.io
sudo apt install apt-transport-https ca-certificates curl software-properties-common -y
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
sudo apt-get update
sudo apt install docker-ce docker-ce-cli containerd.io -y

- name: Build docker images
run: docker-compose -f test-docker-compose.yaml build --no-cache
run: docker compose -f test-docker-compose.yaml build --no-cache

- name: Run pycodestyle
run: |
pycodestyle api/*.py

- name: Run API containers
run: |
docker-compose -f test-docker-compose.yaml up -d test
docker compose -f test-docker-compose.yaml up -d test

- name: Run pylint
run: |
docker-compose -f test-docker-compose.yaml exec -T test pylint --extension-pkg-whitelist=pydantic api/
docker-compose -f test-docker-compose.yaml exec -T test pylint tests/unit_tests
docker-compose -f test-docker-compose.yaml exec -T test pylint tests/e2e_tests
docker compose -f test-docker-compose.yaml exec -T test pylint --extension-pkg-whitelist=pydantic api/
docker compose -f test-docker-compose.yaml exec -T test pylint tests/unit_tests
docker compose -f test-docker-compose.yaml exec -T test pylint tests/e2e_tests

- name: Stop docker containers
if: always()
run: |
docker-compose -f test-docker-compose.yaml down
docker compose -f test-docker-compose.yaml down

lint:
runs-on: ubuntu-22.04
Expand Down Expand Up @@ -101,7 +105,7 @@ jobs:
pip install -r docker/api/requirements-tests.txt

- if: env.CHANGED_FILES
uses: marian-code/python-lint-annotate@v3
uses: marian-code/python-lint-annotate@v4
with:
python-root-list: ${{ env.CHANGED_FILES }}
use-black: false
Expand Down
4 changes: 4 additions & 0 deletions api/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
from fastapi_users import FastAPIUsers
from beanie import PydanticObjectId
from pydantic import BaseModel
from kernelci.api.models import (

Check failure on line 39 in api/main.py

View workflow job for this annotation

GitHub Actions / Lint

Unable to import 'kernelci.api.models'
Node,
Hierarchy,
PublishEvent,
Expand Down Expand Up @@ -334,6 +334,10 @@
status_code=status.HTTP_404_NOT_FOUND,
detail=f"Node not found with id: {node_id}"
)
# users staging.kernelci.org and production are superusers
# TBD: This is HACK until qualcomm can migrate to direct KCIDB
if user.username in ['staging.kernelci.org', 'production']:
return user
if not user.username == node_from_id.owner:
if not any(group.name in node_from_id.user_groups
for group in user.groups):
Expand Down