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

Add pull request template #66

Merged
merged 7 commits into from
Jan 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
Applicable spec: <link>

### Overview

<!-- A high level overview of the change -->

### Rationale

<!-- The reason the change is needed -->

### Juju Events Changes

<!-- Any changes to the juju events being observed (newly added, significantly modified or deleted) -->

### Module Changes

<!-- Any high level changes to modules and why (Service, Observer, helper) -->

### Library Changes

<!-- Any changes to charm libraries -->

### Checklist

- [ ] The [charm style guide](https://juju.is/docs/sdk/styleguide) was applied
- [ ] The [contributing guide](https://github.com/canonical/is-charms-contributing-guide) was applied
- [ ] The changes are compliant with [ISD054 - Managing Charm Complexity](https://discourse.charmhub.io/t/specification-isd014-managing-charm-complexity/11619)
- [ ] The documentation is generated using `src-docs`
arturo-seijas marked this conversation as resolved.
Show resolved Hide resolved
- [ ] The documentation for charmhub is updated
- [ ] The PR is tagged with appropriate label (`urgent`, `trivial`, `complex`)

<!-- Explanation for any unchecked items above -->
9 changes: 9 additions & 0 deletions docs/how-to/contribute.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,15 @@ Note that the [content-cache-image](content-cache.Dockerfile) image needs to be

* `tox -e integration`: Runs the integration tests.

### Generating src docs for every commit

Run the following command:

```bash
echo -e "tox -e src-docs\ngit add src-docs\n" >> .git/hooks/pre-commit
chmod +x .git/hooks/pre-commit
```

## Build charm

Build the charm in this git repository using:
Expand Down
6 changes: 6 additions & 0 deletions generate-src-docs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/usr/bin/env bash
arturo-seijas marked this conversation as resolved.
Show resolved Hide resolved

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

lazydocs --no-watermark --output-path src-docs src/*
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
cosl
ops>=1.2.0
tabulate
98 changes: 98 additions & 0 deletions src-docs/charm.py.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
<!-- markdownlint-disable -->

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

# <kbd>module</kbd> `charm.py`
Charm for Content-cache on Kubernetes.

**Global Variables**
---------------
- **REQUIRED_INGRESS_RELATION_FIELDS**
- **CACHE_PATH**
- **CONTAINER_NAME**
- **EXPORTER_CONTAINER_NAME**
- **CONTAINER_PORT**
- **REQUIRED_JUJU_CONFIGS**


---

## <kbd>class</kbd> `ContentCacheCharm`
Charm the service.

Attrs: on: Ingress Charm Events ERROR_LOG_PATH: NGINX error log ACCESS_LOG_PATH: NGINX access log _metrics_endpoint: Provider of metrics for Prometheus charm _logging: Requirer of logs for Loki charm _grafana_dashboards: Dashboard Provider for Grafana charm ingress_proxy_provides: Ingress proxy provider ingress: Ingress requirer unit: Charm's designated juju unit model: Charm's designated juju model

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

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

```python
__init__(*args)
```

Init function for the charm.



**Args:**

- <b>`args`</b>: Variable list of positional arguments passed to the parent constructor.


---

#### <kbd>property</kbd> app

Application that this unit is part of.

---

#### <kbd>property</kbd> charm_dir

Root directory of the charm as it is running.

---

#### <kbd>property</kbd> config

A mapping containing the charm's config and current values.

---

#### <kbd>property</kbd> meta

Metadata of this charm.

---

#### <kbd>property</kbd> model

Shortcut for more simple access the model.

---

#### <kbd>property</kbd> unit

Unit that this execution is responsible for.



---

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

### <kbd>function</kbd> `configure_workload_container`

```python
configure_workload_container(event: ConfigChangedEvent) → None
```

Configure/set up workload container inside pod.



**Args:**

- <b>`event`</b>: config-changed event.


32 changes: 32 additions & 0 deletions src-docs/file_reader.py.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<!-- markdownlint-disable -->

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

# <kbd>module</kbd> `file_reader.py`
Short module for file reverse reading.


---

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

## <kbd>function</kbd> `readlines_reverse`

```python
readlines_reverse(qfile) → Generator[int, NoneType, NoneType]
```

Read the lines of a file in reverse order in a lazy way.



**Args:**

- <b>`qfile`</b>: File in StringIO format.



**Yields:**
A row from the read file.


13 changes: 13 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,19 @@ commands =
-m pytest --ignore={[vars]tst_path}integration -v --tb native -s {posargs}
coverage report

[testenv:src-docs]
allowlist_externals=sh
setenv =
PYTHONPATH = {toxinidir}:{toxinidir}/lib:{[vars]src_path}
description = Generate documentation for src
deps =
cosl
lazydocs
-r{toxinidir}/requirements.txt
commands =
; can't run lazydocs directly due to needing to run it on src/* which produces an invocation error in tox
sh generate-src-docs.sh

[testenv:coverage-report]
description = Create test coverage report
deps =
Expand Down
Loading