Skip to content
Snippets Groups Projects
Verified Commit 6d115ee0 authored by Daniel Göbel's avatar Daniel Göbel
Browse files

Fix broken kaniko build

#76
parent a9f1ea4b
No related branches found
No related tags found
No related merge requests found
...@@ -129,7 +129,7 @@ lint-test-job: # Runs linters checks on code ...@@ -129,7 +129,7 @@ lint-test-job: # Runs linters checks on code
script: script:
- ./scripts/lint.sh - ./scripts/lint.sh
build-publish-dev-docker-container-job: publish-main-docker-container-job:
stage: deploy stage: deploy
image: image:
name: gcr.io/kaniko-project/executor:v1.20.0-debug name: gcr.io/kaniko-project/executor:v1.20.0-debug
...@@ -146,6 +146,7 @@ build-publish-dev-docker-container-job: ...@@ -146,6 +146,7 @@ build-publish-dev-docker-container-job:
--dockerfile "${CI_PROJECT_DIR}/Dockerfile" --dockerfile "${CI_PROJECT_DIR}/Dockerfile"
--destination "${CI_REGISTRY_IMAGE}:main-${CI_COMMIT_SHA}" --destination "${CI_REGISTRY_IMAGE}:main-${CI_COMMIT_SHA}"
--destination "${CI_REGISTRY_IMAGE}:main-latest" --destination "${CI_REGISTRY_IMAGE}:main-latest"
--cleanup
- /kaniko/executor - /kaniko/executor
--context "${CI_PROJECT_DIR}" --context "${CI_PROJECT_DIR}"
--dockerfile "${CI_PROJECT_DIR}/Dockerfile-Gunicorn" --dockerfile "${CI_PROJECT_DIR}/Dockerfile-Gunicorn"
...@@ -170,6 +171,7 @@ publish-docker-container-job: ...@@ -170,6 +171,7 @@ publish-docker-container-job:
--destination "${CI_REGISTRY_IMAGE}:$(echo ${CI_COMMIT_TAG} | cut -d'.' -f1-2)" --destination "${CI_REGISTRY_IMAGE}:$(echo ${CI_COMMIT_TAG} | cut -d'.' -f1-2)"
--destination "${CI_REGISTRY_IMAGE}:$(echo ${CI_COMMIT_TAG} | cut -d'.' -f1)" --destination "${CI_REGISTRY_IMAGE}:$(echo ${CI_COMMIT_TAG} | cut -d'.' -f1)"
--destination "${CI_REGISTRY_IMAGE}:latest" --destination "${CI_REGISTRY_IMAGE}:latest"
--cleanup
- /kaniko/executor - /kaniko/executor
--context "${CI_PROJECT_DIR}" --context "${CI_PROJECT_DIR}"
--dockerfile "${CI_PROJECT_DIR}/Dockerfile-Gunicorn" --dockerfile "${CI_PROJECT_DIR}/Dockerfile-Gunicorn"
......
...@@ -15,29 +15,29 @@ repos: ...@@ -15,29 +15,29 @@ repos:
- id: check-merge-conflict - id: check-merge-conflict
- id: check-ast - id: check-ast
- repo: https://github.com/psf/black - repo: https://github.com/psf/black
rev: 23.11.0 rev: 24.1.1
hooks: hooks:
- id: black - id: black
files: app files: app
args: [--check] args: [--check]
- repo: https://github.com/charliermarsh/ruff-pre-commit - repo: https://github.com/charliermarsh/ruff-pre-commit
rev: 'v0.1.6' rev: 'v0.1.15'
hooks: hooks:
- id: ruff - id: ruff
- repo: https://github.com/PyCQA/isort - repo: https://github.com/PyCQA/isort
rev: 5.12.0 rev: 5.13.2
hooks: hooks:
- id: isort - id: isort
files: app files: app
args: [-c] args: [-c]
- repo: https://github.com/pre-commit/mirrors-mypy - repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.7.1 rev: v1.8.0
hooks: hooks:
- id: mypy - id: mypy
files: app files: app
args: [--config=pyproject.toml] args: [--config=pyproject.toml]
additional_dependencies: additional_dependencies:
- boto3-stubs-lite[s3]>=1.29.0,<1.30.0 - boto3-stubs-lite[s3]<1.35.0
- sqlalchemy>=2.0.0,<2.1.0 - sqlalchemy>=2.0.0,<2.1.0
- pydantic>=2.5.0,<2.6.0 - pydantic<2.7.0
- types-requests - types-requests
...@@ -7,7 +7,7 @@ RUN apt-get update && apt-get -y install dumb-init ...@@ -7,7 +7,7 @@ RUN apt-get update && apt-get -y install dumb-init
RUN apt-get clean RUN apt-get clean
ENTRYPOINT ["/usr/bin/dumb-init", "--"] ENTRYPOINT ["/usr/bin/dumb-init", "--"]
STOPSIGNAL SIGINT STOPSIGNAL SIGINT
RUN pip install --no-cache-dir httpx[cli] "uvicorn>=0.27.0" RUN pip install --no-cache-dir httpx[cli] "uvicorn<0.28.0"
HEALTHCHECK --interval=30s --timeout=2s CMD httpx http://localhost:$PORT/health || exit 1 HEALTHCHECK --interval=30s --timeout=2s CMD httpx http://localhost:$PORT/health || exit 1
...@@ -17,7 +17,7 @@ WORKDIR /home/worker/code ...@@ -17,7 +17,7 @@ WORKDIR /home/worker/code
ENV PYTHONPATH=/home/worker/code ENV PYTHONPATH=/home/worker/code
ENV PATH="/home/worker/.local/bin:${PATH}" ENV PATH="/home/worker/.local/bin:${PATH}"
COPY --chown=worker:worker ./start_service_uvicorn.sh ./start.sh COPY --chown=worker:worker ./start_service_uvicorn.sh ./entrypoint.sh
COPY --chown=worker:worker ./scripts/prestart.sh ./prestart.sh COPY --chown=worker:worker ./scripts/prestart.sh ./prestart.sh
COPY --chown=worker:worker requirements.txt ./requirements.txt COPY --chown=worker:worker requirements.txt ./requirements.txt
...@@ -26,4 +26,4 @@ RUN pip install --user --no-cache-dir --upgrade -r requirements.txt ...@@ -26,4 +26,4 @@ RUN pip install --user --no-cache-dir --upgrade -r requirements.txt
COPY --chown=worker:worker ./app ./app COPY --chown=worker:worker ./app ./app
CMD ["./start.sh"] CMD ["./entrypoint.sh"]
...@@ -4,17 +4,17 @@ EXPOSE $PORT ...@@ -4,17 +4,17 @@ EXPOSE $PORT
WORKDIR /app/ WORKDIR /app/
ENV PYTHONPATH=/app ENV PYTHONPATH=/app
RUN pip install --no-cache-dir httpx[cli] "gunicorn<=21.2.0" "uvicorn>=0.27.0" RUN pip install --no-cache-dir httpx[cli] "gunicorn<21.3.0" "uvicorn<0.28.0"
COPY ./gunicorn_conf.py /app/gunicorn_conf.py COPY ./gunicorn_conf.py /app/gunicorn_conf.py
COPY ./start_service_gunicorn.sh /app/start.sh COPY ./start_service_gunicorn.sh /app/entrypoint.sh
HEALTHCHECK --interval=30s --timeout=2s CMD httpx http://localhost:$PORT/health || exit 1 HEALTHCHECK --interval=30s --timeout=2s CMD httpx http://localhost:$PORT/health || exit 1
COPY ./scripts/prestart.sh /app/prestart.sh COPY ./scripts/prestart.sh /app/prestart.sh
COPY ./requirements.txt /app/requirements.txt COPY ./requirements.txt /app/requirements.txt
RUN pip install --no-cache-dir --upgrade -r requirements.txt RUN pip install --no-cache-dir -r requirements.txt
COPY ./app /app/app COPY ./app /app/app
CMD ["./start.sh"] CMD ["./entrypoint.sh"]
...@@ -114,6 +114,7 @@ async def decode_bearer_token( ...@@ -114,6 +114,7 @@ async def decode_bearer_token(
""" """
try: try:
jwt = JWT(**decode(token.credentials), raw_token=token.credentials) jwt = JWT(**decode(token.credentials), raw_token=token.credentials)
trace.get_current_span().set_attributes({"exp": jwt.exp.isoformat(), "uid": jwt.sub})
await get_current_user(jwt, db) # make sure the user exists await get_current_user(jwt, db) # make sure the user exists
return jwt return jwt
except ExpiredTokenError: # pragma: no cover except ExpiredTokenError: # pragma: no cover
......
...@@ -196,7 +196,7 @@ async def list_permissions_per_user( ...@@ -196,7 +196,7 @@ async def list_permissions_per_user(
List of all permissions for this user. List of all permissions for this user.
""" """
current_span = trace.get_current_span() current_span = trace.get_current_span()
current_span.set_attribute("uid", user.uid) current_span.set_attribute("uid", str(user.uid))
if permission_types is not None and len(permission_types) > 0: # pragma: no cover if permission_types is not None and len(permission_types) > 0: # pragma: no cover
current_span.set_attribute("permission_types", [ptype.name for ptype in permission_types]) current_span.set_attribute("permission_types", [ptype.name for ptype in permission_types])
if permission_status is not None: # pragma: no cover if permission_status is not None: # pragma: no cover
......
...@@ -80,7 +80,7 @@ async def list_buckets( ...@@ -80,7 +80,7 @@ async def list_buckets(
\f \f
Parameters Parameters
---------- ----------
uid : uuid.UUID owner_id : uuid.UUID
User for which to retrieve the buckets. Dependency Injection. User for which to retrieve the buckets. Dependency Injection.
bucket_type : app.crud.crud_bucket.CRUDBucket.BucketType, default BucketType.ALL bucket_type : app.crud.crud_bucket.CRUDBucket.BucketType, default BucketType.ALL
Type of the bucket to get. Query Parameter. Type of the bucket to get. Query Parameter.
...@@ -99,7 +99,7 @@ async def list_buckets( ...@@ -99,7 +99,7 @@ async def list_buckets(
""" """
current_span = trace.get_current_span() current_span = trace.get_current_span()
if owner_id is not None: # pragma: no cover if owner_id is not None: # pragma: no cover
current_span.set_attribute("uid", str(owner_id)) current_span.set_attribute("owner_id", str(owner_id))
current_span.set_attribute("bucket_type", bucket_type.name) current_span.set_attribute("bucket_type", bucket_type.name)
await authorization("list_all" if current_user.uid != owner_id else "list") await authorization("list_all" if current_user.uid != owner_id else "list")
if owner_id is None: if owner_id is None:
......
...@@ -71,6 +71,6 @@ async def request_authorization(request_params: AuthzRequest, client: AsyncClien ...@@ -71,6 +71,6 @@ async def request_authorization(request_params: AuthzRequest, client: AsyncClien
if not parsed_response.result: # pragma: no cover if not parsed_response.result: # pragma: no cover
raise HTTPException( raise HTTPException(
status_code=status.HTTP_403_FORBIDDEN, status_code=status.HTTP_403_FORBIDDEN,
detail=f"Action forbidden. Decision ID {parsed_response.decision_id}", detail=f"Action forbidden. Decision ID {str(parsed_response.decision_id)}",
) )
return parsed_response return parsed_response
# test packages # test packages
pytest>=7.4.0,<7.5.0 pytest>=8.0.0,<8.1.0
pytest-asyncio>=0.21.0,<0.22.0 pytest-asyncio>=0.21.0,<0.22.0
pytest-cov>=4.1.0,<4.2.0 pytest-cov>=4.1.0,<4.2.0
coverage[toml]>=7.4.0,<7.5.0 coverage[toml]>=7.4.0,<7.5.0
# Linters # Linters
ruff>=0.1.0,<0.2.0 ruff>=0.1.0,<0.2.0
black>=23.12.0,<24.1.0 black>=24.1.0,<24.2.0
isort>=5.13.0,<5.14.0 isort>=5.13.0,<5.14.0
mypy>=1.8.0,<1.9.0 mypy>=1.8.0,<1.9.0
# stubs for mypy # stubs for mypy
......
...@@ -3,7 +3,7 @@ clowmdb>=3.0.0,<3.1.0 ...@@ -3,7 +3,7 @@ clowmdb>=3.0.0,<3.1.0
# Webserver packages # Webserver packages
fastapi>=0.109.0,<0.110.0 fastapi>=0.109.0,<0.110.0
pydantic>=2.5.0,<2.6.0 pydantic>=2.6.0,<2.7.0
pydantic-settings>=2.1.0,<2.2.0 pydantic-settings>=2.1.0,<2.2.0
# Database packages # Database packages
PyMySQL>=1.1.0,<1.2.0 PyMySQL>=1.1.0,<1.2.0
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment