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

It looks like PR#1126 may have broken reactive builds; metadata.yaml is overwritten? #1150

Closed
ajkavanagh opened this issue Jul 11, 2023 · 5 comments · Fixed by #1151
Closed
Labels
Bug Something isn't working

Comments

@ajkavanagh
Copy link

Bug Description

It looks like PR#1126 may have broken charm-build (the reactive builders) metadata.yaml creation, as it seems to immediately overwrite it. This is with --channel=latest/edge (2.3.0.post16+gited81be8). At least I think that is what may be going on. I was testing latest/edge for the ability to build on lunar (23.04).

The offending line appears to be at

create_metadata_yaml(lifecycle.prime_dir, self.config)

The issue is that the built charms' metadata should look like this:

"name": "mysql-innodb-cluster"
"summary": "MySQL InnoDB Cluster"
"maintainer": "OpenStack Charmers <openstack-charmers@lists.ubuntu.com>"
"description": |
  MySQL InnoDB Cluster Charm deploys and manages the lifecycle of a
  MySQL InnoDB Cluster.
"tags":
- "openstack"
- "databases"
"series":
- "focal"
- "jammy"
- "lunar"
"requires":
  "certificates":
    "interface": "tls-certificates"
"provides":
  "shared-db":
    "interface": "mysql-shared"
  "db-router":
    "interface": "mysql-router"
  "db-monitor":
    "interface": "mysql-monitor"
    "scope": "container"
  "prometheus":
    "interface": "http"
"peers":
  "coordinator":
    "interface": "coordinator"
  "cluster":
    "interface": "mysql-innodb-cluster"
"resources":
  "mysql-shell":
    "type": "file"
    "filename": "mysql-shell.snap"
    "description": |
      Snap for mysql-shell
  "mysqld-exporter":
    "type": "file"
    "filename": "mysqld-exporter.snap"
    "description": |
      snap for mysqld prometheus exporter
"subordinate": !!bool "false"

but actually looks like this:

name: mysql-innodb-cluster
summary: MySQL InnoDB Cluster
maintainer: OpenStack Charmers <openstack-charmers@lists.ubuntu.com>
description: |
  MySQL InnoDB Cluster Charm deploys and manages the lifecycle of a
  MySQL InnoDB Cluster.
tags:
- databases
subordinate: false
series:
- focal
- jammy
- lunar
provides:
  shared-db:
    interface: mysql-shared
  db-router:
    interface: mysql-router
  db-monitor:
    interface: mysql-monitor
    scope: container
  prometheus:
    interface: http
...

To Reproduce

# fetch any reactive charm source, with a charmcraft.yaml
charmcraft pack
unzip -p <charm> metadata.yaml

Environment

  • Ubuntu 22.04
  • charmcraft latest/edge

charmcraft.yaml

type: charm

parts:
  charm:
    plugin: reactive
    reactive-charm-build-arguments:
      - --binary-wheels-from-source
      - --verbose
    build-packages:
      - tox
      - git
      - python3-dev
      - libffi-dev
      - libmysqlclient-dev
      - pkg-config
    source: src/
    build-snaps:
      - charm/latest/edge
    build-environment:
      - CHARM_INTERFACES_DIR: $CRAFT_PROJECT_DIR/interfaces/
      - CHARM_LAYERS_DIR: $CRAFT_PROJECT_DIR/layers/

bases:
  - build-on:
      - name: ubuntu
        channel: "20.04"
        architectures: [amd64]
    run-on:
      - name: ubuntu
        channel: "20.04"
        architectures: [amd64]
  - build-on:
      - name: ubuntu
        channel: "20.04"
        architectures: [s390x]
    run-on:
      - name: ubuntu
        channel: "20.04"
        architectures: [s390x]
  - build-on:
      - name: ubuntu
        channel: "20.04"
        architectures: [ppc64el]
    run-on:
      - name: ubuntu
        channel: "20.04"
        architectures: [ppc64el]
  - build-on:
      - name: ubuntu
        channel: "20.04"
        architectures: [arm64]
    run-on:
      - name: ubuntu
        channel: "20.04"
        architectures: [arm64]
  - build-on:
      - name: ubuntu
        channel: "22.04"
        architectures: [amd64]
    run-on:
      - name: ubuntu
        channel: "22.04"
        architectures: [amd64]
  - build-on:
      - name: ubuntu
        channel: "22.04"
        architectures: [s390x]
    run-on:
      - name: ubuntu
        channel: "22.04"
        architectures: [s390x]
  - build-on:
      - name: ubuntu
        channel: "22.04"
        architectures: [ppc64el]
    run-on:
      - name: ubuntu
        channel: "22.04"
        architectures: [ppc64el]
  - build-on:
      - name: ubuntu
        channel: "22.04"
        architectures: [arm64]
    run-on:
      - name: ubuntu
        channel: "22.04"
        architectures: [arm64]
  - 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: [s390x]
    run-on:
      - name: ubuntu
        channel: "23.04"
        architectures: [s390x]
  - 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: [arm64]
    run-on:
      - name: ubuntu
        channel: "23.04"
        architectures: [arm64]

Relevant log output

Log file too long, sadly.
@ajkavanagh ajkavanagh added the Bug Something isn't working label Jul 11, 2023
@syu-w
Copy link
Contributor

syu-w commented Jul 11, 2023

Hi, do you able to give me the repo of that reactive charm?

@ajkavanagh
Copy link
Author

Hi, do you able to give me the repo of that reactive charm?

Sure, yes. it's https://opendev.org/openstack/charm-mysql-innodb-cluster

However, I'm converting it to a binary reactive charm (with lunar support), which is where I hit the issue: https://review.opendev.org/c/openstack/charm-mysql-innodb-cluster/+/886634

However, it should be reproducible with any charmcraft charm that uses the reactive plugin (note the review 886634 uses the reactive plugin, the master branch doesn't (yet)). Thanks.

syu-w added a commit that referenced this issue Jul 12, 2023
The reactive framework uses an incompatible variant that creates its own files.
The format defined by charmcraft cannot be used.

Fix: #1150
@ajkavanagh
Copy link
Author

Thanks very much for the fix @syu-w !

@syu-w
Copy link
Contributor

syu-w commented Jul 12, 2023

@ajkavanagh do you able to confirm it is working now?

@ajkavanagh
Copy link
Author

@syu-w I can confirm that I've built the mysql-innodb-cluster charm with 2.3.0.post17+git35adadf and the metadata.yam, config.yaml and actions.yaml are all as per the generated output of charm build. Also the lunar (23.04) base also works. Thanks!

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