Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[IQE-3104] Update packages #518

Merged
merged 2 commits into from
Oct 24, 2024
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
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ repos:

## PYTHON
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
rev: v5.0.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
Expand All @@ -11,7 +11,7 @@ repos:
- id: debug-statements

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.5.5
rev: v0.7.0
hooks:
- id: ruff
args:
Expand All @@ -31,7 +31,7 @@ repos:

## ES
- repo: https://github.com/pre-commit/mirrors-eslint
rev: v9.8.0
rev: v9.13.0
hooks:
- id: eslint
additional_dependencies:
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ docker-compose -f docker-compose.dev.yml up
Using either `podman` or Docker Compose is the recommended way to run Ibutsu locally. If you don't
want to use the containers, the following must be installed:

- Python 3.8+
- Python 3.9+
- NodeJS
- yarn
- redis (strongly recommend a container)
Expand Down
13 changes: 7 additions & 6 deletions backend/docker/Dockerfile.backend
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
# hadolint global ignore=DL3013,DL3041
FROM registry.access.redhat.com/ubi9/python-39:1-197.1726664308

ENV UPGRADE_PIP_TO_LATEST=1
FROM registry.access.redhat.com/ubi9/python-39:1

USER 0
COPY . /app
RUN /usr/bin/fix-permissions /app

WORKDIR /app
RUN dnf install --nodocs -y --disableplugin=subscription-manager gcc libpq-devel && \
dnf clean all && \
pip install --no-cache-dir . && \
chgrp -R 0 ibutsu_server && chmod -R g+rwX ibutsu_server
dnf clean all

RUN pip install -U --upgrade-strategy eager --no-cache-dir setuptools pip wheel && \
pip install --no-cache-dir -U -r requirements-pinned.txt .

RUN chgrp -R 0 ibutsu_server && chmod -R g+rwX ibutsu_server

USER 1001

Expand Down
9 changes: 4 additions & 5 deletions backend/docker/Dockerfile.flower
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# hadolint global ignore=DL3013,DL3041
FROM registry.access.redhat.com/ubi9/python-39:1-197.1726664308
FROM registry.access.redhat.com/ubi9/python-39:1
ENV BROKER_URL=redis://localhost

# add application sources with correct perms for OCP
USER 0
Expand All @@ -11,12 +12,10 @@ RUN /usr/bin/fix-permissions /app

USER 1001

ENV BROKER_URL=redis://localhost

# Install dependencies
WORKDIR /app
RUN pip install --no-cache-dir -U pip wheel && \
pip install --no-cache-dir . && \
RUN pip install --no-cache-dir -U --upgrade-strategy eager pip wheel setuptools && \
pip install --no-cache-dir -r requirements-pinned.txt . && \
pip install --no-cache-dir flower

# Run application
Expand Down
8 changes: 5 additions & 3 deletions backend/docker/Dockerfile.scheduler
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
# hadolint global ignore=DL3013,DL3041
FROM registry.access.redhat.com/ubi9/python-39:1-197.1726664308
FROM registry.access.redhat.com/ubi9/python-39:1
USER 0

ENV UPGRADE_PIP_TO_LATEST=1

RUN dnf install --nodocs -y --disableplugin=subscription-manager gcc libpq-devel && \
dnf clean all

COPY . /app

WORKDIR /app
RUN pip install --no-cache-dir -U pip wheel && \
pip install --no-cache-dir . && \
RUN pip install --no-cache-dir -U --upgrade-strategy eager pip wheel setuptools && \
pip install --no-cache-dir -r requirements-pinned.txt . && \
chgrp -R 0 ibutsu_server && chmod -R g+rwX ibutsu_server

USER 1001
Expand Down
8 changes: 5 additions & 3 deletions backend/docker/Dockerfile.worker
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# hadolint global ignore=DL3013,DL3041
FROM registry.access.redhat.com/ubi9/python-39:1-197.1726664308
FROM registry.access.redhat.com/ubi9/python-39:1

ENV UPGRADE_PIP_TO_LATEST=1

USER 0

