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

chore: merge 3.6 to main with charmcraft 3 #85

Draft
wants to merge 20 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
6cd096b
Uses BlockedStatus instead of ErrorStatus, which when set explicitly
manadart Feb 7, 2024
470f7c5
Merge pull request #62 from juju/3.3-fix-status
manadart Feb 7, 2024
245bac2
Merge pull request #63 from juju/3.3-into-3.4
manadart Feb 7, 2024
209f9c8
Updates charm metadata with correct Juju version restriction.
manadart Feb 10, 2024
5ac10db
Merge pull request #64 from juju/3.4-into-3.5
manadart Feb 10, 2024
bac5d77
feat: adds 24.04 as a supported Ubuntu base.
manadart Jun 7, 2024
e172846
Merge pull request #75 from juju/3.4-lts-support
jack-w-shaw Jun 7, 2024
4419ff1
Merge branch '3.4' into 3.4-into-3.5
manadart Jun 12, 2024
cead5b3
Merge pull request #76 from juju/3.4-into-3.5
manadart Jun 12, 2024
62422e1
fix: adds Cargo as a build dependency to charmcraft.yaml.
manadart Oct 5, 2024
5856631
Merge pull request #78 from juju/3.5-charmcraft-cargo
manadart Oct 8, 2024
e5b9963
fix: adds Cargo as a build dependency to charmcraft.yaml.
manadart Oct 5, 2024
55fc19d
fix: use charmcraft 2.x to build
manadart Nov 8, 2024
a5274b6
Merge pull request #81 from juju/3.5-charmcraft-cargo
manadart Nov 8, 2024
8bceb7d
fix: use Juju 3.6 for tests
manadart Nov 8, 2024
ab25b1f
fix: replace aarch46 with ppc64el
manadart Nov 8, 2024
55add98
Merge pull request #82 from juju/3.5-into-3.6
manadart Nov 10, 2024
c257e17
chore: use charmcraft 3
wallyworld Nov 12, 2024
ce266fa
Merge commit 'c257e1750b7b44e101bc49c9ea985994358a9ac5' into charmcraft3
hpidcock Nov 21, 2024
e5204f9
test: fix blocked status and blocked status tests
hpidcock Nov 21, 2024
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
8 changes: 4 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ jobs:
build:
name: Build charms
needs: unit-tests
uses: canonical/data-platform-workflows/.github/workflows/build_charms_with_cache.yaml@v4
uses: canonical/data-platform-workflows/.github/workflows/build_charm.yaml@v23
with:
artifact-name: charm-packed
charmcraft-snap-channel: 3.x/stable


channel:
Expand Down Expand Up @@ -93,7 +93,7 @@ jobs:
env:
CHARMCRAFT_AUTH: ${{ secrets.CHARMCRAFT_AUTH }}
run: |
sudo snap install charmcraft --classic
sudo snap install charmcraft --channel 3.x/stable --classic
charmcraft upload ${{ steps.download.outputs.download-path }}/*.charm \
--name $CHARM_NAME \
--release ${{ needs.channel.outputs.test }}
Expand Down Expand Up @@ -188,7 +188,7 @@ jobs:
steps:
- name: Install Charmcraft
run: |
sudo snap install charmcraft --classic
sudo snap install charmcraft --channel 3.x/stable --classic

- name: Get uploaded revision
id: revision
Expand Down
38 changes: 8 additions & 30 deletions charmcraft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,33 +2,11 @@ type: charm
parts:
charm:
charm-python-packages: [setuptools,markdown]
bases:
- build-on:
- name: ubuntu
channel: "24.04"
architectures: ["amd64"]
run-on:
- name: ubuntu
channel: "24.04"
architectures:
- amd64
- arm64
- s390x
- ppc64el
- riscv64
- name: ubuntu
channel: "22.04"
architectures:
- amd64
- arm64
- s390x
- ppc64el
- riscv64
- name: ubuntu
channel: "20.04"
architectures:
- amd64
- arm64
- s390x
- ppc64el
- riscv64
build-packages:
- cargo
base: [email protected]
platforms:
amd64:
arm64:
s390x:
ppc64el:
27 changes: 27 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

37 changes: 37 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
description = "juju controller charm shell";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-24.05";
};

outputs = { self, nixpkgs, ... } @ inputs:
let
forAllSystems = inputs.nixpkgs.lib.genAttrs [
"aarch64-linux"
"x86_64-linux"
"aarch64-darwin"
];
in
{
devShells = forAllSystems (system: {
default =
let
pkgs = nixpkgs.legacyPackages.${system};
in
pkgs.mkShell {
name = "juju-controller-charm";
# Enable experimental features without having to specify the argument
NIX_CONFIG = "experimental-features = nix-command flakes";
nativeBuildInputs = with pkgs; [
coreutils
findutils
zsh
python312
];
shellHook = ''
exec zsh
'';
};
});
};
}
2 changes: 2 additions & 0 deletions src/charm.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,8 @@ def _on_metrics_endpoint_relation_created(self, event: RelationJoinedEvent):
api_port = self.api_port()
except AgentConfException as e:
logger.error('cannot read controller API port from agent configuration: %s', e)
self.unit.status = BlockedStatus(
f"cannot read controller API port from agent configuration: {e}")
return

metrics_endpoint = MetricsEndpointProvider(
Expand Down
7 changes: 5 additions & 2 deletions tests/test_charm.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import yaml

from charm import JujuControllerCharm, AgentConfException
from ops.model import BlockedStatus, ActiveStatus
from ops import BlockedStatus, ActiveStatus
from ops.testing import Harness
from unittest.mock import mock_open, patch

Expand Down Expand Up @@ -139,7 +139,10 @@ def test_apiaddresses_missing_status(self, *_):

harness.add_relation('metrics-endpoint', 'prometheus-k8s')
harness.evaluate_status()
self.assertIsInstance(harness.charm.unit.status, BlockedStatus)
self.assertEqual(harness.charm.unit.status, BlockedStatus(
"cannot read controller API port from agent configuration: "
"agent.conf key 'apiaddresses' missing"
))

@patch("builtins.open", new_callable=mock_open, read_data=agent_conf_ipv4)
def test_apiaddresses_ipv4(self, _):
Expand Down
Loading