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

[Framework] - Fix passing of application settings through env & Add INTEGRATION_VERSION label to docker #494

Merged
merged 6 commits into from
Apr 10, 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
2 changes: 2 additions & 0 deletions .github/workflows/release-integrations.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ jobs:
echo "context_dir=$context_dir" >> $GITHUB_OUTPUT

version=$(grep -E '^version = ".*"' "$folder/../pyproject.toml" | cut -d'"' -f2)
echo "version=$version" >> $GITHUB_OUTPUT

dockerfile_path=integrations/_infra/Dockerfile
if test -e $folder/../Dockerfile; then
Expand Down Expand Up @@ -113,6 +114,7 @@ jobs:
tags: ${{ steps.prepare_tags.outputs.tags }}
build-args: |
BUILD_CONTEXT=${{ steps.prepare_tags.outputs.context_dir }}
INTEGRATION_VERSION=${{ steps.prepare_tags.outputs.version }}

upload-specs:
runs-on: ubuntu-latest
Expand Down
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,18 @@ this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm

<!-- towncrier release notes start -->


## 0.5.10 (2024-04-10)

### Bug Fixes

- Fixed application settings to be loaded from the environment variables

### Improvements

- Added integration version label to docker


## 0.5.9 (2024-03-30)

### Bug Fixes
Expand Down
4 changes: 4 additions & 0 deletions integrations/_infra/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
FROM python:3.11-slim-buster

ARG BUILD_CONTEXT
ARG INTEGRATION_VERSION

LABEL INTEGRATION_VERSION=${INTEGRATION_VERSION}

ENV LIBRDKAFKA_VERSION 1.9.2

WORKDIR /app
Expand Down
11 changes: 9 additions & 2 deletions port_ocean/config/settings.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from typing import Any, Literal

from pydantic import Extra, AnyHttpUrl, parse_obj_as, validator
from pydantic.env_settings import InitSettingsSource, EnvSettingsSource, BaseSettings
from pydantic.fields import Field
from pydantic.main import BaseModel

Expand All @@ -10,7 +11,7 @@
LogLevelType = Literal["ERROR", "WARNING", "INFO", "DEBUG", "CRITICAL"]


class ApplicationSettings(BaseOceanModel):
class ApplicationSettings(BaseSettings):
log_level: LogLevelType = "INFO"
enable_http_logging: bool = True
port: int = 8000
Expand All @@ -21,7 +22,13 @@ class Config:
env_file_encoding = "utf-8"

@classmethod
def customise_sources(cls, init_settings, env_settings, *_, **__): # type: ignore
def customise_sources( # type: ignore
cls,
init_settings: InitSettingsSource,
env_settings: EnvSettingsSource,
*_,
**__,
):
return env_settings, init_settings


Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "port-ocean"
version = "0.5.9"
version = "0.5.10"
description = "Port Ocean is a CLI tool for managing your Port projects."
readme = "README.md"
homepage = "https://app.getport.io"
Expand Down
Loading