Skip to content

Commit

Permalink
Merge branch 'main' into feat/externalise-runner-creation-ISD-1536
Browse files Browse the repository at this point in the history
# Conflicts:
#	pyproject.toml
#	src-docs/errors.md
#	src/charm.py
#	src/charm_state.py
#	src/github_client.py
#	src/manager/cloud_runner_manager.py
#	src/manager/github_runner_manager.py
#	src/manager/runner_manager.py
#	src/metrics/github.py
#	src/openstack_cloud/openstack_runner_manager.py
#	src/runner.py
#	src/runner_manager_type.py
#	src/runner_type.py
#	tests/integration/test_runner_manager_openstack.py
#	tests/integration/test_self_hosted_runner.py
#	tests/unit/conftest.py
#	tests/unit/test_charm.py
#	tests/unit/test_charm_state.py
#	tests/unit/test_github_client.py
#	tests/unit/test_lxd_runner_manager.py
#	tests/unit/test_runner.py
  • Loading branch information
cbartz committed Sep 5, 2024
2 parents 0f0b07b + 5b8c99a commit 2c86775
Show file tree
Hide file tree
Showing 11 changed files with 817 additions and 22 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ omit = [
]

[tool.coverage.report]
fail_under = 83 # TODO: increase to 85 to match team standard
fail_under = 83
show_missing = true

[tool.pytest.ini_options]
Expand Down
51 changes: 31 additions & 20 deletions src-docs/errors.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,17 @@ Error for setting up aproxy.

<a href="../src/errors.py#L38"><img align="right" style="float:right;" src="https://img.shields.io/badge/-source-cccccc?style=flat-square"></a>

## <kbd>class</kbd> `MissingServerConfigError`
Error for unable to create runner due to missing server configurations.





---

<a href="../src/errors.py#L42"><img align="right" style="float:right;" src="https://img.shields.io/badge/-source-cccccc?style=flat-square"></a>

## <kbd>class</kbd> `MissingRunnerBinaryError`
Error for missing runner binary.

Expand All @@ -97,7 +108,7 @@ Error for missing runner binary.

---

<a href="../src/errors.py#L42"><img align="right" style="float:right;" src="https://img.shields.io/badge/-source-cccccc?style=flat-square"></a>
<a href="../src/errors.py#L46"><img align="right" style="float:right;" src="https://img.shields.io/badge/-source-cccccc?style=flat-square"></a>

## <kbd>class</kbd> `ConfigurationError`
Error for juju configuration.
Expand All @@ -108,7 +119,7 @@ Error for juju configuration.

---

<a href="../src/errors.py#L46"><img align="right" style="float:right;" src="https://img.shields.io/badge/-source-cccccc?style=flat-square"></a>
<a href="../src/errors.py#L50"><img align="right" style="float:right;" src="https://img.shields.io/badge/-source-cccccc?style=flat-square"></a>

## <kbd>class</kbd> `MissingMongoDBError`
Error for missing integration data.
Expand All @@ -119,7 +130,7 @@ Error for missing integration data.

---

<a href="../src/errors.py#L50"><img align="right" style="float:right;" src="https://img.shields.io/badge/-source-cccccc?style=flat-square"></a>
<a href="../src/errors.py#L54"><img align="right" style="float:right;" src="https://img.shields.io/badge/-source-cccccc?style=flat-square"></a>

## <kbd>class</kbd> `LxdError`
Error for executing LXD actions.
Expand All @@ -130,7 +141,7 @@ Error for executing LXD actions.

---

<a href="../src/errors.py#L54"><img align="right" style="float:right;" src="https://img.shields.io/badge/-source-cccccc?style=flat-square"></a>
<a href="../src/errors.py#L58"><img align="right" style="float:right;" src="https://img.shields.io/badge/-source-cccccc?style=flat-square"></a>

## <kbd>class</kbd> `SubprocessError`
Error for Subprocess calls.
Expand All @@ -144,7 +155,7 @@ Error for Subprocess calls.
- <b>`stdout`</b>: Content of stdout of the subprocess.
- <b>`stderr`</b>: Content of stderr of the subprocess.

<a href="../src/errors.py#L64"><img align="right" style="float:right;" src="https://img.shields.io/badge/-source-cccccc?style=flat-square"></a>
<a href="../src/errors.py#L68"><img align="right" style="float:right;" src="https://img.shields.io/badge/-source-cccccc?style=flat-square"></a>

### <kbd>method</kbd> `__init__`

Expand Down Expand Up @@ -174,7 +185,7 @@ Construct the subprocess error.

---

