canonical / pebble

Pebble is a lightweight Linux service manager with layered configuration and an HTTP API.
https://canonical-pebble.readthedocs-hosted.com/
GNU General Public License v3.0
146 stars 54 forks source link

fix(snap): set Pebble version before snap builds #450

Closed cjdcordeiro closed 3 months ago

cjdcordeiro commented 3 months ago

Problem

When doing a snapcraft remote-build, Snapcraft will create a copy of the project in Launchpad before running the snap build. The problem is that Snapcraft seems to ignore tags while creating the copy of the project, which means the go generate ./cmd in the snapcraft.yaml's override-build will never dynamically generate the right version.

Solution

This PR enforces the execution of go generate ./cmd as a pre-requisite for running the snap build. I.e., for both local and remote builds, go generate ./cmd must be run first, such that the VERSION and version_generated.go files are staged in the repo, prior to the snap build, such that the override-build script can simply rely on that information and thus ignore the missing Git refs in the LP's project.