Skip to content

Commit

Permalink
Backport changes to track 2.0 to fix CI
Browse files Browse the repository at this point in the history
This commit includes the following changes and aims at backporting them to track/2.0:

* ci: update workflows directory
* fix: Pin COS charms in integration tests to latest/stable (#108)
* build: bump jinja2 3.1.x -> 3.1.4 (#118)
* build, ci: bump juju 2.9 -> 3.x
* ci, build: bump python-libjuju 3.2 -> 3.4
  • Loading branch information
DnPlas authored Aug 19, 2024
2 parents 863407b + 3945fd0 commit cf2987a
Show file tree
Hide file tree
Showing 9 changed files with 42 additions and 62 deletions.
9 changes: 4 additions & 5 deletions .github/workflows/integrate.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,12 @@ jobs:
uses: charmed-kubernetes/actions-operator@main
with:
provider: microk8s
channel: 1.24/stable
# Pinned until this bug is resolved: https://bugs.launchpad.net/juju/+bug/1992833
bootstrap-options: "--agent-version=2.9.34"
microk8s-addons: "dns storage rbac metallb:10.64.140.43-10.64.140.49"
channel: 1.29-strict/stable
juju-channel: 3.4/stable
charmcraft-channel: latest/candidate

- name: Test
run: sg microk8s -c "tox -vve integration -- --model testing"
run: sg snap_microk8s -c "tox -vve integration -- --model testing"

# On failure, capture debugging resources
- name: Get all
Expand Down
17 changes: 0 additions & 17 deletions .github/workflows/issues_to_jira.yaml

This file was deleted.

5 changes: 3 additions & 2 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ jobs:
ref: ${{ inputs.source_branch }}

- name: Select charmhub channel
uses: canonical/charming-actions/channel@2.2.3
uses: canonical/charming-actions/channel@2.6.2
id: select-channel
if: ${{ inputs.destination_channel == '' }}

Expand All @@ -84,10 +84,11 @@ jobs:
echo "::set-output name=tag_prefix::$tag_prefix"
- name: Upload charm to charmhub
uses: canonical/charming-actions/upload-charm@2.2.3
uses: canonical/charming-actions/upload-charm@2.6.2
with:
credentials: ${{ secrets.CHARMCRAFT_CREDENTIALS }}
github-token: ${{ secrets.GITHUB_TOKEN }}
charm-path: ${{ matrix.charm-path }}
channel: ${{ steps.parse-inputs.outputs.destination_channel }}
tag-prefix: ${{ steps.parse-inputs.outputs.tag_prefix }}
charmcraft-channel: latest/candidate
2 changes: 1 addition & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
steps:
- uses: actions/checkout@v3
- name: Release charm to channel
uses: canonical/charming-actions/release-charm@2.2.3
uses: canonical/charming-actions/release-charm@2.6.2
with:
credentials: ${{ secrets.CHARMCRAFT_CREDENTIALS }}
github-token: ${{ secrets.GITHUB_TOKEN }}
Expand Down
3 changes: 1 addition & 2 deletions requirements-integration.in
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
aiohttp
jinja2
# Pinning to <3.0 due to compatibility with the 2.9 controller version and 3.0 not being maintained anymore
juju<3.0
juju<4.0
pytest-operator
requests
-r requirements.txt
23 changes: 10 additions & 13 deletions requirements-integration.txt
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ httpx==0.23.3
# via
# -r requirements.txt
# lightkube
hvac==2.3.0
# via juju
idna==3.4
# via
# -r requirements.txt
Expand All @@ -89,17 +91,15 @@ ipython==8.11.0
# via ipdb
jedi==0.18.2
# via ipython
jinja2==3.1.2
jinja2==3.1.4
# via
# -r requirements-integration.in
# -r requirements.txt
# pytest-operator
juju==2.9.44.0
juju==3.5.2.0
# via
# -r requirements-integration.in
# pytest-operator
jujubundlelib==0.5.7
# via theblues
kubernetes==26.1.0
# via
# -r requirements.txt
Expand All @@ -111,9 +111,7 @@ lightkube-models==1.26.0.4
# -r requirements.txt
# lightkube
macaroonbakery==1.3.1
# via
# juju
# theblues
# via juju
markupsafe==2.1.2
# via
# -r requirements.txt
Expand All @@ -135,7 +133,9 @@ oci-image==1.0.0
ops==2.1.1
# via -r requirements.txt
packaging==23.0
# via pytest
# via
# juju
# pytest
paramiko==2.12.0
# via juju
parso==0.8.3
Expand Down Expand Up @@ -197,7 +197,6 @@ pyyaml==6.0.1
# via
# -r requirements.txt
# juju
# jujubundlelib
# kubernetes
# lightkube
# ops
Expand All @@ -206,10 +205,10 @@ requests==2.28.2
# via
# -r requirements-integration.in
# -r requirements.txt
# hvac
# kubernetes
# macaroonbakery
# requests-oauthlib
# theblues
requests-oauthlib==1.3.1
# via
# -r requirements.txt
Expand Down Expand Up @@ -242,8 +241,6 @@ stack-data==0.6.2
# via ipython
tenacity==8.2.2
# via -r requirements.txt
theblues==0.5.2
# via juju
tomli==2.0.1
# via
# ipdb
Expand All @@ -270,7 +267,7 @@ websocket-client==1.5.1
# -r requirements.txt
# kubernetes
# ops
websockets==7.0
websockets==12.0
# via juju
yarl==1.8.2
# via aiohttp
Expand Down
2 changes: 1 addition & 1 deletion requirements-unit.txt
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ idna==3.4
# rfc3986
iniconfig==2.0.0
# via pytest
jinja2==3.1.2
jinja2==3.1.4
# via -r requirements.txt
kubernetes==26.1.0
# via -r requirements.txt
Expand Down
3 changes: 1 addition & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ idna==3.4
# via
# anyio
# requests
# rfc3986
jinja2==3.1.2
jinja2==3.1.4
# via -r requirements.in
kubernetes==26.1.0
# via -r requirements.in
Expand Down
40 changes: 21 additions & 19 deletions tests/integration/test_charm.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@

METADATA = yaml.safe_load(Path("./metadata.yaml").read_text())
APP_NAME = "metacontroller-operator"
PROMETHEUS = "prometheus-k8s"
PROMETHEUS_CHANNEL = "latest/stable"
GRAFANA = "grafana-k8s"
GRAFANA_CHANNEL = "latest/stable"
PROMETHEUS_SCRAPE = "prometheus-scrape-config-k8s"
PROMETHEUS_SCRAPE_CHANNEL = "latest/stable"


@pytest.mark.abort_on_fail
Expand Down Expand Up @@ -51,51 +57,47 @@ async def test_build_and_deploy_with_trust(ops_test: OpsTest):

async def test_prometheus_grafana_integration(ops_test: OpsTest):
"""Deploy prometheus, grafana and required relations, then test the metrics."""
prometheus = "prometheus-k8s"
grafana = "grafana-k8s"
prometheus_scrape = "prometheus-scrape-config-k8s"
scrape_config = {"scrape_interval": "30s"}

# Deploy and relate prometheus
# FIXME: Unpin revision once https://github.com/canonical/bundle-kubeflow/issues/688 is closed
await ops_test.juju(
"deploy",
prometheus,
PROMETHEUS,
"--channel",
"latest/edge",
"--revision",
"137",
PROMETHEUS_CHANNEL,
"--trust",
check=True,
)
# FIXME: Unpin revision once https://github.com/canonical/bundle-kubeflow/issues/690 is closed
await ops_test.juju(
"deploy",
grafana,
GRAFANA,
"--channel",
"latest/edge",
"--revision",
"89",
GRAFANA_CHANNEL,
"--trust",
check=True,
)
await ops_test.model.deploy(prometheus_scrape, channel="latest/beta", config=scrape_config)
await ops_test.model.deploy(
PROMETHEUS_SCRAPE,
channel=PROMETHEUS_SCRAPE_CHANNEL,
config=scrape_config,
)

await ops_test.model.add_relation(APP_NAME, prometheus_scrape)
await ops_test.model.add_relation(APP_NAME, PROMETHEUS_SCRAPE)
await ops_test.model.add_relation(
f"{prometheus}:grafana-dashboard", f"{grafana}:grafana-dashboard"
f"{PROMETHEUS}:grafana-dashboard", f"{GRAFANA}:grafana-dashboard"
)
await ops_test.model.add_relation(
f"{APP_NAME}:grafana-dashboard", f"{grafana}:grafana-dashboard"
f"{APP_NAME}:grafana-dashboard", f"{GRAFANA}:grafana-dashboard"
)
await ops_test.model.add_relation(
f"{prometheus}:metrics-endpoint", f"{prometheus_scrape}:metrics-endpoint"
f"{PROMETHEUS}:metrics-endpoint",
f"{PROMETHEUS_SCRAPE}:metrics-endpoint",
)

await ops_test.model.wait_for_idle(status="active", timeout=60 * 20)

status = await ops_test.model.get_status()
prometheus_unit_ip = status["applications"][prometheus]["units"][f"{prometheus}/0"]["address"]
prometheus_unit_ip = status["applications"][PROMETHEUS]["units"][f"{PROMETHEUS}/0"]["address"]
logger.info(f"Prometheus available at http://{prometheus_unit_ip}:9090")

for attempt in retry_for_5_attempts:
Expand Down

0 comments on commit cf2987a

Please sign in to comment.