Skip to content

Commit

Permalink
merge main
Browse files Browse the repository at this point in the history
  • Loading branch information
cbartz committed Jul 10, 2024
2 parents 66dae97 + 6805697 commit a2106f6
Show file tree
Hide file tree
Showing 24 changed files with 610 additions and 778 deletions.
8 changes: 7 additions & 1 deletion .github/workflows/integration_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ name: integration-tests
on:
pull_request:

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
# test option values defined at test/conftest.py are passed on via repository secret
# INTEGRATION_TEST_ARGS to operator-workflows automatically.
Expand All @@ -16,6 +20,8 @@ jobs:
provider: lxd
test-tox-env: integration-juju2.9
modules: '["test_charm_base_image", "test_charm_fork_repo", "test_charm_no_runner", "test_charm_scheduled_events", "test_charm_lxd_runner", "test_charm_runner", "test_charm_metrics_success", "test_charm_metrics_failure", "test_self_hosted_runner", "test_charm_with_proxy", "test_charm_with_juju_storage", "test_debug_ssh", "test_charm_upgrade"]'
self-hosted-runner: true
self-hosted-runner-label: xlarge,X64
integration-tests:
name: Integration test with juju 3.1
uses: canonical/operator-workflows/.github/workflows/integration_test.yaml@main
Expand All @@ -38,4 +44,4 @@ jobs:
modules: '["test_charm_metrics_failure", "test_charm_metrics_success", "test_charm_fork_repo", "test_charm_runner", "test_e2e", "test_reactive"]'
extra-arguments: "-m openstack --openstack-flavor-name=builder-cpu4-ram8-disk50 --http-proxy=http://squid.internal:3128 --https-proxy=http://squid.internal:3128 --no-proxy=keystone.ps6.canonical.com,glance.ps6.canonical.com,nova.ps6.canonical.com,neutron.ps6.canonical.com"
self-hosted-runner: true
self-hosted-runner-label: stg-private-endpoint
self-hosted-runner-label: stg-private-endpoint
1 change: 0 additions & 1 deletion charmcraft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ parts:
- pkg-config # for cryptography
prime:
- scripts/build-lxd-image.sh
- scripts/build-openstack-image.sh
- scripts/reactive_runner.py
- scripts/repo_policy_compliance_service.py
bases:
Expand Down
16 changes: 15 additions & 1 deletion docs/how-to/openstack-runner.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,20 @@ enabled the charm cannot be changed to use other virtualization methods.

There are three configuration that the charm needs to be deployed with to enable OpenStack integration: `openstack-clouds-yaml`, `openstack-flavor`, and `openstack-network`.

## Integration

The image will take about 10-15 minutes to build and be fully integrated. Deploy the
`github-runner-image-builder` charm and wait for the image to be successfully provided via the
relation data.

```bash
juju deploy github-runner-image-builder
juju integrate github-runner-image-builder github-runner
juju status github-runner
```

The image will take about 10-15 minutes to build and be ready via the relation.

### OpenStack clouds.yaml

