canonical / charmcraft

Collaborate, build and publish charmed operators for Kubernetes, Linux and Windows.
Apache License 2.0
66 stars 69 forks source link

charmcraft pack on Ubuntu 23.04 (Lunar) fails. #1104

Open freyes opened 1 year ago

freyes commented 1 year ago

When trying to build a charm using ubuntu-23.04 as the base for the build-on and run-on stanzas, I get no charm when using charmcraft-2.2:

$ charmcraft pack 
No suitable 'build-on' environment found in 'bases[1]' configuration.                                                                                                                                       
No suitable 'build-on' environment found in 'bases[2]' configuration.                                                                                                                                       
No suitable 'build-on' environment found in 'bases[3]' configuration.                                                                                                                                       
No suitable 'build-on' environment found in 'bases[4]' configuration.                                                                                                                                       
No suitable 'build-on' environment found in 'bases[5]' configuration.                                                                                                                                       
No suitable 'build-on' environment found in 'bases[6]' configuration.                                                                                                                                       
No suitable 'build-on' environment found in 'bases[7]' configuration.                                                                                                                                       
Packing the charm                                                                                                                                                                                           
Building charm in '/root' | (3.0s)                                                                                                                                                                          found charm-tools 3.0.6 (+git-0-1847cbe)
Created 'ovn-dedicated-chassis_ubuntu-22.04-amd64_ubuntu-22.10-amd64.charm'.                                                                                                                                
Charms packed:                                                                                                                                                                                              
    ovn-dedicated-chassis_ubuntu-22.04-amd64_ubuntu-22.10-amd64.charm                

Although if I switch to the latest/edge channel, I get the following error:

Created 'ovn-dedicated-chassis_ubuntu-22.04-amd64_ubuntu-22.10-amd64.charm'.                                                                                                                                
charmcraft internal error: LXDUnstableImageError(brief="Cannot launch an unstable image 'lunar' from remote 'ubuntu-daily'", details='Devel or daily images are not guaranteed and are intended for experimental use only.', resolution=None)

The charmcraft.yaml used is the one below. In general we need to be able to build and run charms on any ubuntu base, since Charmed OpenStack is capable of running on LTS releases and interim releases.

Test Case:

git clone https://opendev.org/x/charm-ovn-dedicated-chassis
cd charm-ovn-dedicated-chassis/
git fetch https://review.opendev.org/x/charm-ovn-dedicated-chassis refs/changes/38/883438/1 && git checkout FETCH_HEAD
tox -e build

Expected Result: charmcraft produces 2 charm files, one for 22.04 and 22.10, another one for 23.04.

Actual Result: only one charm file is built for 22.04 and 22.10

type: charm

parts:
  charm:
    source: src/
    plugin: reactive
    reactive-charm-build-arguments:
      - --binary-wheels-from-source
      - -v
    build-packages:
      - git
      - python3-dev
      - libffi-dev
      - libssl-dev
      - rustc
      - cargo
    build-snaps:
      - charm
    build-environment:
      - CHARM_INTERFACES_DIR: $CRAFT_PROJECT_DIR/interfaces/
      - CHARM_LAYERS_DIR: $CRAFT_PROJECT_DIR/layers/
      - MAKEFLAGS: -j$(nproc)

bases:
  - build-on:
      - name: ubuntu
        channel: "22.04"
        architectures: [amd64]
    run-on:
      - name: ubuntu
        channel: "22.04"
        architectures: [amd64]
      - name: ubuntu
        channel: "22.10"
        architectures: [amd64]
  - build-on:
      - name: ubuntu
        channel: "22.04"
        architectures: [arm64]
    run-on:
      - name: ubuntu
        channel: "22.04"
        architectures: [arm64]
      - name: ubuntu
        channel: "22.10"
        architectures: [arm64]
  - build-on:
      - name: ubuntu
        channel: "22.04"
        architectures: [ppc64el]
    run-on:
      - name: ubuntu
        channel: "22.04"
        architectures: [ppc64el]
      - name: ubuntu
        channel: "22.10"
        architectures: [ppc64el]
  - build-on:
      - name: ubuntu
        channel: "22.04"
        architectures: [s390x]
    run-on:
      - name: ubuntu
        channel: "22.04"
        architectures: [s390x]
      - name: ubuntu
        channel: "22.10"
        architectures: [s390x]
  - build-on:
      - name: ubuntu
        channel: "23.04"
        architectures: [amd64]
    run-on:
      - name: ubuntu
        channel: "23.04"
        architectures: [amd64]
  - build-on:
      - name: ubuntu
        channel: "23.04"
        architectures: [arm64]
    run-on:
      - name: ubuntu
        channel: "23.04"
        architectures: [arm64]
  - build-on:
      - name: ubuntu
        channel: "23.04"
        architectures: [ppc64el]
    run-on:
      - name: ubuntu
        channel: "23.04"
        architectures: [ppc64el]
  - build-on:
      - name: ubuntu
        channel: "23.04"
        architectures: [s390x]
    run-on:
      - name: ubuntu
        channel: "23.04"
        architectures: [s390x]