Expand All @@ -9,8 +11,8 @@ RUN dnf install --nodocs -y --disableplugin=subscription-manager gcc libpq-devel
COPY . /app

WORKDIR /app
RUN pip install --no-cache-dir -U pip wheel && \
pip install --no-cache-dir . && \
RUN pip install --no-cache-dir -U --upgrade-strategy eager pip wheel setuptools && \
pip install --no-cache-dir -r requirements-pinned.txt . && \
chgrp -R 0 ibutsu_server && chmod -R g+rwX ibutsu_server

USER 1001
Expand Down
13 changes: 6 additions & 7 deletions backend/ibutsu_server/util/jwt.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import time

from flask import current_app
from jose.constants import ALGORITHMS
from jose.exceptions import JWTError
from jose.jwt import decode as jwt_decode
from jose.jwt import encode as jwt_encode
from jwt import decode as jwt_decode
from jwt import encode as jwt_encode
from jwt.exceptions import InvalidTokenError
from werkzeug.exceptions import Unauthorized

from ibutsu_server.db.models import Token
Expand All @@ -31,16 +30,16 @@ def generate_token(user_id, expires=None):
if not JWT_SECRET and not current_app.config.get("JWT_SECRET"):
raise IbutsuError("JWT_SECRET is not defined in configuration or an environment variable")
jwt_secret = current_app.config.get("JWT_SECRET") or JWT_SECRET
encoded_token = jwt_encode(claims, jwt_secret, algorithm=ALGORITHMS.HS256)
encoded_token = jwt_encode(claims, jwt_secret, algorithm="HS256")
return encoded_token


def decode_token(token):
"""Decode a JWT token to check if it is valid"""
jwt_secret = current_app.config.get("JWT_SECRET") or JWT_SECRET
try:
decoded_token = jwt_decode(token, jwt_secret, algorithms=[ALGORITHMS.HS256])
except JWTError as error:
decoded_token = jwt_decode(token, jwt_secret, algorithms=["HS256"])
except InvalidTokenError as error:
raise Unauthorized from error
tokens = Token.query.filter(Token.user_id == decoded_token["sub"]).all()
if not tokens:
Expand Down
52 changes: 27 additions & 25 deletions backend/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,35 +30,35 @@ classifiers = [
]

dependencies = [
"alembic==1.13.1",
"celery==5.4.0",
"alembic",
"celery",
"connexion[swagger-ui]==2.14.2",
"flask_bcrypt==1.0.1",
"flask_cors==4.0.0",
"flask_mail==0.9.1",
"flask_bcrypt",
"flask_cors",
"flask_mail",
"Flask>=2,<2.3.0",
"Flask-SQLAlchemy<3.0",
"flatdict==4.0.1",
"google-api-python-client==2.126.0",
"google-auth==2.29.0",
"google-auth-httplib2==0.2.0",
"google-auth-oauthlib==1.2.0",
"gunicorn==22.0.0",
"kombu==5.3.7",
"lxml==5.2.1",
"psycopg2==2.9.9",
"pymongo==4.6.3",
"python-jose[cryptography]==3.3.0",
"python-magic==0.4.27",
"python_dateutil==2.9.0.post0",
"PyYAML==6.0.1",
"redis==5.0.3",
"setuptools==50.3.2",
"sqlalchemy-json==0.7.0",
"flatdict",
"google-api-python-client",
"google-auth",
"google-auth-httplib2",
"google-auth-oauthlib",
"gunicorn",
"kombu",
"lxml",
"psycopg2",
"pyjwt",
"pymongo",
"python-magic",
"python_dateutil",
"PyYAML",
"redis",
"setuptools",
"sqlalchemy-json",
"sqlalchemy<1.4",
"swagger-ui-bundle==0.0.9",
"vine==5.1.0",
"werkzeug==2.2.3",
"swagger-ui-bundle",
"vine",
"werkzeug",
]

[project.urls]
Expand All @@ -76,8 +76,10 @@ test = [
"py",
"pytest-mock",
"randomize",
"uv",
]


[project.scripts]
ibutsu_server = "ibutsu_server.__main__:main"

Expand Down
Loading
Loading