Skip to content

Commit

Permalink
ci, build: update CI, libraries, python dependencies, and format (#140)
Browse files Browse the repository at this point in the history
This commit updates the CI with standard CI configuration (juju, actions, deps) that is shared across multiple repositories. All python dependencies are also updated to their latest working versions. This PR also includes library updates. Finally, some formatting was applied on non-compliant files (copyright, style).

This change also contains a fix for #147, an issue caused by a missing toolchain in the charm that allows building certain python packages. For more information, please refer to canonical/bundle-kubeflow#648.

Fixes #141
Fixes #147
Part of canonical/bundle-kubeflow#648

* test: Fix assertion fails in unit tests

Fix assertion errors raised in unit tests caused by updating ops from
1.5 to 2+. Due to this change, we now have to take an extra step to
enable container connectivity when not using `begin_with_initial_hooks`.

Closes #141

Signed-off-by: Phoevos Kalemkeris <[email protected]>

---------

Signed-off-by: Phoevos Kalemkeris <[email protected]>
Co-authored-by: Phoevos Kalemkeris <[email protected]>
  • Loading branch information
DnPlas and phoevos authored Jul 27, 2023
1 parent a4ea068 commit effea44
Show file tree
Hide file tree
Showing 21 changed files with 262 additions and 304 deletions.
5 changes: 2 additions & 3 deletions charmcraft.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2021 Canonical Ltd.
# Copyright 2023 Canonical Ltd.
# See LICENSE file for licensing details.

type: charm
Expand All @@ -13,5 +13,4 @@ parts:
charm:
prime:
- files/*yaml
# do not use these versions due to pypa/setuptools_scm#713
charm-python-packages: [ setuptools!=62.2.0, pip!=22.1 ]
charm-python-packages: [setuptools, pip]
2 changes: 1 addition & 1 deletion config.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2021 Canonical Ltd.
# Copyright 2023 Canonical Ltd.
# See LICENSE file for licensing details.

options:
Expand Down
8 changes: 4 additions & 4 deletions lib/charms/observability_libs/v1/kubernetes_service_patch.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ def setUp(self, *unused):

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

ServiceType = Literal["ClusterIP", "LoadBalancer"]

Expand Down Expand Up @@ -201,6 +201,7 @@ def __init__(
# Ensure this patch is applied during the 'install' and 'upgrade-charm' events
self.framework.observe(charm.on.install, self._patch)
self.framework.observe(charm.on.upgrade_charm, self._patch)
self.framework.observe(charm.on.update_status, self._patch)

# apply user defined events
if refresh_event:
Expand Down Expand Up @@ -309,9 +310,8 @@ def _is_patched(self, client: Client) -> bool:
except ApiError as e:
if e.status.code == 404 and self.service_name != self._app:
return False
else:
logger.error("Kubernetes service get failed: %s", str(e))
raise
logger.error("Kubernetes service get failed: %s", str(e))
raise

# Construct a list of expected ports, should the patch be applied
expected_ports = [(p.port, p.targetPort) for p in self.service.spec.ports]
Expand Down
2 changes: 1 addition & 1 deletion metadata.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2021 Canonical Ltd.
# Copyright 2023 Canonical Ltd.
# See LICENSE file for licensing details.
name: kubeflow-dashboard
summary: Kubeflow Central Dashboard
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2022 Canonical Ltd.
# Copyright 2023 Canonical Ltd.
# See LICENSE file for licensing details.

# Testing tools configuration
Expand Down
18 changes: 10 additions & 8 deletions requirements-fmt.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,23 @@
# This file is autogenerated by pip-compile with Python 3.8
# by the following command:
#
# pip-compile --resolver=backtracking ./requirements-fmt.in
# pip-compile ./requirements-fmt.in
#
black==22.10.0
black==23.7.0
# via -r ./requirements-fmt.in
click==8.1.3
click==8.1.6
# via black
isort==5.10.1
isort==5.12.0
# via -r ./requirements-fmt.in
mypy-extensions==0.4.3
mypy-extensions==1.0.0
# via black
pathspec==0.10.2
packaging==23.1
# via black
platformdirs==2.5.4
pathspec==0.11.1
# via black
platformdirs==3.9.1
# via black
tomli==2.0.1
# via black
typing-extensions==4.4.0
typing-extensions==4.7.1
# via black
13 changes: 11 additions & 2 deletions requirements-integration.in
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
juju<3.1
# Pinning to <3.0 to ensure compatibility with the 2.9 controller version
# Note: 3.0 is not being maintained anymore
juju<3.0
lightkube
ops
pytest
pytest-asyncio
pytest-operator
pyyaml
selenium
selenium-wire
-r requirements.txt
# This is needed only for this charm as the integration test files in
# test/integration/ have imports from the charm code in src/charm.py
-r requirements.in
Loading

0 comments on commit effea44

Please sign in to comment.