Skip to content

Commit

Permalink
Merge 64f9fc7 into b35b3be
Browse files Browse the repository at this point in the history
  • Loading branch information
swetha1654 authored Jan 10, 2025
2 parents b35b3be + 64f9fc7 commit e0e94ec
Show file tree
Hide file tree
Showing 70 changed files with 76 additions and 74 deletions.
2 changes: 1 addition & 1 deletion actions.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2024 Canonical Ltd.
# Copyright 2025 Canonical Ltd.
# See LICENSE file for licensing details.

check-runners:
Expand Down
2 changes: 1 addition & 1 deletion charmcraft.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2024 Canonical Ltd.
# Copyright 2025 Canonical Ltd.
# See LICENSE file for licensing details.

type: charm
Expand Down
2 changes: 1 addition & 1 deletion config.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2024 Canonical Ltd.
# Copyright 2025 Canonical Ltd.
# See LICENSE file for licensing details.

options:
Expand Down
2 changes: 1 addition & 1 deletion generate-src-docs.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env bash

# Copyright 2024 Canonical Ltd.
# Copyright 2025 Canonical Ltd.
# See LICENSE file for licensing details.

lazydocs --no-watermark --output-path src-docs src/*.py
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 2024 Canonical Ltd.
# Copyright 2025 Canonical Ltd.
# See LICENSE file for licensing details.

name: github-runner
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 2024 Canonical Ltd.
# Copyright 2025 Canonical Ltd.
# See LICENSE file for licensing details.

[tool.bandit]
Expand Down
1 change: 0 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,4 @@ cosl ==0.0.47
# juju 3.1.2.0 depends on pyyaml<=6.0 and >=5.1.2
PyYAML ==6.0.*
pyOpenSSL==24.3.0
allure-pytest>=2.8.18
./github-runner-manager
2 changes: 1 addition & 1 deletion scripts/build-lxd-image.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env bash

# Copyright 2024 Canonical Ltd.
# Copyright 2025 Canonical Ltd.
# See LICENSE file for licensing details.

set -e
Expand Down
2 changes: 1 addition & 1 deletion scripts/build-openstack-image.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env bash

# Copyright 2024 Canonical Ltd.
# Copyright 2025 Canonical Ltd.
# See LICENSE file for licensing details.

set -euo pipefail
Expand Down
2 changes: 1 addition & 1 deletion scripts/pre-integration-test.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env bash

# Copyright 2024 Canonical Ltd.
# Copyright 2025 Canonical Ltd.
# See LICENSE file for licensing details.

# Enable kernel module br_netfilter
Expand Down
2 changes: 1 addition & 1 deletion scripts/repo_policy_compliance_service.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2024 Canonical Ltd.
# Copyright 2025 Canonical Ltd.
# See LICENSE file for licensing details.

"""Flask application for repo policy compliance.
Expand Down
2 changes: 1 addition & 1 deletion scripts/setup-lxd.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env bash

# Copyright 2024 Canonical Ltd.
# Copyright 2025 Canonical Ltd.
# See LICENSE file for licensing details.

# Script to setup LXD for testing
Expand Down
2 changes: 1 addition & 1 deletion src/charm.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python3

# Copyright 2024 Canonical Ltd.
# Copyright 2025 Canonical Ltd.
# See LICENSE file for licensing details.

# TODO: 2024-03-12 The module contains too many lines which are scheduled for refactoring.
Expand Down
2 changes: 1 addition & 1 deletion src/charm_state.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2024 Canonical Ltd.
# Copyright 2025 Canonical Ltd.
# See LICENSE file for licensing details.

# TODO: 2024-06-26 The charm contains a lot of states and configuration. The upcoming refactor will
Expand Down
2 changes: 1 addition & 1 deletion src/errors.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2024 Canonical Ltd.
# Copyright 2025 Canonical Ltd.
# See LICENSE file for licensing details.

"""Errors used by the charm."""
Expand Down
2 changes: 1 addition & 1 deletion src/event_timer.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2024 Canonical Ltd.
# Copyright 2025 Canonical Ltd.
# See LICENSE file for licensing details.

"""EventTimer for scheduling dispatch of juju event on regular intervals."""
Expand Down
2 changes: 1 addition & 1 deletion src/firewall.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2024 Canonical Ltd.
# Copyright 2025 Canonical Ltd.
# See LICENSE file for licensing details.

"""The runner firewall manager."""
Expand Down
2 changes: 1 addition & 1 deletion src/github_client.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2024 Canonical Ltd.
# Copyright 2025 Canonical Ltd.
# See LICENSE file for licensing details.

"""GitHub API client.
Expand Down
2 changes: 1 addition & 1 deletion src/logrotate.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2024 Canonical Ltd.
# Copyright 2025 Canonical Ltd.
# See LICENSE file for licensing details.

"""Logrotate setup and configuration."""
Expand Down
2 changes: 1 addition & 1 deletion src/lxd.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2024 Canonical Ltd.
# Copyright 2025 Canonical Ltd.
# See LICENSE file for licensing details.

"""Low-level LXD client interface.
Expand Down
2 changes: 1 addition & 1 deletion src/lxd_type.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2024 Canonical Ltd.
# Copyright 2025 Canonical Ltd.
# See LICENSE file for licensing details.

"""Types used by Lxd class.
Expand Down
2 changes: 1 addition & 1 deletion src/runner.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2024 Canonical Ltd.
# Copyright 2025 Canonical Ltd.
# See LICENSE file for licensing details.

"""Manage the lifecycle of runners.
Expand Down
2 changes: 1 addition & 1 deletion src/runner_manager.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2024 Canonical Ltd.
# Copyright 2025 Canonical Ltd.
# See LICENSE file for licensing details.

"""Runner Manager manages the runners on LXD and GitHub."""
Expand Down
2 changes: 1 addition & 1 deletion src/runner_manager_type.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2024 Canonical Ltd.
# Copyright 2025 Canonical Ltd.
# See LICENSE file for licensing details.

"""Types used by RunnerManager class."""
Expand Down
2 changes: 1 addition & 1 deletion src/runner_type.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2024 Canonical Ltd.
# Copyright 2025 Canonical Ltd.
# See LICENSE file for licensing details.

"""Types used by Runner class."""
Expand Down
2 changes: 1 addition & 1 deletion src/shared_fs.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2024 Canonical Ltd.
# Copyright 2025 Canonical Ltd.
# See LICENSE file for licensing details.

"""Classes and functions to operate on the shared filesystem between the charm and the runners."""
Expand Down
2 changes: 1 addition & 1 deletion src/utilities.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2024 Canonical Ltd.
# Copyright 2025 Canonical Ltd.
# See LICENSE file for licensing details.

"""Utilities used by the charm."""
Expand Down
2 changes: 1 addition & 1 deletion tests/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# Copyright 2024 Canonical Ltd.
# Copyright 2025 Canonical Ltd.
# See LICENSE file for licensing details.
2 changes: 1 addition & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2024 Canonical Ltd.
# Copyright 2025 Canonical Ltd.
# See LICENSE file for licensing details.

"""Fixtures for github runner charm."""
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# Copyright 2024 Canonical Ltd.
# Copyright 2025 Canonical Ltd.
# See LICENSE file for licensing details.
12 changes: 7 additions & 5 deletions tests/integration/conftest.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2024 Canonical Ltd.
# Copyright 2025 Canonical Ltd.
# See LICENSE file for licensing details.

"""Fixtures for github runner charm integration tests."""
Expand Down Expand Up @@ -570,11 +570,13 @@ async def tmate_ssh_server_unit_ip_fixture(
tmate_ssh_server_app: Application,
) -> bytes | str:
"""tmate-ssh-server charm unit ip."""
status: FullStatus = await model.get_status([tmate_ssh_server_app.name])
app_name = tmate_ssh_server_app.name
status: FullStatus = await model.get_status([app_name])
app_status = status.applications[app_name]
assert app_status is not None, f"Application {app_name} not found in status"
try:
unit_status: UnitStatus = next(
iter(status.applications[tmate_ssh_server_app.name].units.values())
)
# mypy does not recognize that app_status is of type ApplicationStatus
unit_status: UnitStatus = next(iter(app_status.units.values())) # type: ignore
assert unit_status.public_address, "Invalid unit address"
return unit_status.public_address
except StopIteration as exc:
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/data/clouds.yaml.tmpl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2024 Canonical Ltd.
# Copyright 2025 Canonical Ltd.
# See LICENSE file for licensing details.
clouds:
testcloud:
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/helpers/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# Copyright 2024 Canonical Ltd.
# Copyright 2025 Canonical Ltd.
# See LICENSE file for licensing details.
2 changes: 1 addition & 1 deletion tests/integration/helpers/charm_metrics.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2024 Canonical Ltd.
# Copyright 2025 Canonical Ltd.
# See LICENSE file for licensing details.

"""Utilities for charm metrics integration tests."""
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/helpers/common.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2024 Canonical Ltd.
# Copyright 2025 Canonical Ltd.
# See LICENSE file for licensing details.

"""Utilities for integration test."""
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/helpers/lxd.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2024 Canonical Ltd.
# Copyright 2025 Canonical Ltd.
# See LICENSE file for licensing details.
import json
import logging
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/helpers/openstack.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2024 Canonical Ltd.
# Copyright 2025 Canonical Ltd.
# See LICENSE file for licensing details.
import logging
import secrets
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/test_charm_base_image.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2024 Canonical Ltd.
# Copyright 2025 Canonical Ltd.
# See LICENSE file for licensing details.

"""Integration tests for github-runner charm containing one runner."""
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/test_charm_fork_repo.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2024 Canonical Ltd.
# Copyright 2025 Canonical Ltd.
# See LICENSE file for licensing details.

"""Integration tests for github-runner charm with a fork repo.
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/test_charm_lxd_runner.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2024 Canonical Ltd.
# Copyright 2025 Canonical Ltd.
# See LICENSE file for licensing details.

"""Integration tests for github-runner charm containing one runner."""
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/test_charm_metrics_failure.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2024 Canonical Ltd.
# Copyright 2025 Canonical Ltd.
# See LICENSE file for licensing details.

"""Integration tests for metrics/logs assuming Github workflow failures or a runner crash."""
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/test_charm_metrics_success.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2024 Canonical Ltd.
# Copyright 2025 Canonical Ltd.
# See LICENSE file for licensing details.

"""Integration tests for metrics/logs assuming no Github workflow failures."""
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/test_charm_no_runner.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2024 Canonical Ltd.
# Copyright 2025 Canonical Ltd.
# See LICENSE file for licensing details.

"""Integration tests for github-runner charm with no runner."""
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/test_charm_runner.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2024 Canonical Ltd.
# Copyright 2025 Canonical Ltd.
# See LICENSE file for licensing details.

"""Integration tests for github-runner charm containing one runner."""
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/test_charm_scheduled_events.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2024 Canonical Ltd.
# Copyright 2025 Canonical Ltd.
# See LICENSE file for licensing details.

"""Integration tests for github-runner charm with scheduled events.
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/test_charm_upgrade.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2024 Canonical Ltd.
# Copyright 2025 Canonical Ltd.
# See LICENSE file for licensing details.

"""Integration tests for charm upgrades."""
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/test_charm_with_juju_storage.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2024 Canonical Ltd.
# Copyright 2025 Canonical Ltd.
# See LICENSE file for licensing details.

"""Integration tests for github-runner charm with juju-storage as disk."""
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/test_charm_with_proxy.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2024 Canonical Ltd.
# Copyright 2025 Canonical Ltd.
# See LICENSE file for licensing details.

"""Test the usage of a proxy server."""
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/test_debug_ssh.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2024 Canonical Ltd.
# Copyright 2025 Canonical Ltd.
# See LICENSE file for licensing details.

"""Integration tests for github-runner charm with ssh-debug integration."""
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/test_e2e.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2024 Canonical Ltd.
# Copyright 2025 Canonical Ltd.
# See LICENSE file for licensing details.
from typing import AsyncIterator

Expand Down
2 changes: 1 addition & 1 deletion tests/integration/test_reactive.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2024 Canonical Ltd.
# Copyright 2025 Canonical Ltd.
# See LICENSE file for licensing details.

"""Testing reactive mode. This is only supported for the OpenStack cloud."""
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/test_runner_manager_openstack.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2024 Canonical Ltd.
# Copyright 2025 Canonical Ltd.
# See LICENSE file for licensing details.

"""Testing the RunnerManager class with OpenStackRunnerManager as CloudManager.
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/test_self_hosted_runner.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2024 Canonical Ltd.
# Copyright 2025 Canonical Ltd.
# See LICENSE file for licensing details.

"""Integration tests for self-hosted runner managed by the github-runner charm."""
Expand Down
2 changes: 1 addition & 1 deletion tests/status_name.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2024 Canonical Ltd.
# Copyright 2025 Canonical Ltd.
# See LICENSE file for licensing details.

from ops.model import ActiveStatus, BlockedStatus
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# Copyright 2024 Canonical Ltd.
# Copyright 2025 Canonical Ltd.
# See LICENSE file for licensing details.
2 changes: 1 addition & 1 deletion tests/unit/conftest.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2024 Canonical Ltd.
# Copyright 2025 Canonical Ltd.
# See LICENSE file for licensing details.

import copy
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/factories.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2024 Canonical Ltd.
# Copyright 2025 Canonical Ltd.
# See LICENSE file for licensing details.

"""Factories for generating test data."""
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/mock.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2024 Canonical Ltd.
# Copyright 2025 Canonical Ltd.
# See LICENSE file for licensing details.

"""Mock for testing."""
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/mock_runner_managers.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2024 Canonical Ltd.
# Copyright 2025 Canonical Ltd.
# See LICENSE file for licensing details.

import random
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/test_charm.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2024 Canonical Ltd.
# Copyright 2025 Canonical Ltd.
# See LICENSE file for licensing details.

"""Test cases for GithubRunnerCharm."""
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/test_charm_state.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2024 Canonical Ltd.
# Copyright 2025 Canonical Ltd.
# See LICENSE file for licensing details.
import json
import logging
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/test_event_timer.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2024 Canonical Ltd.
# Copyright 2025 Canonical Ltd.
# See LICENSE file for licensing details.
import secrets

Expand Down
2 changes: 1 addition & 1 deletion tests/unit/test_firewall.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2024 Canonical Ltd.
# Copyright 2025 Canonical Ltd.
# See LICENSE file for licensing details.

"""Test cases for firewall module."""
Expand Down
Loading

0 comments on commit e0e94ec

Please sign in to comment.