snapcraft icon indicating copy to clipboard operation
snapcraft copied to clipboard

Can't build Core20 snaps on non-snap distros

Open dstathis opened this issue 6 months ago • 2 comments

Bug Description

When running on nixos, I get the following error from snapcraft despite lxd being installed:

[nix-shell:~/repos/grafana-agent-snap]$ snapcraft_legacy --use-lxd
You need 'LXD' set-up to build snaps: snap support is required to continue: https://docs.snapcraft.io/installing-snapd/6735.

To Reproduce

Pack a core20 charm using the --use-lxd flag on nixos.

Environment

snapcraft 8.2.5 lxd 5.21.1 LTS

snapcraft.yaml

name: grafana-agent
version: '0.40.4'
summary: A telemetry collector for sending metrics, logs, and trace data
license: Apache-2.0
contact: [email protected]
issues: https://github.com/canonical/grafana-agent-snap/issues
source-code: https://github.com/canonical/grafana-agent-snap
website: https://grafana.com
description: "Grafana Agent is a telemetry collector for sending metrics, \nlogs, and trace data to the opinionated Grafana observability stack.\n"
base: core20
grade: stable
confinement: classic
compression: lzo
apps:
  grafana-agent:
    daemon: simple
    command: "${SNAP}/agent -config.expand-env -config.file /etc/grafana-agent.yaml"
    install-mode: disable
    restart-condition: on-failure
architectures:
  - build-on: amd64
  - build-on: arm64
parts:
  wrapper:
    plugin: dump
    source: ./snap/local
    source-type: local
    override-build: |
      cp agent-wrapper $SNAPSNAPSNAPCRAFT_PART_INSTALL/
  grafana-agent:
    plugin: go
    source: https://github.com/grafana/agent
    source-type: git
    source-tag: "v0.40.4"
    build-snaps:
      - go
    build-packages:
      - build-essential
      - libsystemd-dev
    stage-packages:
      - libsystemd0
    override-build: |
      export USE_CONTAINER=0
      export GOFLAGS="-mod=readonly -tags=promtail_journal_enabled"

      make agent agentctl

      cp build/grafana-agent $SNAPSNAPSNAPCRAFT_PART_INSTALL/agent
      cp build/grafana-agentctl $SNAPSNAPSNAPCRAFT_PART_INSTALL/agentctl

Relevant log output

-

Additional context

No response

dstathis avatar Aug 13 '24 14:08 dstathis