-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from canonical/add-basics
[DPE-4942] - add mongos charm basics pt2 - add more suggestions from Carl
- Loading branch information
Showing
12 changed files
with
137 additions
and
459 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,22 +16,27 @@ on: | |
jobs: | ||
lint: | ||
name: Lint | ||
uses: canonical/data-platform-workflows/.github/workflows/lint.yaml@v16.7.0 | ||
uses: canonical/data-platform-workflows/.github/workflows/lint.yaml@v18.0.0 | ||
|
||
lib-check: | ||
name: Check libraries | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 5 | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
- run: | | ||
# Workaround for https://github.com/canonical/charmcraft/issues/1389#issuecomment-1880921728 | ||
touch requirements.txt | ||
- name: Check libs | ||
uses: canonical/charming-actions/check-libraries@2.4.0 | ||
uses: canonical/charming-actions/check-libraries@2.6.0 | ||
with: | ||
credentials: ${{ secrets.CHARMHUB_TOKEN }} # FIXME: current token will expire in 2023-07-04 | ||
credentials: ${{ secrets.CHARMHUB_TOKEN }} | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
use-labels: false | ||
fail-build: ${{ github.event_name == 'pull_request' }} | ||
|
||
unit-test: | ||
name: Unit test charm | ||
|
@@ -50,27 +55,23 @@ jobs: | |
uses: codecov/codecov-action@v3 | ||
|
||
build: | ||
name: Build charm | ${{ matrix.path }} | ||
uses: canonical/data-platform-workflows/.github/workflows/[email protected] | ||
strategy: | ||
matrix: | ||
path: | ||
- . | ||
name: Build charm | ||
uses: canonical/data-platform-workflows/.github/workflows/[email protected] | ||
with: | ||
cache: true | ||
path-to-charm-directory: ${{ matrix.path }} | ||
|
||
integration-test: | ||
name: Integration test charm | 3.4.4 | ||
needs: | ||
- lint | ||
- unit-test | ||
- build | ||
uses: canonical/data-platform-workflows/.github/workflows/integration_test_charm.yaml@v16.7.0 | ||
uses: canonical/data-platform-workflows/.github/workflows/integration_test_charm.yaml@v18.0.0 | ||
with: | ||
artifact-prefix: packed-charm-cache-true | ||
artifact-prefix: ${{ needs.build.outputs.artifact-prefix }} | ||
cloud: microk8s | ||
microk8s-snap-channel: 1.29-strict/stable | ||
juju-agent-version: 3.4.4 | ||
juju-agent-version: 3.4.4 # renovate: juju-agent-pin-minor | ||
_beta_allure_report: true | ||
permissions: | ||
contents: write # Needed for Allure Report beta |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,79 @@ | ||
# Contributing | ||
|
||
To make contributions to this charm, you'll need a working [development setup](https://juju.is/docs/sdk/dev-setup). | ||
## Overview | ||
|
||
You can create an environment for development with `tox`: | ||
This documents explains the processes and practices recommended for contributing enhancements to | ||
this operator. | ||
|
||
- Generally, before developing enhancements to this charm, you should consider | ||
[opening an issue | ||
](https://github.com/canonical/mongos-k8s-operator/issues) explaining | ||
your use case. | ||
- If you would like to chat with us about your use-cases or proposed | ||
implementation, you can reach us at [Canonical Mattermost public | ||
channel](https://chat.charmhub.io/charmhub/channels/charm-dev) or | ||
[Discourse](https://discourse.charmhub.io/). | ||
- Familiarising yourself with the [Charmed Operator | ||
Framework](https://juju.is/docs/sdk) library will help you a lot when working | ||
on new features or bug fixes. | ||
- All enhancements require review before being merged. Code review typically | ||
examines | ||
- code quality | ||
- test coverage | ||
- user experience for Juju administrators this charm. | ||
- Please help us out in ensuring easy to review branches by rebasing your pull | ||
request branch onto the `main` branch. This also avoids merge commits and | ||
creates a linear Git commit history. | ||
|
||
## Developing | ||
Install `tox`, `poetry`, and `charmcraftcache` | ||
|
||
Install pipx: https://pipx.pypa.io/stable/installation/ | ||
```shell | ||
tox devenv -e integration | ||
source venv/bin/activate | ||
pipx install tox | ||
pipx install poetry | ||
pipx install charmcraftcache | ||
``` | ||
|
||
## Testing | ||
You can create an environment for development: | ||
|
||
```shell | ||
poetry install | ||
``` | ||
|
||
This project uses `tox` for managing test environments. There are some pre-configured environments | ||
that can be used for linting and formatting code when you're preparing contributions to the charm: | ||
### Testing | ||
|
||
```shell | ||
tox run -e format # update your code according to linting rules | ||
tox run -e lint # code style | ||
tox run -e static # static type checking | ||
tox run -e unit # unit tests | ||
tox run -e integration # integration tests | ||
tox # runs 'format', 'lint', 'static', and 'unit' environments | ||
tox # runs 'lint' and 'unit' environments | ||
``` | ||
|
||
## Build the charm | ||
## Build charm | ||
|
||
Build the charm in this git repository using: | ||
|
||
```shell | ||
charmcraft pack | ||
tox run -e build-dev | ||
``` | ||
|
||
<!-- You may want to include any contribution/style guidelines in this document> | ||
### Deploy | ||
|
||
```bash | ||
# Create a model | ||
juju add-model dev | ||
# Enable DEBUG logging | ||
juju model-config logging-config="<root>=INFO;unit=DEBUG" | ||
# Deploy the charm | ||
# `--trust` needed if Role Based Access Control (RBAC) (https://kubernetes.io/docs/concepts/security/rbac-good-practices/) is enabled on Kubernetes | ||
juju deploy ./mongos-k8s-operator_ubuntu-20.04-amd64.charm \ | ||
--resource ghcr.io/canonical/charmed-mongodb:6.0.6-22.04_edge@sha256:b4b3edb805b20de471da57802643bfadbf979f112d738bc540ab148d145ddcfe --trust | ||
``` | ||
|
||
## Canonical Contributor Agreement | ||
|
||
Canonical welcomes contributions to the Charmed MySQL-Router Operator. Please | ||
check out our [contributor agreement](https://ubuntu.com/legal/contributors) if | ||
you're interested in contributing to the solution. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,27 @@ | ||
# Copyright 2023 Canonical Ltd. | ||
# Copyright 2024 Canonical Ltd. | ||
# See LICENSE file for licensing details. | ||
|
||
type: "charm" | ||
type: charm | ||
bases: | ||
- name: ubuntu | ||
channel: "22.04" | ||
architectures: [amd64] | ||
parts: | ||
charm: | ||
override-pull: | | ||
craftctl default | ||
if [[ ! -f requirements.txt ]] | ||
then | ||
echo 'ERROR: Use "tox run -e build-dev" instead of calling "charmcraft pack" directly' >&2 | ||
exit 1 | ||
fi | ||
override-build: | | ||
rustup default stable | ||
craftctl default | ||
charm-strict-dependencies: true | ||
build-snaps: | ||
- rustup | ||
build-packages: | ||
- build-essential | ||
- libffi-dev | ||
- libssl-dev | ||
- pkg-config | ||
- rustc | ||
- cargo | ||
bases: | ||
- build-on: | ||
- name: "ubuntu" | ||
channel: "22.04" | ||
run-on: | ||
- name: "ubuntu" | ||
channel: "22.04" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.