From 7fb810eb3a1e41572fc030ba1434c592eea48787 Mon Sep 17 00:00:00 2001 From: 0x1026 <69076992+0x1026@users.noreply.github.com> Date: Tue, 10 Dec 2024 22:20:54 +0100 Subject: [PATCH 1/2] fix(workflows): update output variable for version in CD workflow --- .github/workflows/cd.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 8e9d363..688f8f4 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -22,7 +22,7 @@ jobs: contents: write pull-requests: read outputs: - version: ${{ steps.release.outputs.tag_name }} + version: ${{ steps.release.outputs.version }} steps: # https://github.com/actions/checkout/tree/11bd71901bbe5b1630ceea73d27597364c9af683 From 86b4acc181d0f5e478d68e9510529a2ca2407df5 Mon Sep 17 00:00:00 2001 From: 0x1026 <69076992+0x1026@users.noreply.github.com> Date: Tue, 10 Dec 2024 22:25:44 +0100 Subject: [PATCH 2/2] fix(api): normalize image version handling by removing 'v' prefix --- api/src/config.py | 4 ++-- api/tests/test_config.py | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/api/src/config.py b/api/src/config.py index 2f29b8e..5b93aff 100644 --- a/api/src/config.py +++ b/api/src/config.py @@ -32,8 +32,8 @@ class Settings(BaseSettings): def check_image_version(cls, v): if v == "": return None - if v and not v.startswith("v"): - return f"v{v}" + if v.startswith("v"): + return v[1:] return v @model_validator(mode="before") diff --git a/api/tests/test_config.py b/api/tests/test_config.py index 9ad0944..6ce314c 100644 --- a/api/tests/test_config.py +++ b/api/tests/test_config.py @@ -29,7 +29,7 @@ def test_settings_with_custom_settings(): APP_NAME="api", APP_PACKAGE="api2", APP_ENV="production", - IMAGE_VERSION="v1.0.0", + IMAGE_VERSION="1.0.0", MARIADB_SERVER="127.0.0.1", MARIADB_PORT=3307, MARIADB_USER="user2", @@ -40,7 +40,7 @@ def test_settings_with_custom_settings(): assert custom.APP_NAME == "api" assert custom.APP_PACKAGE == "api2" assert custom.APP_ENV == "production" - assert custom.IMAGE_VERSION == "v1.0.0" + assert custom.IMAGE_VERSION == "1.0.0" assert custom.MARIADB_SERVER == "127.0.0.1" assert custom.MARIADB_PORT == 3307 assert custom.MARIADB_USER == "user2" @@ -53,11 +53,11 @@ def test_settings_with_custom_settings(): ) -def test_image_version_without_v_prefix(): +def test_image_version_wit_v_prefix(): custom = Settings( - IMAGE_VERSION="1.0.0", + IMAGE_VERSION="v1.0.0", ) - assert custom.IMAGE_VERSION == "v1.0.0" + assert custom.IMAGE_VERSION == "1.0.0" def test_settings_missing_password():