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

Make Charms definition in charmcraft work with both Ubuntu 22.04 and 24.04 #295

Closed
BarcoMasile opened this issue Nov 7, 2024 · 4 comments · Fixed by #297
Closed

Make Charms definition in charmcraft work with both Ubuntu 22.04 and 24.04 #295

BarcoMasile opened this issue Nov 7, 2024 · 4 comments · Fixed by #297
Labels
bug Something isn't working

Comments

@BarcoMasile
Copy link
Contributor

Enhancement Proposal

Description

Right now charmcraft.yaml needs to use a different syntax to make charm work on Ubuntu 24.04 (see canonical/charmcraft#1789, which also applies to regular charms, not only subordinates).

We need to find a way to make charm definition work without breaking retro compatibility for our charms, be it a CI refactor or a unified solution.

@natalian98 natalian98 added the bug Something isn't working label Nov 8, 2024
Copy link

Thank you for reporting us your feedback!

The internal ticket has been created: https://warthogs.atlassian.net/browse/IAM-1176.

This message was autogenerated

@natalian98
Copy link
Contributor

I tried solving this issue by disabling the destructive mode as we discussed, it failed with https://github.com/canonical/kratos-operator/actions/runs/11746211383/job/32798333171#step:5:18

There seem to be 2 reasons for charming actions using the destructive mode enabled by default:

  • it doesn't require lxd
  • charmcraft pack completes faster compared to packing in non-destructive mode (less than 15 vs over 25 min on a gh runner)

The first issue can be solved by adding a step to install and init lxd:

diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml
index 79cdf61..1a46aa1 100644
--- a/.github/workflows/publish.yaml
+++ b/.github/workflows/publish.yaml
@@ -53,6 +53,16 @@ jobs:
           echo "setting output of destination_channel=$destination_channel"
           echo "::set-output name=destination_channel::$destination_channel"
 
+      # Required to charmcraft pack in non-destructive mode
+      - name: Install and initialize lxd
+        id: install-lxd
+        run: |
+          /usr/bin/sudo snap install lxd --channel=latest/stable
+          /usr/bin/sudo lxd waitready
+          /usr/bin/sudo lxd init --auto
+          /usr/bin/sudo iptables -F FORWARD
+          /usr/bin/sudo iptables -P FORWARD ACCEPT
+
       - name: Upload charm to charmhub

The fact it takes longer time to build is not a big inconvenience given that it's only run on push.

We can accept the above and add the lxd step or fall back to run on 22.04, @nsklikas @BarcoMasile @shipperizer wdyt?

@natalian98 natalian98 reopened this Nov 12, 2024
@BarcoMasile
Copy link
Contributor Author

My 2 cents on this is: if it works let's keep this solution, have a "test run" on a more populare repo (one with more PRs), and then re-assess after a pulse.

@natalian98
Copy link
Contributor

Fixed by #298, new revision was published: https://charmhub.io/kratos?channel=latest/edge

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants