Github: Add and replace snap build job - #1470
Conversation
2ee113c to
ca29314
Compare
There was a problem hiding this comment.
Pull request overview
Migrates the GitHub Actions “snap” job to the newer Launchpad snap build flow (aligned with the approach used by LXD), replacing the previous microcloud-pkg-snap-based triggering.
Changes:
- Updates the snap job to use
canonical/lxd-pkg-snap/.github/actions/lp-snap-buildwith the MicroCloud Launchpad repo. - Adds branch mapping logic (edge vs candidate) and derives snap
version/gradefromversion/version.goand branch naming patterns. - Pushes updates to the Launchpad branches, including repository packing/gc before pushing.
Comments suppressed due to low confidence (1)
.github/workflows/tests.yml:379
- Same issue as above:
|| truesuppresses grep errors (exit 2) as well as "no matches" (exit 1). Count withawkso missing/unreadable files still fail clearly.
# Fail unless exactly one `grade: devel` line exists, then replace it.
match_count="$(grep -cxF 'grade: devel' snapcraft.yaml || true)"
if [ "${match_count}" -ne 1 ]; then
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
e4f09bf to
bccbd18
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.
Comments suppressed due to low confidence (1)
snap/snapcraft.yaml:99
go get ./...during the snap build can update go.mod/go.sum (and potentially upgrade deps), making the snap build non-reproducible. Prefer downloading modules without changing the module graph.
set -ex
# Download the dependencies
go get -v -tags=agent ./...
bccbd18 to
95324b6
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
Comments suppressed due to low confidence (1)
snap/snapcraft.yaml:97
go get ... ./...is not a pure “download deps” step and can updatego.mod/go.sum, reducing build reproducibility. Usego mod downloadto fetch the pinned module graph without modifying module files.
go get -v -tags=agent ./...
95324b6 to
26dd5fd
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
Comments suppressed due to low confidence (1)
snap/snapcraft.yaml:97
override-pullusesgo get -v -tags=agent ./...to “download dependencies”. In module mode,go get ./...can update go.mod/go.sum and may invoke package loading that triggers CGO processing/build steps, which is fragile this early in the lifecycle (before the build env/CGO flags are set) and can fail on cgo-based deps. Prefergo mod download(orgo mod download -x) here to fetch modules without attempting to build/update them.
override-pull: |
craftctl default
set -ex
# Download the dependencies
go get -v -tags=agent ./...
Migrates the build job from github.com/canonical/microcloud-pkg-snap. Aligns with the build job from LXD. Signed-off-by: Julian Pelizäus <julian.pelizaeus@canonical.com>
Signed-off-by: Julian Pelizäus <julian.pelizaeus@canonical.com>
Signed-off-by: Julian Pelizäus <julian.pelizaeus@canonical.com>
26dd5fd to
818efc4
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
Comments suppressed due to low confidence (1)
snap/snapcraft.yaml:97
override-pullrunsgo get ./...to “download dependencies”.go getis intended for changing module requirements and can unexpectedly rewrite go.mod/go.sum during the pull step. Use a non-mutating download step (e.g.go mod download) to populate the module cache instead.
# Download the dependencies
go get -v -tags=agent ./...
Migrates the build job from github.com/canonical/microcloud-pkg-snap. Aligns with the build job from LXD.
To stay in line with LXD, I would propose using the same format for
release-*branches even though MicroCloud usesvX-edgescheme for the version branches.