diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index f7fc333bf9..89f608b273 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -51,21 +51,6 @@ jobs: - name: Run tests run: tox run -e unit-${{ matrix.juju-version }} - lib-check: - name: Check libraries - runs-on: ubuntu-latest - timeout-minutes: 5 - steps: - - name: Checkout - uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4 - with: - fetch-depth: 0 - - name: Check libs - uses: canonical/charming-actions/check-libraries@2.4.0 - with: - credentials: "${{ secrets.CHARMHUB_TOKEN }}" - github-token: "${{ secrets.GITHUB_TOKEN }}" - build: name: Build charms uses: canonical/data-platform-workflows/.github/workflows/build_charms_with_cache.yaml@v2 @@ -93,7 +78,6 @@ jobs: - "3.1.5" # renovate: latest juju 3 name: ${{ matrix.tox-environments }} | ${{ matrix.agent-versions }} needs: - - lib-check - lint - unit-test - build diff --git a/.github/workflows/lib-check.yaml b/.github/workflows/lib-check.yaml new file mode 100644 index 0000000000..860f976e94 --- /dev/null +++ b/.github/workflows/lib-check.yaml @@ -0,0 +1,38 @@ +# Copyright 2022 Canonical Ltd. +# See LICENSE file for licensing details. +name: Check libs + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +on: + pull_request: + paths-ignore: + - '.gitignore' + - '.jujuignore' + - 'LICENSE' + - '**.md' + - 'renovate.json' + schedule: + - cron: '53 0 * * *' # Daily at 00:53 UTC + # Triggered on push to branch "main" by .github/workflows/release.yaml + workflow_call: + +jobs: + lib-check: + name: Check libraries + runs-on: ubuntu-latest + timeout-minutes: 5 + if: ${{ github.event.pull_request.head.repo.full_name == 'canonical/postgresql-k8s-operator' }} + steps: + - name: Checkout + uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4 + with: + fetch-depth: 0 + - name: Check libs + uses: canonical/charming-actions/check-libraries@2.4.0 + with: + credentials: "${{ secrets.CHARMHUB_TOKEN }}" + github-token: "${{ secrets.GITHUB_TOKEN }}" + diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index d7200051c9..4d1865537a 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -14,6 +14,7 @@ on: - pyproject.toml - '.github/**.md' - '.github/workflows/ci.yaml' + - '.github/workflows/lib-check.yaml' jobs: ci-tests: diff --git a/lib/charms/data_platform_libs/v0/data_interfaces.py b/lib/charms/data_platform_libs/v0/data_interfaces.py index 2624dd4d68..9071655a8f 100644 --- a/lib/charms/data_platform_libs/v0/data_interfaces.py +++ b/lib/charms/data_platform_libs/v0/data_interfaces.py @@ -320,7 +320,7 @@ def _on_topic_requested(self, event: TopicRequestedEvent): # Increment this PATCH version before using `charmcraft publish-lib` or reset # to 0 if you are raising the major API version -LIBPATCH = 19 +LIBPATCH = 20 PYDEPS = ["ops>=2.0.0"] @@ -1674,6 +1674,10 @@ def _assign_relation_alias(self, relation_id: int) -> None: if relation: relation.data[self.local_unit].update({"alias": available_aliases[0]}) + # We need to set relation alias also on the application level so, + # it will be accessible in show-unit juju command, executed for a consumer application unit + self.update_relation_data(relation_id, {"alias": available_aliases[0]}) + def _emit_aliased_event(self, event: RelationChangedEvent, event_name: str) -> None: """Emit an aliased event to a particular relation if it has an alias. diff --git a/lib/charms/data_platform_libs/v0/upgrade.py b/lib/charms/data_platform_libs/v0/upgrade.py index 670f4652e5..4ee2e9ff88 100644 --- a/lib/charms/data_platform_libs/v0/upgrade.py +++ b/lib/charms/data_platform_libs/v0/upgrade.py @@ -263,7 +263,7 @@ def restart(self, event) -> None: import json import logging from abc import ABC, abstractmethod -from typing import List, Literal, Optional, Set, Tuple +from typing import Dict, List, Literal, Optional, Set, Tuple import poetry.core.constraints.version as poetry_version from ops.charm import ( @@ -285,7 +285,7 @@ def restart(self, event) -> None: # Increment this PATCH version before using `charmcraft publish-lib` or reset # to 0 if you are raising the major API version -LIBPATCH = 14 +LIBPATCH = 15 PYDEPS = ["pydantic>=1.10,<2", "poetry-core"] @@ -346,7 +346,7 @@ class KafkaDependenciesModel(BaseModel): print(model.dict()) # exporting back validated deps """ - dependencies: dict[str, str] + dependencies: Dict[str, str] name: str upgrade_supported: str version: str diff --git a/lib/charms/postgresql_k8s/v0/postgresql.py b/lib/charms/postgresql_k8s/v0/postgresql.py index 199ae3fec5..3efcda0c41 100644 --- a/lib/charms/postgresql_k8s/v0/postgresql.py +++ b/lib/charms/postgresql_k8s/v0/postgresql.py @@ -32,7 +32,7 @@ # Increment this PATCH version before using `charmcraft publish-lib` or reset # to 0 if you are raising the major API version -LIBPATCH = 16 +LIBPATCH = 17 INVALID_EXTRA_USER_ROLE_BLOCKING_MESSAGE = "invalid role(s) for extra user roles" diff --git a/metadata.yaml b/metadata.yaml index 8c9e533981..74485cbe02 100644 --- a/metadata.yaml +++ b/metadata.yaml @@ -28,7 +28,7 @@ resources: postgresql-image: type: oci-image description: OCI image for PostgreSQL - upstream-source: ghcr.io/canonical/charmed-postgresql@sha256:1517d0053d6c039b42b5e2820c8f7a3eb13b67eee2b101fd1f562216eb4179ca + upstream-source: ghcr.io/canonical/charmed-postgresql@sha256:a6aa592506aa4cda85b63f66e1c9d079088ca7c9d84ed4bba9442dea36ec3f17 peers: database-peers: diff --git a/tests/integration/test_db.py b/tests/integration/test_db.py index 9e3e0ce81d..bbd56ad8ca 100644 --- a/tests/integration/test_db.py +++ b/tests/integration/test_db.py @@ -229,6 +229,7 @@ async def test_indico_db_blocked(ops_test: OpsTest) -> None: ) +@pytest.mark.skip(reason="Should be ported and moved to the new relation tests") async def test_discourse(ops_test: OpsTest): database_application_name = f"extensions-{DATABASE_APP_NAME}" if database_application_name not in ops_test.model.applications: