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

Build fails when multiple run-on are specified #2133

Open
seb4stien opened this issue Jan 31, 2025 · 2 comments
Open

Build fails when multiple run-on are specified #2133

seb4stien opened this issue Jan 31, 2025 · 2 comments
Labels
Bug Something isn't working triaged

Comments

@seb4stien
Copy link

Bug Description

The charmcraft build command fails when charmcraft.yaml contains the following configuration:

bases:
  - build-on:
    - name: ubuntu
      channel: "22.04"
    run-on:
    - name: ubuntu
      channel: "22.04"
    - name: "ubuntu"
      channel: "20.04"

In the logs we can see that charmcraft is generating a hostname that contains understores:

2025-01-31 15:16:50.027 Setting charmcraft to be injected from the host into the build environment because it is running as a snap.
2025-01-31 15:16:50.027 Preparing managed instance 'charmcraft-digest-squid-auth-helper-ubuntu-22.04-amd64_ubuntu-20.04-amd64-5603827'
2025-01-31 15:16:50.031 Using hostname 'charmcraft-digest-squid-auth-helper-ubuntu-2204-amd64_ubuntu-2'

This generates an error as '_' are not valid characters for the hostname command:

2025-01-31 15:17:01.013 Executing in container: lxc --project charmcraft exec local:charmcraft-digest-squid-auth-helper-ubun-5e15c5547ad997b04c08 -- env CRAFT_MANAGED_MODE=1 CHARMCRAFT_MANAG
ED_MODE=1 DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true DEBIAN_PRIORITY=critical hostname -F /etc/hostname
2025-01-31 15:17:01.383 Failed to set hostname.

A proposal to solve the issue here: canonical/craft-providers#722

To Reproduce

Create a charm with multiple "run-on" destinations (see charmcraft.yaml) and try to build it.

Environment

Building on Ubuntu 24.04

charmcraft.yaml

bases:
  - build-on:
    - name: ubuntu
      channel: "22.04"
    run-on:
    - name: ubuntu
      channel: "22.04"
    - name: "ubuntu"
      channel: "20.04"

Relevant log output

2025-01-31 15:16:50.027 Setting charmcraft to be injected from the host into the build environment because it is running as a snap.
2025-01-31 15:16:50.027 Preparing managed instance 'charmcraft-digest-squid-auth-helper-ubuntu-22.04-amd64_ubuntu-20.04-amd64-5603827'
2025-01-31 15:16:50.031 Using hostname 'charmcraft-digest-squid-auth-helper-ubuntu-2204-amd64_ubuntu-2'
...
2025-01-31 15:17:01.013 Executing in container: lxc --project charmcraft exec local:charmcraft-digest-squid-auth-helper-ubun-5e15c5547ad997b04c08 -- env CRAFT_MANAGED_MODE=1 CHARMCRAFT_MANAG
ED_MODE=1 DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true DEBIAN_PRIORITY=critical hostname -F /etc/hostname
2025-01-31 15:17:01.383 Failed to set hostname.
@seb4stien seb4stien added the Bug Something isn't working label Jan 31, 2025
@lengau lengau added the triaged label Jan 31, 2025
Copy link

Thank you for reporting your feedback to us!

The internal ticket has been created: https://warthogs.atlassian.net/browse/CRAFT-4077.

This message was autogenerated

@lengau
Copy link
Collaborator

lengau commented Jan 31, 2025

Hi, thanks for the report! I see where this is coming from and I think we can fix it fairly simply.

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

No branches or pull requests

2 participants