<a href="../src/errors.py#L87"><img align="right" style="float:right;" src="https://img.shields.io/badge/-source-cccccc?style=flat-square"></a>
<a href="../src/errors.py#L91"><img align="right" style="float:right;" src="https://img.shields.io/badge/-source-cccccc?style=flat-square"></a>

## <kbd>class</kbd> `IssueMetricEventError`
Represents an error when issuing a metric event.
Expand All @@ -185,7 +196,7 @@ Represents an error when issuing a metric event.

---

<a href="../src/errors.py#L91"><img align="right" style="float:right;" src="https://img.shields.io/badge/-source-cccccc?style=flat-square"></a>
<a href="../src/errors.py#L95"><img align="right" style="float:right;" src="https://img.shields.io/badge/-source-cccccc?style=flat-square"></a>

## <kbd>class</kbd> `LogrotateSetupError`
Represents an error raised when logrotate cannot be setup.
Expand All @@ -196,7 +207,7 @@ Represents an error raised when logrotate cannot be setup.

---

<a href="../src/errors.py#L95"><img align="right" style="float:right;" src="https://img.shields.io/badge/-source-cccccc?style=flat-square"></a>
<a href="../src/errors.py#L99"><img align="right" style="float:right;" src="https://img.shields.io/badge/-source-cccccc?style=flat-square"></a>

## <kbd>class</kbd> `MetricsStorageError`
Base class for all metrics storage errors.
Expand All @@ -207,7 +218,7 @@ Base class for all metrics storage errors.

---

<a href="../src/errors.py#L99"><img align="right" style="float:right;" src="https://img.shields.io/badge/-source-cccccc?style=flat-square"></a>
<a href="../src/errors.py#L103"><img align="right" style="float:right;" src="https://img.shields.io/badge/-source-cccccc?style=flat-square"></a>

## <kbd>class</kbd> `SharedFilesystemError`
Base class for all shared filesystem errors.
Expand All @@ -218,7 +229,7 @@ Base class for all shared filesystem errors.

---

<a href="../src/errors.py#L103"><img align="right" style="float:right;" src="https://img.shields.io/badge/-source-cccccc?style=flat-square"></a>
<a href="../src/errors.py#L107"><img align="right" style="float:right;" src="https://img.shields.io/badge/-source-cccccc?style=flat-square"></a>

## <kbd>class</kbd> `CreateMetricsStorageError`
Represents an error when the metrics storage could not be created.
Expand All @@ -229,7 +240,7 @@ Represents an error when the metrics storage could not be created.

---

<a href="../src/errors.py#L107"><img align="right" style="float:right;" src="https://img.shields.io/badge/-source-cccccc?style=flat-square"></a>
<a href="../src/errors.py#L111"><img align="right" style="float:right;" src="https://img.shields.io/badge/-source-cccccc?style=flat-square"></a>

## <kbd>class</kbd> `DeleteMetricsStorageError`
Represents an error when the metrics storage could not be deleted.
Expand All @@ -240,7 +251,7 @@ Represents an error when the metrics storage could not be deleted.

---

<a href="../src/errors.py#L111"><img align="right" style="float:right;" src="https://img.shields.io/badge/-source-cccccc?style=flat-square"></a>
<a href="../src/errors.py#L115"><img align="right" style="float:right;" src="https://img.shields.io/badge/-source-cccccc?style=flat-square"></a>

## <kbd>class</kbd> `GetMetricsStorageError`
Represents an error when the metrics storage could not be retrieved.
Expand All @@ -251,7 +262,7 @@ Represents an error when the metrics storage could not be retrieved.

---

<a href="../src/errors.py#L115"><img align="right" style="float:right;" src="https://img.shields.io/badge/-source-cccccc?style=flat-square"></a>
<a href="../src/errors.py#L119"><img align="right" style="float:right;" src="https://img.shields.io/badge/-source-cccccc?style=flat-square"></a>

## <kbd>class</kbd> `QuarantineMetricsStorageError`
Represents an error when the metrics storage could not be quarantined.
Expand All @@ -262,7 +273,7 @@ Represents an error when the metrics storage could not be quarantined.

---

<a href="../src/errors.py#L119"><img align="right" style="float:right;" src="https://img.shields.io/badge/-source-cccccc?style=flat-square"></a>
<a href="../src/errors.py#L123"><img align="right" style="float:right;" src="https://img.shields.io/badge/-source-cccccc?style=flat-square"></a>

## <kbd>class</kbd> `SharedFilesystemMountError`
Represents an error related to the mounting of the shared filesystem.
Expand All @@ -273,7 +284,7 @@ Represents an error related to the mounting of the shared filesystem.

---

<a href="../src/errors.py#L123"><img align="right" style="float:right;" src="https://img.shields.io/badge/-source-cccccc?style=flat-square"></a>
<a href="../src/errors.py#L127"><img align="right" style="float:right;" src="https://img.shields.io/badge/-source-cccccc?style=flat-square"></a>

## <kbd>class</kbd> `GithubMetricsError`
Base class for all github metrics errors.
Expand All @@ -284,7 +295,7 @@ Base class for all github metrics errors.

---

<a href="../src/errors.py#L127"><img align="right" style="float:right;" src="https://img.shields.io/badge/-source-cccccc?style=flat-square"></a>
<a href="../src/errors.py#L131"><img align="right" style="float:right;" src="https://img.shields.io/badge/-source-cccccc?style=flat-square"></a>

## <kbd>class</kbd> `GithubClientError`
Base class for all github client errors.
Expand All @@ -295,7 +306,7 @@ Base class for all github client errors.

---

<a href="../src/errors.py#L131"><img align="right" style="float:right;" src="https://img.shields.io/badge/-source-cccccc?style=flat-square"></a>
<a href="../src/errors.py#L135"><img align="right" style="float:right;" src="https://img.shields.io/badge/-source-cccccc?style=flat-square"></a>

## <kbd>class</kbd> `GithubApiError`
Represents an error when the GitHub API returns an error.
Expand All @@ -306,7 +317,7 @@ Represents an error when the GitHub API returns an error.

---

<a href="../src/errors.py#L135"><img align="right" style="float:right;" src="https://img.shields.io/badge/-source-cccccc?style=flat-square"></a>
<a href="../src/errors.py#L139"><img align="right" style="float:right;" src="https://img.shields.io/badge/-source-cccccc?style=flat-square"></a>

## <kbd>class</kbd> `TokenError`
Represents an error when the token is invalid or has not enough permissions.
Expand All @@ -317,7 +328,7 @@ Represents an error when the token is invalid or has not enough permissions.

---

<a href="../src/errors.py#L139"><img align="right" style="float:right;" src="https://img.shields.io/badge/-source-cccccc?style=flat-square"></a>
<a href="../src/errors.py#L143"><img align="right" style="float:right;" src="https://img.shields.io/badge/-source-cccccc?style=flat-square"></a>

## <kbd>class</kbd> `JobNotFoundError`
Represents an error when the job could not be found on GitHub.
Expand All @@ -328,7 +339,7 @@ Represents an error when the job could not be found on GitHub.

---

<a href="../src/errors.py#L143"><img align="right" style="float:right;" src="https://img.shields.io/badge/-source-cccccc?style=flat-square"></a>
<a href="../src/errors.py#L147"><img align="right" style="float:right;" src="https://img.shields.io/badge/-source-cccccc?style=flat-square"></a>

## <kbd>class</kbd> `RunnerLogsError`
Base class for all runner logs errors.
Expand Down
6 changes: 5 additions & 1 deletion src/charm.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,10 @@ def __init__(self, *args: Any, **kwargs: Any) -> None:
self.on[DEBUG_SSH_INTEGRATION_NAME].relation_changed,
self._on_debug_ssh_relation_changed,
)
self.framework.observe(
self.on[IMAGE_INTEGRATION_NAME].relation_joined,
self._on_image_relation_joined,
)
self.framework.observe(
self.on[IMAGE_INTEGRATION_NAME].relation_changed,
self._on_image_relation_changed,
Expand Down Expand Up @@ -1187,7 +1191,7 @@ def _on_image_relation_joined(self, _: ops.RelationJoinedEvent) -> None:
cloud = list(clouds_yaml["clouds"].keys())[0]
auth_map = clouds_yaml["clouds"][cloud]["auth"]
for relation in self.model.relations[IMAGE_INTEGRATION_NAME]:
relation.data[self.model.unit].update(auth_map)
relation.data[self.unit].update(auth_map)

@catch_charm_errors
def _on_image_relation_changed(self, _: ops.RelationChangedEvent) -> None:
Expand Down
4 changes: 4 additions & 0 deletions src/errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ class RunnerAproxyError(RunnerError):
"""Error for setting up aproxy."""


class MissingServerConfigError(RunnerError):
"""Error for unable to create runner due to missing server configurations."""


class MissingRunnerBinaryError(Exception):
"""Error for missing runner binary."""

Expand Down
Empty file.
Empty file added src/manager/runner_manager.py
Empty file.
Loading

0 comments on commit 2c86775

Please sign in to comment.