Skip to content

Commit

Permalink
Merge branch 'main' into dpe-5827-all-sync
Browse files Browse the repository at this point in the history
  • Loading branch information
dragomirp committed Jan 8, 2025
2 parents ac006d1 + de74296 commit 26c536c
Show file tree
Hide file tree
Showing 9 changed files with 75 additions and 55 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ on:
jobs:
lint:
name: Lint
uses: canonical/data-platform-workflows/.github/workflows/[email protected].5
uses: canonical/data-platform-workflows/.github/workflows/[email protected].6

unit-test:
name: Unit test charm
Expand All @@ -45,7 +45,7 @@ jobs:

build:
name: Build charm
uses: canonical/data-platform-workflows/.github/workflows/[email protected].5
uses: canonical/data-platform-workflows/.github/workflows/[email protected].6
with:
cache: true

Expand All @@ -57,21 +57,21 @@ jobs:
- agent: 2.9.51 # renovate: juju-agent-pin-minor
libjuju: ==2.9.49.1 # renovate: latest libjuju 2
allure_on_amd64: false
- agent: 3.4.6 # renovate: juju-agent-pin-minor
- agent: 3.6.1 # renovate: juju-agent-pin-minor
allure_on_amd64: true
architecture:
- amd64
include:
- juju:
agent: 3.4.6 # renovate: juju-agent-pin-minor
agent: 3.6.1 # renovate: juju-agent-pin-minor
allure_on_amd64: true
architecture: arm64
name: Integration | ${{ matrix.juju.agent }} | ${{ matrix.architecture }}
needs:
- lint
- unit-test
- build
uses: canonical/data-platform-workflows/.github/workflows/[email protected].5
uses: canonical/data-platform-workflows/.github/workflows/[email protected].6
with:
artifact-prefix: ${{ needs.build.outputs.artifact-prefix }}
architecture: ${{ matrix.architecture }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,14 @@ jobs:

build:
name: Build charm
uses: canonical/data-platform-workflows/.github/workflows/[email protected].5
uses: canonical/data-platform-workflows/.github/workflows/[email protected].6

release:
name: Release charm
needs:
- ci-tests
- build
uses: canonical/data-platform-workflows/.github/workflows/[email protected].5
uses: canonical/data-platform-workflows/.github/workflows/[email protected].6
with:
channel: 14/edge
artifact-prefix: ${{ needs.build.outputs.artifact-prefix }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/sync_docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:
jobs:
sync-docs:
name: Sync docs from Discourse
uses: canonical/data-platform-workflows/.github/workflows/[email protected].5
uses: canonical/data-platform-workflows/.github/workflows/[email protected].6
with:
reviewers: a-velasco
permissions:
Expand Down
14 changes: 7 additions & 7 deletions lib/charms/postgresql_k8s/v0/postgresql.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

import logging
from collections import OrderedDict
from typing import Optional, Set, Tuple
from typing import List, Optional, Set, Tuple

import psycopg2
from ops.model import Relation
Expand All @@ -35,7 +35,7 @@

# Increment this PATCH version before using `charmcraft publish-lib` or reset
# to 0 if you are raising the major API version
LIBPATCH = 40
LIBPATCH = 41

INVALID_EXTRA_USER_ROLE_BLOCKING_MESSAGE = "invalid role(s) for extra user roles"

Expand Down Expand Up @@ -108,7 +108,7 @@ def __init__(
user: str,
password: str,
database: str,
system_users: Optional[list[str]] = None,
system_users: Optional[List[str]] = None,
):
self.primary_host = primary_host
self.current_host = current_host
Expand Down Expand Up @@ -161,8 +161,8 @@ def create_database(
self,
database: str,
user: str,
plugins: Optional[list[str]] = None,
client_relations: Optional[list[Relation]] = None,
plugins: Optional[List[str]] = None,
client_relations: Optional[List[Relation]] = None,
) -> None:
"""Creates a new database and grant privileges to a user on it.
Expand Down Expand Up @@ -368,8 +368,8 @@ def enable_disable_extensions(
connection.close()

def _generate_database_privileges_statements(
self, relations_accessing_this_database: int, schemas: list[str], user: str
) -> list[Composed]:
self, relations_accessing_this_database: int, schemas: List[str], user: str
) -> List[Composed]:
"""Generates a list of databases privileges statements."""
statements = []
if relations_accessing_this_database == 1:
Expand Down
22 changes: 16 additions & 6 deletions lib/charms/postgresql_k8s/v0/postgresql_tls.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@

# Increment this PATCH version before using `charmcraft publish-lib` or reset
# to 0 if you are raising the major API version.
LIBPATCH = 11
LIBPATCH = 12

logger = logging.getLogger(__name__)
SCOPE = "unit"
Expand Down Expand Up @@ -130,11 +130,21 @@ def _on_certificate_available(self, event: CertificateAvailableEvent) -> None:
logger.error("An unknown certificate available.")
return

self.charm.set_secret(
SCOPE, "chain", "\n".join(event.chain) if event.chain is not None else None
)
self.charm.set_secret(SCOPE, "cert", event.certificate)
self.charm.set_secret(SCOPE, "ca", event.ca)
if not event.certificate:
logger.debug("No certificate available.")
event.defer()
return

chain = self.charm.get_secret(SCOPE, "chain")
new_chain = "\n".join(event.chain) if event.chain is not None else None
if chain != new_chain:
self.charm.set_secret(SCOPE, "chain", new_chain)
cert = self.charm.get_secret(SCOPE, "cert")
if cert != event.certificate:
self.charm.set_secret(SCOPE, "cert", event.certificate)
ca = self.charm.get_secret(SCOPE, "ca")
if ca != event.ca:
self.charm.set_secret(SCOPE, "ca", event.ca)

try:
if not self.charm.push_tls_files_to_workload():
Expand Down
64 changes: 35 additions & 29 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,13 @@ optional = true
[tool.poetry.group.integration.dependencies]
lightkube = "^0.15.5"
pytest = "^8.3.3"
pytest-github-secrets = {git = "https://github.com/canonical/data-platform-workflows", tag = "v24.0.5", subdirectory = "python/pytest_plugins/github_secrets"}
pytest-github-secrets = {git = "https://github.com/canonical/data-platform-workflows", tag = "v24.0.6", subdirectory = "python/pytest_plugins/github_secrets"}
pytest-operator = "^0.38.0"
pytest-operator-cache = {git = "https://github.com/canonical/data-platform-workflows", tag = "v24.0.5", subdirectory = "python/pytest_plugins/pytest_operator_cache"}
pytest-operator-groups = {git = "https://github.com/canonical/data-platform-workflows", tag = "v24.0.5", subdirectory = "python/pytest_plugins/pytest_operator_groups"}
allure-pytest-collection-report = {git = "https://github.com/canonical/data-platform-workflows", tag = "v24.0.5", subdirectory = "python/pytest_plugins/allure_pytest_collection_report"}
pytest-operator-cache = {git = "https://github.com/canonical/data-platform-workflows", tag = "v24.0.6", subdirectory = "python/pytest_plugins/pytest_operator_cache"}
pytest-operator-groups = {git = "https://github.com/canonical/data-platform-workflows", tag = "v24.0.6", subdirectory = "python/pytest_plugins/pytest_operator_groups"}
allure-pytest-collection-report = {git = "https://github.com/canonical/data-platform-workflows", tag = "v24.0.6", subdirectory = "python/pytest_plugins/allure_pytest_collection_report"}
# renovate caret doesn't work: https://github.com/renovatebot/renovate/issues/26940
juju = "<=3.5.2.1"
juju = "<=3.6.1.0"
psycopg2-binary = "^2.9.10"
boto3 = "^1.35.70"
tenacity = "^9.0.0"
Expand Down
2 changes: 2 additions & 0 deletions tests/integration/ha_tests/test_rollback_to_master_label.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@

@pytest.mark.group(1)
@markers.juju3
@pytest.mark.unstable
@markers.amd64_only # TODO: remove after arm64 stable release
@pytest.mark.abort_on_fail
async def test_deploy_stable(ops_test: OpsTest) -> None:
Expand Down Expand Up @@ -72,6 +73,7 @@ async def test_deploy_stable(ops_test: OpsTest) -> None:

@pytest.mark.group(1)
@markers.juju3
@pytest.mark.unstable
@markers.amd64_only # TODO: remove after arm64 stable release
async def test_fail_and_rollback(ops_test, continuous_writes) -> None:
# Start an application that continuously writes data to the database.
Expand Down
2 changes: 2 additions & 0 deletions tests/integration/ha_tests/test_upgrade_to_primary_label.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@

@pytest.mark.group(1)
@markers.amd64_only # TODO: remove after arm64 stable release
@pytest.mark.unstable
@pytest.mark.abort_on_fail
async def test_deploy_stable(ops_test: OpsTest) -> None:
"""Simple test to ensure that the PostgreSQL and application charms get deployed."""
Expand Down Expand Up @@ -75,6 +76,7 @@ async def test_deploy_stable(ops_test: OpsTest) -> None:

@pytest.mark.group(1)
@markers.amd64_only # TODO: remove after arm64 stable release
@pytest.mark.unstable
async def test_upgrade(ops_test, continuous_writes) -> None:
# Start an application that continuously writes data to the database.
logger.info("starting continuous writes to the database")
Expand Down

0 comments on commit 26c536c

Please sign in to comment.