freyes commented 1 year ago

Using a clean Lunar container and running charmcraft in destructive mode allowed me to produce a charm it, I did the same on s390x with successful results.

$ rm -rf ovn-central_ubuntu-23.04-amd64.charm 
ubuntu@ovn-central-lunar:~/charm-ovn-central$ sudo charmcraft pack --destructive-mode
No suitable 'build-on' environment found in 'bases[0]' configuration.                                                  
No suitable 'build-on' environment found in 'bases[1]' configuration.                                                  
No suitable 'build-on' environment found in 'bases[2]' configuration.                                                  
No suitable 'build-on' environment found in 'bases[3]' configuration.                                                  
No suitable 'build-on' environment found in 'bases[5]' configuration.                                                  
No suitable 'build-on' environment found in 'bases[6]' configuration.                                                  
No suitable 'build-on' environment found in 'bases[7]' configuration.                                                  
Building charm in '/home/ubuntu/charm-ovn-central/build' \ (2.5s)                                                      found charm-tools 3.0.6 (+git-0-1847cbe)
Running step BUILD for part 'charm'                                                                                    found charm-tools 3.0.6 (+git-0-1847cbe)
Created 'ovn-central_ubuntu-23.04-amd64.charm'.                                                                        
Charms packed:                                                                                                         
    ovn-central_ubuntu-23.04-amd64.charm

the python package available in the wheelhouse were compiled in python-3.11

$ zipinfo -1 ovn-central_ubuntu-23.04-amd64.charm | grep wheelhouse
wheelhouse.txt
wheelhouse/charms.reactive-1.5.2-py3-none-any.whl
wheelhouse/pyaml-21.10.1-py2.py3-none-any.whl
wheelhouse/packaging-23.1-py3-none-any.whl
wheelhouse/psutil-5.9.5-cp311-abi3-linux_x86_64.whl
wheelhouse/Cython-0.29.34-cp311-cp311-linux_x86_64.whl
wheelhouse/pbr-5.11.1-py2.py3-none-any.whl
wheelhouse/Jinja2-3.1.2-py3-none-any.whl
wheelhouse/poetry_core-1.5.2-py3-none-any.whl
wheelhouse/netaddr-0.7.19-py3-none-any.whl
wheelhouse/tomli-2.0.1-py3-none-any.whl
wheelhouse/tenacity-5.0.3-py2.py3-none-any.whl
wheelhouse/zipp-1.2.0-py2.py3-none-any.whl
wheelhouse/dnspython-2.3.0-py3-none-any.whl
wheelhouse/netifaces-0.11.0-cp311-cp311-linux_x86_64.whl
wheelhouse/pip-22.0.4-py3-none-any.whl
wheelhouse/charms.openstack-0.0.1.dev1-py3-none-any.whl
wheelhouse/six-1.16.0-py2.py3-none-any.whl
wheelhouse/wheel-0.40.0-py3-none-any.whl
wheelhouse/flit_core-3.8.0-py3-none-any.whl
wheelhouse/setuptools-62.1.0-py3-none-any.whl
wheelhouse/setuptools_scm-6.4.2-py3-none-any.whl
wheelhouse/charmhelpers-1.1.1.dev67-py3-none-any.whl
wheelhouse/MarkupSafe-2.1.2-cp311-cp311-linux_x86_64.whl
wheelhouse/PyYAML-6.0-cp311-cp311-linux_x86_64.whl
sergiusens commented 1 year ago

@mr-cal and @syu-w ; it looks like some of the changes in charmcraft on edge to enable Alma Linux broke a couple of the user experiences we have on stable.

For lunar dailies, I believe we need to renegotiate with CPC.

freyes commented 1 year ago

@sergiusens on the general situation of non-LTS releases, OpenStack team expectation would be that we can build charms around the time Ubuntu gets into beta state, this would allow us to configure our CI system to build and test that Ubuntu release, do you think this expectation is reasonable?

We would be OK with running charmcraft from latest/beta, it's a common practice for us when running Juju with an Ubuntu release that hasn't been released yet.

sergiusens commented 1 year ago

we should warn when using interim releases

sergiusens commented 1 year ago

We should use the buildd images for lunar as the build base

syu-w commented 1 year ago

Hi, the PR is https://github.com/canonical/charmcraft/pull/1130, currently blocked by https://bugs.launchpad.net/cloud-images/+bug/2007419