The `openstack-clouds-yaml` configuration contains the authorization information needed for the charm to log in to the openstack cloud.
Expand Down Expand Up @@ -38,7 +52,7 @@ The flavors documentation is [here](https://docs.openstack.org/nova/rocky/user/f

### OpenStack Network

The `openstack-network` configuration sets the network used to create the OpenStack virtual machine when spawning new runners.
The `openstack-network` configuration sets the network used to create the OpenStack virtual machine when spawning new runners.

Note that the network should be configured to allow traffic from the charm deployment (juju machine) to the OpenStack virtual machine, and traffic from the OpenStack virtual machine to GitHub.

Expand Down
2 changes: 2 additions & 0 deletions metadata.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ provides:
requires:
debug-ssh:
interface: debug-ssh
image:
interface: github_runner_image_v0
mongodb:
interface: mongodb_client
limit: 1
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ jinja2
fabric >=3,<4
openstacksdk>=3,<4
ops>=2.8
pylxd @ git+https://github.com/canonical/pylxd
pylxd @ git+https://github.com/canonical/pylxd@46b58e61a465a970937cd97bbbf93622f98caa8c
requests
typing-extensions
cryptography <=42.0.5
Expand Down
1 change: 1 addition & 0 deletions src-docs/charm.py.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Charm for creating and managing GitHub self-hosted runner instances.
---------------
- **DEBUG_SSH_INTEGRATION_NAME**
- **GROUP_CONFIG_NAME**
- **IMAGE_INTEGRATION_NAME**
- **LABELS_CONFIG_NAME**
- **PATH_CONFIG_NAME**
- **RECONCILE_INTERVAL_CONFIG_NAME**
Expand Down
83 changes: 62 additions & 21 deletions src-docs/charm_state.py.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ State of the Charm.
- **OPENSTACK_CLOUDS_YAML_CONFIG_NAME**
- **OPENSTACK_NETWORK_CONFIG_NAME**
- **OPENSTACK_FLAVOR_CONFIG_NAME**
- **OPENSTACK_IMAGE_BUILD_UNIT_CONFIG_NAME**
- **PATH_CONFIG_NAME**
- **RECONCILE_INTERVAL_CONFIG_NAME**
- **REPO_POLICY_COMPLIANCE_TOKEN_CONFIG_NAME**
Expand All @@ -32,12 +31,13 @@ State of the Charm.
- **VM_DISK_CONFIG_NAME**
- **COS_AGENT_INTEGRATION_NAME**
- **DEBUG_SSH_INTEGRATION_NAME**
- **IMAGE_INTEGRATION_NAME**
- **MONGO_DB_INTEGRATION_NAME**
- **LTS_IMAGE_VERSION_TAG_MAP**

---

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

## <kbd>function</kbd> `parse_github_path`

Expand Down Expand Up @@ -138,7 +138,7 @@ Some charm configurations are grouped into other configuration models.

---

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

### <kbd>classmethod</kbd> `check_reconcile_interval`

Expand Down Expand Up @@ -167,7 +167,7 @@ Validate the general charm configuration.

---

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

### <kbd>classmethod</kbd> `from_charm`

Expand Down Expand Up @@ -206,7 +206,7 @@ Raised when charm config is invalid.

- <b>`msg`</b>: Explanation of the error.

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

### <kbd>function</kbd> `__init__`

Expand Down Expand Up @@ -249,7 +249,7 @@ The charm state.

---

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

### <kbd>classmethod</kbd> `from_charm`

Expand Down Expand Up @@ -295,7 +295,7 @@ Charm configuration related to GitHub.

---

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

### <kbd>classmethod</kbd> `from_charm`

Expand Down Expand Up @@ -340,7 +340,7 @@ Represent GitHub organization.

---

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

### <kbd>function</kbd> `path`

Expand Down Expand Up @@ -373,7 +373,7 @@ Represent GitHub repository.

---

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

### <kbd>function</kbd> `path`

Expand All @@ -394,7 +394,7 @@ Return a string representing the path.
## <kbd>class</kbd> `ImmutableConfigChangedError`
Represents an error when changing immutable charm state.

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

### <kbd>function</kbd> `__init__`

Expand Down Expand Up @@ -449,7 +449,7 @@ Runner configurations for local LXD instances.

---

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

### <kbd>classmethod</kbd> `check_virtual_machine_resources`

Expand Down Expand Up @@ -480,7 +480,7 @@ Validate the virtual_machine_resources field values.

---

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

### <kbd>classmethod</kbd> `check_virtual_machines`

Expand Down Expand Up @@ -509,7 +509,7 @@ Validate the virtual machines configuration value.

---

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

### <kbd>classmethod</kbd> `from_charm`

Expand Down Expand Up @@ -537,6 +537,47 @@ Initialize the config from charm.
Local LXD runner config of the charm.


---

## <kbd>class</kbd> `OpenstackImage`
OpenstackImage from image builder relation data.



**Attributes:**

- <b>`id`</b>: The OpenStack image ID.
- <b>`tags`</b>: Image tags, e.g. jammy




---

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

### <kbd>classmethod</kbd> `from_charm`

```python
from_charm(charm: CharmBase) → OpenstackImage | None
```

Initialize the OpenstackImage info from relation data.

None represents relation not established. None values for id/tags represent image not yet ready but the relation exists.



**Args:**

- <b>`charm`</b>: The charm instance.



**Returns:**
OpenstackImage metadata from charm relation data.


---

## <kbd>class</kbd> `OpenstackRunnerConfig`
Expand All @@ -549,14 +590,14 @@ Runner configuration for OpenStack Instances.
- <b>`virtual_machines`</b>: Number of virtual machine-based runner to spawn.
- <b>`openstack_flavor`</b>: flavor on openstack to use for virtual machines.
- <b>`openstack_network`</b>: Network on openstack to use for virtual machines.
- <b>`build_image`</b>: Whether to build the image on this juju unit.
- <b>`openstack_image`</b>: Openstack image to use for virtual machines.




---

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

### <kbd>classmethod</kbd> `from_charm`

Expand Down Expand Up @@ -610,7 +651,7 @@ Return the aproxy address.

---

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

### <kbd>classmethod</kbd> `check_use_aproxy`

Expand Down Expand Up @@ -640,7 +681,7 @@ Validate the proxy configuration.

---

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

### <kbd>classmethod</kbd> `from_charm`

Expand Down Expand Up @@ -678,7 +719,7 @@ Represents the configuration for reactive scheduling.

---

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

### <kbd>classmethod</kbd> `from_database`

Expand Down Expand Up @@ -723,7 +764,7 @@ Configuration for the repo policy compliance service.

---

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

### <kbd>classmethod</kbd> `from_charm`

Expand Down Expand Up @@ -786,7 +827,7 @@ SSH connection information for debug workflow.

---

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

### <kbd>classmethod</kbd> `from_charm`

Expand Down Expand Up @@ -819,7 +860,7 @@ Raised when given machine charm architecture is unsupported.

- <b>`arch`</b>: The current machine architecture.

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

### <kbd>function</kbd> `__init__`

Expand Down
18 changes: 0 additions & 18 deletions src-docs/errors.py.md
Original file line number Diff line number Diff line change
Expand Up @@ -169,24 +169,6 @@ Represents an unauthorized connection to OpenStack.



---

## <kbd>class</kbd> `OpenstackImageBuildError`
Exception representing an error during image build process.





---

## <kbd>class</kbd> `OpenstackInstanceLaunchError`
Exception representing an error during instance launch process.





---

## <kbd>class</kbd> `QuarantineMetricsStorageError`
Expand Down
Loading

0 comments on commit a2106f6

Please sign in to comment.