Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean lxd code #423

Merged
merged 85 commits into from
Jan 27, 2025
Merged

Clean lxd code #423

merged 85 commits into from
Jan 27, 2025

Conversation

javierdelapuente
Copy link
Collaborator

@javierdelapuente javierdelapuente commented Dec 18, 2024

Applicable spec:

Overview

This PR removed LXD runners from the main branch. The reason for this is that there were really two different code paths without a common interface in the charm.

LXD runners will still be supported in the track local-lxd (see announcement) https://discourse.charmhub.io/t/important-update-new-track-local-lxd-for-lxd-runners-in-the-github-runner-charm/16139.

This PR has also strong implications for documentation, as lot of information is now outdated. As a first step it has been removed, but some of it, like a tutorial, will have to be created in following PRs.

Rationale

Maintaining two codepaths inhibits big refactors and also is a risk for regression, as we are concentrating our development in openstack runners and we can break lxd. Having two different tracks brings clarity and reduces risks and improves maintanability.

If in the future lxd support is required in the main branch, it could be better added using a common interface for both types of runners, using an external lxc cluster (or microcloud cluster).

Juju Events Changes

Module Changes

Library Changes

Checklist

  • The charm style guide was applied.
  • The contributing guide was applied.
  • The changes are compliant with ISD054 - Managing Charm Complexity
  • The documentation is generated using src-docs.
  • The documentation for charmhub is updated.
  • The PR is tagged with appropriate label (urgent, trivial, complex).
  • The changelog is updated with changes that affects the users of the charm.
  • The changes do not introduce any regression in code or tests related to LXD runner mode.

docs/index.md Show resolved Hide resolved
Copy link
Collaborator

@cbartz cbartz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you Javi!

docs/index.md Show resolved Hide resolved
@@ -726,7 +670,7 @@ async def basic_app_fixture(request: pytest.FixtureRequest) -> Application:


@pytest_asyncio.fixture(scope="function", name="instance_helper")
async def instance_helper_fixture(request: pytest.FixtureRequest) -> InstanceHelper:
async def instance_helper_fixture(request: pytest.FixtureRequest) -> OpenStackInstanceHelper:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the dynamic fixture request is no longer required

charmcraft.yaml Show resolved Hide resolved
src-docs/errors.py.md Outdated Show resolved Hide resolved
Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

license-eye has checked 207 files.

Valid Invalid Ignored Fixed
0 46 161 0
Click to see the invalid file list
  • actions.yaml
  • charmcraft.yaml
  • config.yaml
  • metadata.yaml
  • pyproject.toml
  • scripts/setup-lxd.sh
  • src/charm.py
  • src/charm_state.py
  • src/errors.py
  • src/event_timer.py
  • src/logrotate.py
  • src/utilities.py
  • tests/init.py
  • tests/conftest.py
  • tests/integration/init.py
  • tests/integration/conftest.py
  • tests/integration/data/clouds.yaml.tmpl
  • tests/integration/helpers/init.py
  • tests/integration/helpers/charm_metrics.py
  • tests/integration/helpers/common.py
  • tests/integration/helpers/openstack.py
  • tests/integration/test_charm_fork_path_change.py
  • tests/integration/test_charm_fork_repo.py
  • tests/integration/test_charm_metrics_failure.py
  • tests/integration/test_charm_metrics_success.py
  • tests/integration/test_charm_no_runner.py
  • tests/integration/test_charm_runner.py
  • tests/integration/test_charm_scheduled_events.py
  • tests/integration/test_charm_upgrade.py
  • tests/integration/test_debug_ssh.py
  • tests/integration/test_e2e.py
  • tests/integration/test_reactive.py
  • tests/integration/test_runner_manager_openstack.py
  • tests/status_name.py
  • tests/unit/init.py
  • tests/unit/conftest.py
  • tests/unit/factories.py
  • tests/unit/mock.py
  • tests/unit/mock_runner_managers.py
  • tests/unit/test_charm.py
  • tests/unit/test_charm_state.py
  • tests/unit/test_event_timer.py
  • tests/unit/test_logrotate.py
  • tests/unit/test_runner_scaler.py
  • tests/unit/test_utilities.py
  • tox.ini
