Skip to content

charm pack fails with "metadata: Cannot read the metadata.yaml file." #619

@coreycb

Description

@coreycb

Otherwise, if you have a feature request or issue with any other charm command please delete the above and continue below

Checklist

  • Confirmed this is an issue with charm-tools, not charmstore-client
  • Provide versions of tools used
  • Described the feature or ways to replicate the issue

What version am I running?

I ran the following command: snap info charm and got the following ouput:

installed:          2.8.2                          (609) 119MB classic

I am using: Ubuntu 22.04

Issue/Feature

Build fails as follows:

ubuntu@j1:~/designate$ tox -e build                                                                                                                                                                                                                                                                                                                                                                                                     
.tox create: /home/ubuntu/designate/.tox/.tox                                                                                                                                                                                                                                                                                                                                                                                           
.tox installdeps: pip < 20.3, virtualenv < 20.0, setuptools<50.0.0, tox >= 3.18.0                                                                                                                                                                                                                                                                                                                                                       
build create: /home/ubuntu/designate/.tox/build                                                                                                                                                                                                                                                                                                                                                                                         
build installdeps: -r/home/ubuntu/designate/build-requirements.txt                                                                                                                                                                                                                                                                                                                                                                      
build run-test-pre: PYTHONHASHSEED='0'                                                                                                                                                                                                                                                                                                                                                                                                  
build run-test: commands[0] | charmcraft clean                                                                                                                                                                                                                                                                                                                                                                                          
Cleaned project 'designate'.                                                                                                                                                                                                                                                                                                                                                                                                            
build run-test: commands[1] | charmcraft -v pack                                                                                                                                                                                                                                          
Starting charmcraft version 2.0.0                                                                                                                                                                                                                                                         
Logging execution to '/home/ubuntu/snap/charmcraft/common/cache/charmcraft/log/charmcraft-20220822-192025.667555.log'                                                                                                                                                                     
Packing the charm.                                                                                                                                                                                                                                                                        
Launching environment to pack for base name='ubuntu' channel='22.04' architectures=['amd64'] (may take a while the first time but it's reusable)                                                                                                                                          
Packing the charm                                                                                                                                                                                                                                                                         
Starting charmcraft version 2.0.0                                                                                                                                                                                                                                                         
Logging execution to '/tmp/charmcraft.log'                                                                                                                                                                                                                                                
Packing the charm.                                                                                                                                                                                                                                                                        
Building charm in '/root'                                                                                                                                                                                                                                                                 
Running step PULL for part 'charm'                                                                                                                                                                                                                                                        
Execute action                                                                                                                                                                                                                                                                            
Running step OVERLAY for part 'charm'                                                                                                                                                                                                                                                     
Execute action                                                                                                                                                                                                                                                                            
Running step BUILD for part 'charm'                                                                                                                                                                                                                                                       
Execute action                                                                                                                                                                                                                                                                            
:: + /snap/charmcraft/x1/bin/python3 -I /snap/charmcraft/x1/lib/charmcraft/reactive_plugin.py designate /root/parts/charm/build /root/parts/charm/install                                                                                                                                 
:: I: metadata name (designate) must match directory name (build) exactly for local deployment.                                                                                                                                                                                           
:: I: `display-name` not provided, add for custom naming in the UI                                                                                                                                                                                                                        
:: I: no hooks directory                                                                                                                                                                                                                                                                  
:: W: no copyright file                                                                                                                                                                                                                                                                   
:: I: relation dnsaas has no hooks                                                                                                                                                                                                                                                        
:: I: relation nrpe-external-master has no hooks                                                                                                                                                                                                                                          
:: I: relation dns-backend has no hooks                                                                                                                                                                                                                                                   
:: I: relation ha has no hooks                                                                                                                                                                                                                                                            
:: I: relation coordinator-memcached has no hooks                                                                                                                                                                                                                                         
:: I: relation cluster has no hooks                                                                                                                                                                                                                                                       
:: I: missing recommended hook install                                                                                                                                                                                                                                                    
:: I: missing recommended hook start                                                                                                                                                                                                                                                      
:: I: missing recommended hook stop                                                                                                                                                                                                                                                       
:: I: missing recommended hook config-changed                                                                                                                                                                                                                                             
:: I: config.yaml: option dns-slaves has no default value                                                                                                                                                                                                                                 
:: I: config.yaml: option nova-domain has no default value                                                                                                                                                                                                                                
:: I: config.yaml: option nova-domain-email has no default value                                                                                                                                                                                                                          
:: I: config.yaml: option nameservers has no default value                                                                                                                                                                                                                                
:: I: config.yaml: option neutron-domain has no default value                                                                                                                                                                                                                             
:: I: config.yaml: option neutron-domain-email has no default value                                                                                                                                                                                                                                                                                                        
:: I: config.yaml: option also-notifies has no default value                                                                                                                                                                                                                                                                                                               
:: I: config.yaml: option default-soa-minimum has no default value                                                                                                                                                                                                                                                                                                         
:: I: config.yaml: option default-soa-refresh-min has no default value                                                                                                                                                                                                                                                                                                     
:: I: config.yaml: option default-soa-refresh-max has no default value                                                                                                                                                                                                                                                                                                     
:: I: config.yaml: option default-soa-retry has no default value                                                                                                                                                                                                                                                                                                           
:: I: config.yaml: option default-ttl has no default value                                                                                                                                                                                                                                                                                                                 
:: I: config.yaml: option managed-resource-tenant-id has no default value                                                                                                                                                                                                                                                                                                  
:: W: config.yaml: option openstack-origin does not have the keys: description, type                                                                                                                                                                                                                                                                                                                                                    
:: build: The lockfile /root/parts/charm/build/build.lock was not found; building using latest versions.                                                                                                                                                                                                                                                                                                                                
:: build: Destination charm directory: /root/parts/charm/build/designate                                                                                                                                                                                                                                                                                                                                                                
:: build: Processing layer: layer:options                                                                                                                                                                                                                                                                                                                                                                                               
:: build: Processing layer: layer:basic                                                                                                                                                                                                                                                                                                                                                                                                 
:: build: Processing layer: layer:openstack                                                                                                                                                                                                                                                                                                                                                                                             
:: build: Processing layer: layer:openstack-principle                                                                                                                                                                                                                                                                                                                                                                                   
:: build: Processing layer: layer:openstack-api                                                                                                                                                                                                                                                                                                                                                                                         
:: build: Processing layer: layer:leadership                                                                                                                                                                                                                                                                                                                                                                                            
:: build: Processing layer: designate (from .)                                                                                                                                                                                                                                                                                                                                                                                          
:: build: Processing interface: tls-certificates                                                                                                                                                                                                                                                                                                                                                                                        
:: build: Processing interface: mysql-shared                                                                                                                                                                                                                                                                                                                                                                                            
:: build: Processing interface: rabbitmq                                                                                                                                                                                                                                                                                                                                                                                                
:: build: Processing interface: keystone                                                                                                                                                                                                                                                                                                                                                                                                
:: build: Processing interface: hacluster                                                                                                                                                                                                                                                                                                                                                                                               
:: build: Processing interface: openstack-ha                                                                                                                                                                                                                                                                                                                                                                                            
:: build: Processing interface: bind-rndc                                                                                                                                                                                                                                                                                                                                                                                               
:: build: Processing interface: memcache                                                                                                                                                                                                                                                                                                                                                                                                
:: build: Processing interface: designate (from designate)                                                                                                                                                                                                                                                                                                                                                                              
:: build: Processing interface: nrpe-external-master                                                                                                                                                                                                                                                                                                                                                                                    
:: charmtools.build.tactics: Missing implementation for interface role: provides.py                                                                                                                                                                                                                                                                                                                                                     
Running step STAGE for part 'charm'                                                                                                                                                                                                                                                                                                                                                                                                     
Execute action                                                                                                                                                                                                                                                                                                                                                                                                                          
Running step PRIME for part 'charm'                                                                                                                                                                                                                                                                                                                                                                                                     
Execute action                                                                                                                                                                                                                                                                                                                                                                                                                          
Check result: language [attribute] unknown (The charm is written with Python.; see more at https://juju.is/docs/sdk/charmcraft-analyze#heading--language).                                                                                                                                                                                                                                                                              
Check result: framework [attribute] unknown (The charm is not based on any known Framework.; see more at https://juju.is/docs/sdk/charmcraft-analyze#heading--framework).                                                                                                                                                                                                                                                               
Lint Errors:                                                                                                                                                                                                                                                                                                                                                                                                                            
- metadata: Cannot read the metadata.yaml file. (https://juju.is/docs/sdk/charmcraft-analyze#heading--metadata)                                                                                                                                                                                                                                                                                                                         
Aborting due to lint errors (use --force to override).                                                                                                                                                                                                                                                                                                                                                                                  
Failed to build charm for bases index '0'.                                                                                                                                                                                                                                                                                                                                                                                              
Full execution log: '/home/ubuntu/snap/charmcraft/common/cache/charmcraft/log/charmcraft-20220822-192025.667555.log'                                                                                                                                                                                                                                                                                                                    
ERROR: InvocationError for command /snap/bin/charmcraft -v pack (exited with code 1)                                                                                                                                
________________________________________________________________________________________________________________________________________ summary _________________________________________________________________________________________________________________________________________                                                                                                                                              
ERROR:   build: commands failed

however, if I add the following to charmcraft.yaml, the build is successful, even though the interfaces and layers directories are empty:

ubuntu@j1:~/designate$ git diff
diff --git a/charmcraft.yaml b/charmcraft.yaml
index e8b86ef..7497a22 100644
--- a/charmcraft.yaml
+++ b/charmcraft.yaml
@@ -6,6 +6,10 @@ parts:
     plugin: reactive
     build-snaps:
       - charm
+    build-environment:
+      - CHARM_INTERFACES_DIR: /root/project/interfaces/
+      - CHARM_LAYERS_DIR: /root/project/layers/
+
 
 bases:
   - build-on:

To recreate:

git clone https://opendev.org/openstack/charm-designate designate
cd designate
git fetch https://review.opendev.org/openstack/charm-designate refs/changes/80/850180/11 && git checkout FETCH_HEAD
vi charmcraft.yaml # remove the build-environment mapping
tox -e build

I expect/expected the following

The problem is I'm unable to debug what I think is an interface linting issue because the metadata.yaml error goes away once I add the build-environment environment variables, even though they point to nothing.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions