LP builders: git worktree dirty when building snap?

Asked by Peter Sabaini

As part of the snapcraft.yaml we have an override-prime stage where it does a `git describe --always --dirty` to get info from the current git tree.

In the recent builds it now shows the hash as `foohash-dirty`, i.e. not a pristine checkout. Example build: https://launchpad.net/~peter-sabaini/microceph/+snap/microceph-main/+build/2397889

The orig. source repo is here: https://github.com/canonical/microceph . The snapcraft.yaml: https://github.com/canonical/microceph/blob/main/snap/snapcraft.yaml

This gets imported into lp git here: https://code.launchpad.net/microceph

When building locally, the worktree seems clean. I can see that we had clean builds on lp as well previously, e.g. build lp-85631931 resulted in a clean hash, 18.2.0+snap3f8909a69a (I don't have a link to the buildlog unfort.)

Should the build worktree not always be pristine? What could be the cause of this?

Question information

Language:
English Edit question
Status:
Solved
For:
Launchpad itself Edit question
Assignee:
No assignee Edit question
Solved by:
Simone Pelosi
Solved:
Last query:
Last reply:
Revision history for this message
Best Simone Pelosi (pelpsi) said :
#2

Hey! `go get` it's called before the build phase and it's modifying the go.mod file:

```
:: + git diff -C /build/microceph
:: diff --git a/microceph/go.mod b/microceph/go.mod
:: index 2f6dedf..9f7a50f 100644
:: --- a/microceph/go.mod
:: +++ b/microceph/go.mod
:: @@ -10,6 +10,7 @@ require (
:: github.com/gorilla/mux v1.8.1
:: github.com/olekukonko/tablewriter v0.0.5
:: github.com/pborman/uuid v1.2.1
:: + github.com/sirupsen/logrus v1.9.3
:: github.com/spf13/cobra v1.8.0
:: github.com/stretchr/testify v1.8.4
:: github.com/tidwall/gjson v1.17.0
:: @@ -46,7 +47,6 @@ require (
:: github.com/rivo/uniseg v0.4.7 // indirect
:: github.com/robfig/cron/v3 v3.0.1 // indirect
:: github.com/rogpeppe/go-internal v1.10.0 // indirect
:: - github.com/sirupsen/logrus v1.9.3 // indirect
:: github.com/spf13/pflag v1.0.5 // indirect
:: github.com/stretchr/objx v0.5.1 // indirect
:: github.com/tidwall/match v1.1.1 // indirect
```

I tried to build microceph applying the diff and I'm able to produce a build without `dirty` suffix.
https://launchpad.net/~pelpsi/+snap/test-microceph/+build/2400013

Revision history for this message
Peter Sabaini (peter-sabaini) said :
#3

Thanks Simone.