Use this command to fix any missing license headers
```bash

docker run -it --rm -v $(pwd):/github/workspace apache/skywalking-eyes header fix

</details>

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

license-eye has checked 207 files.

Valid Invalid Ignored Fixed
0 46 161 0
Click to see the invalid file list
  • actions.yaml
  • charmcraft.yaml
  • config.yaml
  • metadata.yaml
  • pyproject.toml
  • scripts/setup-lxd.sh
  • src/charm.py
  • src/charm_state.py
  • src/errors.py
  • src/event_timer.py
  • src/logrotate.py
  • src/utilities.py
  • tests/init.py
  • tests/conftest.py
  • tests/integration/init.py
  • tests/integration/conftest.py
  • tests/integration/data/clouds.yaml.tmpl
  • tests/integration/helpers/init.py
  • tests/integration/helpers/charm_metrics.py
  • tests/integration/helpers/common.py
  • tests/integration/helpers/openstack.py
  • tests/integration/test_charm_fork_path_change.py
  • tests/integration/test_charm_fork_repo.py
  • tests/integration/test_charm_metrics_failure.py
  • tests/integration/test_charm_metrics_success.py
  • tests/integration/test_charm_no_runner.py
  • tests/integration/test_charm_runner.py
  • tests/integration/test_charm_scheduled_events.py
  • tests/integration/test_charm_upgrade.py
  • tests/integration/test_debug_ssh.py
  • tests/integration/test_e2e.py
  • tests/integration/test_reactive.py
  • tests/integration/test_runner_manager_openstack.py
  • tests/status_name.py
  • tests/unit/init.py
  • tests/unit/conftest.py
  • tests/unit/factories.py
  • tests/unit/mock.py
  • tests/unit/mock_runner_managers.py
  • tests/unit/test_charm.py
  • tests/unit/test_charm_state.py
  • tests/unit/test_event_timer.py
  • tests/unit/test_logrotate.py
  • tests/unit/test_runner_scaler.py
  • tests/unit/test_utilities.py
  • tox.ini
Use this command to fix any missing license headers
```bash

docker run -it --rm -v $(pwd):/github/workspace apache/skywalking-eyes header fix

</details>

Copy link
Contributor

Test coverage for d59e5cb

Name                 Stmts   Miss Branch BrPart  Cover   Missing
----------------------------------------------------------------
src/charm.py           329     78     46      9    72%   266-268, 286-292, 307-308, 327-328, 343, 345, 347, 353-356, 380, 393-395, 417-418, 430-431, 454-455, 465, 514-516, 521-530, 586-619, 633-638, 653-696, 704-705, 727
src/charm_state.py     336     16     62      4    93%   220-232, 432-436, 519-520, 822->exit, 825->828, 832-833, 870-871
src/errors.py           13      0      0      0   100%
src/event_timer.py      52      6      0      0    88%   105-106, 143-144, 160-161
src/logrotate.py        43      0      2      0   100%
src/utilities.py        25      3      4      1    79%   66-69
----------------------------------------------------------------
TOTAL                  798    103    114     14    84%

Static code analysis report

Run started:2025-01-24 14:48:54.479369

Test results:
  No issues identified.

Code scanned:
  Total lines of code: 1602
  Total lines skipped (#nosec): 2
  Total potential issues skipped due to specifically being disabled (e.g., #nosec BXXX): 3

Run metrics:
  Total issues (by severity):
  	Undefined: 0
  	Low: 0
  	Medium: 0
  	High: 0
  Total issues (by confidence):
  	Undefined: 0
  	Low: 0
  	Medium: 0
  	High: 0
Files skipped (0):

@javierdelapuente javierdelapuente merged commit 7f693e2 into main Jan 27, 2025
53 of 55 checks passed
@javierdelapuente javierdelapuente deleted the clean-lxd-code3 branch January 27, 2025 07:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants